ftomassetti / analyze-java-code-examples

Some examples of code extracting information from Java source files using JavaParser
99 stars 44 forks source link

Anonymous inner classes cannot output #5

Open jokermonn opened 2 years ago

jokermonn commented 2 years ago
new VoidVisitorAdapter<Object>() {
        @Override
        public void visit(ClassOrInterfaceDeclaration n, Object arg) {
          super.visit(n, arg);
          System.out.println(" * " + n.getName());
        }
      }.visit(StaticJavaParser.parse(BFile_sourcePath), null);
package test;

public class B {
    public void print() {
        new BInternal(){}.test();
    }
}

class BInternal {
    void test() {

    }
}

only print

 * B
 * BInternal

need print

* B$1

also

ftomassetti commented 2 years ago

Thank you for reporting this