public void run(CompilationController cc) throws IOException { cc.toPhase(Phase.ELEMENTS_RESOLVED); for (TypeElement typeElement : cc.getTopLevelElements()) { result.add(ElementUtilities.getBinaryName(typeElement)); } } }, true);
@Override public void run( CompilationController controller ) throws Exception { controller.toPhase(JavaSource.Phase.RESOLVED); String typeName = controller.getFileObject().getName(); List<? extends TypeElement> topLevelElements = controller.getTopLevelElements(); for (TypeElement typeElement : topLevelElements) { if ( kind == typeElement.getKind() && typeName.contentEquals( typeElement.getSimpleName())) { result.add(ElementHandle.create( typeElement)); return; } } } },true);
fo = controller.getFileObject(); TypeElement typeElement = null; List<? extends TypeElement> topLevelElements = controller.getTopLevelElements(); for (Iterator<? extends TypeElement> it = topLevelElements.iterator(); it.hasNext();) { typeElement = it.next();
List<? extends TypeElement> elements = controller.getTopLevelElements(); if (elements != null) { for (TypeElement element : elements) {
fileObject = controller.getFileObject(); TypeElement typeElement = null; List<? extends TypeElement> topLevelElements = controller.getTopLevelElements(); for (Iterator<? extends TypeElement> it = topLevelElements.iterator(); it.hasNext();) { typeElement = it.next();
fileObject = controller.getFileObject(); TypeElement typeElement = null; List<? extends TypeElement> topLevelElements = controller.getTopLevelElements(); for (Iterator<? extends TypeElement> it = topLevelElements.iterator(); it.hasNext();) { typeElement = it.next();
public void run(CompilationController compilationController) throws Exception { compilationController.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED); CompilationUnitTree unitTree = compilationController.getCompilationUnit(); java.util.List<? extends TypeElement> types = compilationController.getTopLevelElements(); if (types.size() > 0) { TypeElement type = types.get(0); java.util.List<ExecutableElement> methods = ElementFilter.methodsIn(type.getEnclosedElements()); for (ExecutableElement method : methods) { if (!method.getModifiers().contains(Modifier.STATIC)) { Tree methodTree = compilationController.getTrees().getTree(method); if (methodTree.getKind() == Kind.METHOD) { Tree tree = ((MethodTree) methodTree).getBody(); if (tree != null) { offset[0] = (int) compilationController.getTrees().getSourcePositions().getStartPosition(unitTree, tree) + 1; break; } } } } } } }, true);
@Override public void run(final CompilationController control) throws Exception { if (control.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED).compareTo (JavaSource.Phase.ELEMENTS_RESOLVED)>=0) { final List<TypeElement> types = new ArrayList<>(); final ElementScanner6<Void,Void> visitor = new ElementScanner6<Void, Void>() { @Override public Void visitType(TypeElement e, Void p) { if (e.getEnclosingElement().getKind() == ElementKind.PACKAGE || e.getModifiers().contains(Modifier.STATIC)) { types.add(e); return super.visitType(e, p); } else { return null; } } }; visitor.scan(control.getTopLevelElements(), null); for (TypeElement type : types) { for (ExecutableElement exec : ElementFilter.methodsIn(control.getElements().getAllMembers(type))) { if (SourceUtils.isMainMethod(exec)) { result.add (ElementHandle.create(type)); } } } } }