I looked at some java bytecode using ASM, and was very surprised when I saw these lines
public class C1 {
// compiled from: C1.java
// access flags 0x9
public static INNERCLASS C2$C3 C2 C3
//..
}
C1
has an INNERCLASS
declaration for a class contained in C2
. Is this how it's supposed to be? If so, why is it needed, and doesn't it lead to much redundancy?
I compiled a minimal example that has a local variable of the inner type in the main method of the outer type using Eclipse Indigo SR1, for what it's worth. Should I report a bug?
public class C1 {
public static void main(String[] args) throws Exception {
C2.C3 c3 = new C2.C3();
ClassReader cr = new ClassReader(C1.class.getName());
cr.accept(new TraceClassVisitor(new PrintWriter(System.out)), 0);
}
}
public class C2 {
public static class C3 {}
}