Created
July 10, 2011 07:36
-
-
Save kmizu/1074357 to your computer and use it in GitHub Desktop.
A case that "private" method of Scala is compiled into "public" method of class file.
This file contains hidden or 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 Foo { | |
private def foo { | |
Foo.foo | |
} | |
} | |
object Foo { | |
private def foo { | |
println("foo") | |
} | |
} |
This file contains hidden or 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 "Foo.scala" | |
public final class Foo$ extends java.lang.Object implements scala.ScalaObject{ | |
public static final Foo$ MODULE$; | |
public static {}; | |
Code: | |
0: new #9; //class Foo$ | |
3: invokespecial #12; //Method "<init>":()V | |
6: return | |
public final void Foo$$foo(); | |
Code: | |
0: getstatic #18; //Field scala/Predef$.MODULE$:Lscala/Predef$; | |
3: ldc #21; //String foo | |
5: invokevirtual #25; //Method scala/Predef$.println:(Ljava/lang/Object;)V | |
8: return | |
} |
This file contains hidden or 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 "Foo.scala" | |
public class Foo extends java.lang.Object implements scala.ScalaObject{ | |
public static final void Foo$$foo(); | |
Code: | |
0: getstatic #11; //Field Foo$.MODULE$:LFoo$; | |
3: invokevirtual #13; //Method Foo$.Foo$$foo:()V | |
6: return | |
public Foo(); | |
Code: | |
0: aload_0 | |
1: invokespecial #20; //Method java/lang/Object."<init>":()V | |
4: return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment