Last active
December 18, 2015 00:49
-
-
Save dtzWill/5699225 to your computer and use it in GitHub Desktop.
Dump of simple nested class with private members
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled from "OuterClass.java" | |
public class OuterClass { | |
private int x; | |
OuterClass(); | |
Code: | |
0: aload_0 | |
1: invokespecial #2 // Method java/lang/Object."<init>":()V | |
4: return | |
static int access$000(OuterClass); | |
Code: | |
0: aload_0 | |
1: getfield #1 // Field x:I | |
4: ireturn | |
} | |
Compiled from "OuterClass.java" | |
class OuterClass$InnerClass { | |
private int y; | |
final OuterClass this$0; | |
OuterClass$InnerClass(OuterClass); | |
Code: | |
0: aload_0 | |
1: aload_1 | |
2: putfield #1 // Field this$0:LOuterClass; | |
5: aload_0 | |
6: invokespecial #2 // Method java/lang/Object."<init>":()V | |
9: aload_0 | |
10: aload_1 | |
11: invokestatic #3 // Method OuterClass.access$000:(LOuterClass;)I | |
14: putfield #4 // Field y:I | |
17: return | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
javac OuterClass.java | |
javap -c -p OuterClass | |
javap -c -p OuterClass\$InnerClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OuterClass { | |
private int x; | |
OuterClass() { | |
x = new InnerClass().y; | |
} | |
class InnerClass { | |
private int y; | |
InnerClass() { | |
y = 5; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment