-
-
Save reynir/4213411 to your computer and use it in GitHub Desktop.
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
.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 |
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
.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 |
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 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