[
https://issues.apache.org/jira/browse/GROOVY-11853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-11853.
------------------------------
> breaking changes for inner class methodMissing and propertyMissing protocol
> ---------------------------------------------------------------------------
>
> Key: GROOVY-11853
> URL: https://issues.apache.org/jira/browse/GROOVY-11853
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 6.0.0-alpha-1
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Labels: breaking
> Fix For: 6.0.0-alpha-1
>
>
> There were some scenarios that allowed access to an object's outer class
> members that no longer work under the GROOVY-11823 redesign.
> 1) access to outer class field through object expression:
> {code:groovy}
> class Outer {
> class Inner {
> }
> def p = "p"
> }
> def o = new Outer()
> def i = new Outer.Inner(o)
> println i.p
> {code}
> 2) outer class method overloads
> {code:groovy}
> interface A {
> def run()
> }
> class B {
> def test() {
> def runner = new A() {
> def run() { return x } // which "x" is this?
> }
> runner.run()
> }
> private x = 1
> void setX(val) { x = val }
> }
> class C extends B {
> def x = 'string' // hides 'B.@x' and overrides 'B.setX(val)'
> }
> print new C().test()
> {code}
> 3) outer class {{invokeMethod}} or other such MOP overloads:
> {code:groovy}
> String string = new Object() {
> @Override
> String toString() {
> // outer class is a Script and overrides getProperty, setProperty and
> invokeMethod
> dynamicVariable = "foo"
> }
> }
> println dynamicVariable
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)