Skip to content

Instantly share code, notes, and snippets.

@reynir
Created December 5, 2012 07:28
Show Gist options
  • Save reynir/4213411 to your computer and use it in GitHub Desktop.
Save reynir/4213411 to your computer and use it in GitHub Desktop.
.source A.j
.class public A
.super java/lang/Object
.method public static produce()Lint;
.limit stack 2
.limit locals 0
new int
dup
invokespecial int/<init>()V
areturn
.end method
.method public static consume(Lint;)V
.limit stack 0
.limit locals 1
return
.end method
.source int.j
.class public int
.super java/lang/Object
.method public <init>()V
.limit stack 2
.limit locals 1
aload_0
invokespecial java/lang/Object/<init>()V
return
.end method
.method public value()I
.limit stack 1
.limit locals 1
bipush 42
ireturn
.end method
public class T {
public T() {
A.consume(A.produce()); // Works fine
System.out.println(A.produce().value()); // Works too
// A.consume(A.produce()+1); // Doesn't work
// A.consume(42); // Doesn't work
}
public static void main(String[] args) {
new T();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment