use of javax.lang.model.element.TypeElement in project buck by facebook.
the class TreeBackedTypesTest method testIsSameTypeJavacTypeTopLevelNoGenerics.
@Test
public void testIsSameTypeJavacTypeTopLevelNoGenerics() throws IOException {
initCompiler();
TypeElement objectElement = elements.getTypeElement("java.lang.Object");
TypeMirror objectTypeMirror = types.getDeclaredType(objectElement);
TypeMirror objectTypeMirror2 = types.getDeclaredType(objectElement);
assertSameType(objectTypeMirror, objectTypeMirror2);
}
use of javax.lang.model.element.TypeElement in project RoboBinding by RoboBinding.
the class WrappedTypeElement method typeElementOf.
private WrappedTypeElement typeElementOf(DeclaredType declaredType) {
WrappedDeclaredType type = typeWrapper.wrap(declaredType);
TypeElement element = (TypeElement) types.asElement(declaredType);
return new WrappedTypeElement(element, type, typeWrapper, loggerFactory, elements, wrapper, types);
}
use of javax.lang.model.element.TypeElement in project RoboBinding by RoboBinding.
the class ElementWrapperTest method unsupportedElements.
@DataPoints("unsupportedElements")
public static Element[] unsupportedElements() {
Elements elements = compilation.getElements();
PackageElement packageElement = elements.getPackageElement("java.lang");
TypeElement typeElement = elements.getTypeElement(MethodsAndFields.class.getName());
VariableElement variableElement = ElementFilter.fieldsIn(typeElement.getEnclosedElements()).get(0);
return new Element[] { packageElement, variableElement };
}
use of javax.lang.model.element.TypeElement in project RoboBinding by RoboBinding.
the class ElementWrapperTest method supportedElements.
@DataPoints("supportedElements")
public static ElementToWrapped[] supportedElements() {
Elements elements = compilation.getElements();
TypeElement typeElement = elements.getTypeElement(MethodsAndFields.class.getName());
ExecutableElement methodElement = ElementFilter.methodsIn(typeElement.getEnclosedElements()).get(0);
return new ElementToWrapped[] { a(typeElement).itsWrapped(WrappedTypeElement.class), a(methodElement).itsWrapped(MethodElement.class) };
}
use of javax.lang.model.element.TypeElement in project neo4j by neo4j.
the class DuplicatedProcedureValidatorTest method procedureMethod.
private Element procedureMethod(String name) {
TypeElement typeElement = elements.getTypeElement(name);
Collection<Element> procedures = findProcedures(typeElement);
if (procedures.size() != 1) {
throw new AssertionError("Test procedure class should only have 1 defined procedure");
}
return procedures.iterator().next();
}
Aggregations