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

Eric Milles edited comment on GROOVY-7676 at 12/19/21, 5:24 PM:
----------------------------------------------------------------

See GROOVY-1569, GROOVY-3073, et al.

Static compilation can be applied to A or Main to generate the necessary bridge 
methods.


was (Author: emilles):
See GROOVY-3073, et al.

Static compilation can be applied to A or Main to generate the necessary bridge 
methods.

> Exception on accessing outer class private field from inner anonymous class 
> instance
> ------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7676
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7676
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, groovy-runtime
>    Affects Versions: 2.4.5
>         Environment: Linux
>            Reporter: Roman Saveljev
>            Priority: Major
>
> There is a reduced groovy code (sorry, can not really describe it in a humane 
> way - please look into it) - 
> https://gist.github.com/RomanSaveljev/bd651045b3631385066f
> The code throws:
> groovy.lang.MissingPropertyException: No such property: a for class: Main
>       at Main$Factory.propertyMissing(bug.groovy)
>       at Main$Factory.getProperty(bug.groovy)
>       at Main$Factory.this$dist$get$1(bug.groovy)
>       at Main$Factory$1.propertyMissing(bug.groovy)
>       at Main$A.getProperty(bug.groovy)
>       at Main$A.this$dist$get$1(bug.groovy)
>       at Main$A$1.propertyMissing(bug.groovy)
>       at Main$Inner.getProperty(bug.groovy)
>       at Main$A$1.findA(bug.groovy:17)
>       at Main$Inner.doSomething(bug.groovy:9)
>       at Main$Inner$doSomething.call(Unknown Source)
>       at Main$A.doSomething(bug.groovy:21)
>       at Main$A$doSomething.call(Unknown Source)
>       at Main.main(bug.groovy:40)
> I have also translated the same to Java and it works (prints 7)
> {{Main#A#a}} being private is what triggers the issue. Making it 
> protected/public is a workaround.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to