[ 
https://issues.apache.org/jira/browse/GROOVY-11212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles resolved GROOVY-11212.
----------------------------------
    Fix Version/s: 5.0.0-alpha-1
       Resolution: Fixed

This is indeed fixed in Groovy 5.  The resolution of outer class members is 
much improved.

You should also be able to use {{@CompileStatic}} to get this to work in Groovy 
4.

> Access to private fields of superclass from a block fails in subclass
> ---------------------------------------------------------------------
>
>                 Key: GROOVY-11212
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11212
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.x
>            Reporter: OC
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 5.0.0-alpha-1
>
>
> Test code:
> {code:groovy}
> class Foo {
>   private static final String wth='wth'
>   def foo() {
>     1.times {
>       println wth
>     }
>   }
> }
> class Bar extends Foo { }
> new Bar().foo() 
> {code}
> Causes “groovy.lang.MissingPropertyException: No such property: wth for 
> class: Bar”. Seems to affect all 4* versions (myself I've tested just a 
> couple of them), did work in 3 and I am told it again works in 5.
> There's an easy work-around, an explicit qualifier, in this case "println 
> Foo.wth", fixes the problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to