OC created GROOVY-11212:
---------------------------

             Summary: 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


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 (sorry I haven't added them all to 
Version), 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