analyze-java-code-examples icon indicating copy to clipboard operation
analyze-java-code-examples copied to clipboard

Anonymous inner classes cannot output

Open jokermonn opened this issue 3 years ago • 1 comments

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

jokermonn avatar Feb 27 '22 02:02 jokermonn

Thank you for reporting this

ftomassetti avatar Feb 28 '22 15:02 ftomassetti