Roman Saveljev created GROOVY-7676: -------------------------------------- Summary: 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 Affects Versions: 2.4.5 Environment: Linux Reporter: Roman Saveljev
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 (v6.3.4#6332)