Skip to content

Instantly share code, notes, and snippets.

@qmx
Created June 27, 2011 13:30
Show Gist options
  • Save qmx/1048853 to your computer and use it in GitHub Desktop.
Save qmx/1048853 to your computer and use it in GitHub Desktop.
Compiled from "ClosureTest.java"
final class ClosureTest$1 implements ClosureTest$Closure {
final java.lang.Object val$o;
ClosureTest$1(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: putfield #1 // Field val$o:Ljava/lang/Object;
5: aload_0
6: invokespecial #2 // Method java/lang/Object."<init>":()V
9: return
public void doSomething();
Compiled from "ClosureTest.java"
public class ClosureTest {
public ClosureTest();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: new #2 // class java/lang/Object
3: dup
4: invokespecial #1 // Method java/lang/Object."<init>":()V
7: astore_1
8: new #3 // class ClosureTest$1
11: dup
12: aload_1
13: invokespecial #4 // Method ClosureTest$1."<init>":(Ljava/lang/Object;)V
16: pop
17: return
}
Code:
0: getstatic #3 // Field java/lang/System.out:Ljava/io/PrintStream;
3: aload_0
4: getfield #1 // Field val$o:Ljava/lang/Object;
7: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
10: return
}
Compiled from "ClosureTest.java"
public class ClosureTest {
public ClosureTest();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: new #2 // class java/lang/Object
3: dup
4: invokespecial #1 // Method java/lang/Object."<init>":()V
7: astore_1
8: new #3 // class ClosureTest$1
11: dup
12: aload_1
13: invokespecial #4 // Method ClosureTest$1."<init>":(Ljava/lang/Object;)V
16: pop
17: return
}
public class ClosureTest {
public static interface Closure {
public void doSomething();
}
public static void main(String[] args){
final Object o = new Object();
new Closure(){
public void doSomething() {
System.out.println(o);
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment