@NotNull private static Map<Integer, MethodData> indexFile(LighterAST tree) { Map<Integer, MethodData> result = new HashMap<>(); new RecursiveLighterASTNodeWalkingVisitor(tree) { int methodIndex; @Override public void visitNode(@NotNull LighterASTNode element) { if(element.getTokenType() == JavaElementType.METHOD) { MethodData methodData = calcData(tree, element); if(methodData != null) { result.put(methodIndex, methodData); } methodIndex++; } if(JavaLightStubBuilder.isCodeBlockWithoutStubs(element)) { return; } super.visitNode(element); } }.visitNode(tree.getRoot()); return result; }