[ 
https://issues.apache.org/jira/browse/GROOVY-11853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18056452#comment-18056452
 ] 

Eric Milles edited comment on GROOVY-11853 at 2/4/26 4:35 PM:
--------------------------------------------------------------

Examples of (1):
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/test/groovy/gls/innerClass/InnerClassTest.groovy#L916
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/test/groovy/gls/innerClass/InnerClassTest.groovy#L2442

Example of (2):
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/test/groovy/gls/innerClass/InnerClassTest.groovy#L1053

Examples of (3):
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/test/groovy/gls/innerClass/InnerClassTest.groovy#L2034
 -- "@Field Object result" was added to capture inner class write
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/main/java/org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.java#L512
 -- {{invokeMethod}} was changed to {{methodMissing}} so subclass inners could 
use {{extension}}'s methods.


was (Author: emilles):
Examples of (1):
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/test/groovy/gls/innerClass/InnerClassTest.groovy#L916
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/test/groovy/gls/innerClass/InnerClassTest.groovy#L2442

Examples of (2):
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/test/groovy/gls/innerClass/InnerClassTest.groovy#L2034
 -- "@Field Object result" was added to capture inner class write
* 
https://github.com/apache/groovy/blob/a7bebd3bcfbb4ab8379dc20de13be3bed68935ca/src/main/java/org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.java#L512
 -- {{invokeMethod}} was changed to {{methodMissing}} so subclass inners could 
use {{extension}}'s methods.

> 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)'
>             }
> {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)

Reply via email to