Last active
August 29, 2015 14:07
-
-
Save lrytz/838709adcfb0f08eb2c5 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
public class A { | |
public static final int N = 0; | |
} |
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
scalaVersion := "2.11.2" |
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
class C { | |
def foo = A.N | |
} | |
/* | |
lucmac:test luc$ sbt clean compile && javap -c -classpath target/scala-2.11/classes C | grep "public int foo" -A 4 | |
[info] Loading global plugins from /Users/luc/.sbt/0.13/plugins | |
[info] Set current project to test (in build file:/Users/luc/scala/scala/sandbox/test/) | |
[success] Total time: 0 s, completed Oct 20, 2014 2:33:50 PM | |
[info] Updating {file:/Users/luc/scala/scala/sandbox/test/}test... | |
[info] Resolving jline#jline;2.12 ... | |
[info] Done updating. | |
[info] Compiling 1 Scala source and 1 Java source to /Users/luc/scala/scala/sandbox/test/target/scala-2.11/classes... | |
[success] Total time: 3 s, completed Oct 20, 2014 2:33:53 PM | |
public int foo(); | |
Code: | |
0: getstatic #16; //Field A.N:I | |
3: ireturn | |
lucmac:test luc$ rm target/scala-2.11/classes/C.class && sbt compile && javap -c -classpath target/scala-2.11/classes C | grep "public int foo" -A 4 | |
[info] Loading global plugins from /Users/luc/.sbt/0.13/plugins | |
[info] Set current project to test (in build file:/Users/luc/scala/scala/sandbox/test/) | |
[info] Compiling 1 Scala source to /Users/luc/scala/scala/sandbox/test/target/scala-2.11/classes... | |
[success] Total time: 2 s, completed Oct 20, 2014 2:34:00 PM | |
public int foo(); | |
Code: | |
0: iconst_0 | |
1: ireturn | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment