I am looking at some disassembled code obtained from Java bytecode. I see some declaration as follows:
.method static synthetic access$0()Lcom/package/Sample;
I am not able to figure out what the synthetic
or access$0
mean. Can someone please help me understand this part?
In the java language, inner classes can access private members of their enclosing class. However, in Java bytecode, the concept of inner classes does not exist, and the private members are not accessible. To work around this, the compiler creates synthetic accessor methods in the outer class. I believe that is what you are seeing here. access$0
is simply the name of the method. I'm not sure what, if anything the synthetic
does. It may just hide the method from other compilers to ensure encapsulation.