Created
March 18, 2014 16:54
-
-
Save chemikadze/9624223 to your computer and use it in GitHub Desktop.
Anonymous class gotchas!
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
trait IChild | |
trait IParent { | |
def getChild: IChild | |
} | |
class Parent extends IParent { | |
def getChild = new IChild { | |
var notReferenced: Any = _ | |
var referenced: Any = _ | |
def lambda = { () => referenced } | |
} | |
} |
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
Compiled from "anon-class.scala" | |
public final class Parent$$anon$1 implements IChild { | |
private java.lang.Object notReferenced; # notReferenced field is not prefixed | |
private java.lang.Object Parent$$anon$$referenced; # referenced field is prefixed | |
private java.lang.Object notReferenced(); # notReferenced field is private | |
private void notReferenced_$eq(java.lang.Object); | |
public java.lang.Object Parent$$anon$$referenced(); # referenced field is public | |
private void Parent$$anon$$referenced_$eq(java.lang.Object); | |
private scala.Function0<java.lang.Object> lambda(); | |
public Parent$$anon$1(Parent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment