use of javax.lang.model.type.ErrorType in project androidannotations by androidannotations.
the class CoreValidatorHelper method isSharedPreference.
public void isSharedPreference(Element element, ElementValidation valid) {
TypeMirror type = element.asType();
if (element instanceof ExecutableElement) {
element = ((ExecutableElement) element).getParameters().get(0);
type = element.asType();
}
/*
* The type is not available yet because it has just been generated
*/
if (type instanceof ErrorType || type.getKind() == TypeKind.ERROR) {
String elementTypeName = type.toString();
boolean sharedPrefValidatedInRound = false;
if (elementTypeName.endsWith(classSuffix())) {
String prefTypeName = elementTypeName.substring(0, elementTypeName.length() - classSuffix().length());
prefTypeName = prefTypeName.replace(classSuffix() + ".", ".");
Set<? extends Element> sharedPrefElements = validatedModel().getRootAnnotatedElements(SharedPref.class.getName());
for (Element sharedPrefElement : sharedPrefElements) {
TypeElement sharedPrefTypeElement = (TypeElement) sharedPrefElement;
String sharedPrefQualifiedName = sharedPrefTypeElement.getQualifiedName().toString();
if (sharedPrefQualifiedName.endsWith(prefTypeName)) {
sharedPrefValidatedInRound = true;
break;
}
}
}
if (!sharedPrefValidatedInRound) {
valid.invalidate();
}
} else {
extendsType(element, SharedPreferencesHelper.class.getName(), valid);
}
}
use of javax.lang.model.type.ErrorType in project javapoet by square.
the class AbstractTypesTest method getErrorType.
@Test
public void getErrorType() {
ErrorType errorType = new DeclaredTypeAsErrorType(getTypes().getDeclaredType(getElement(Set.class)));
assertThat(TypeName.get(errorType)).isEqualTo(ClassName.get(Set.class));
}
Aggregations