Created
November 22, 2013 17:29
-
-
Save chochos/7603754 to your computer and use it in GitHub Desktop.
Inner class bug in Groovy
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 Parent { | |
String name | |
} | |
class External extends Parent { | |
String outer | |
Internal inner(String p) { | |
new Internal(inner:p) | |
} | |
class Internal { | |
String inner | |
void boom() { | |
println "Outer is " + outer + ", inner is " + inner | |
println "But parent is " + name // Only works with External.this.name or getName() | |
} | |
} | |
} | |
new External(outer:"good", name:"fucked").inner("good").boom() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment