Eric Milles created GROOVY-11483:
------------------------------------

             Summary: reference to outer class non-private static field before 
special ctor call
                 Key: GROOVY-11483
                 URL: https://issues.apache.org/jira/browse/GROOVY-11483
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
class Outer {
    @groovy.transform.CompileStatic
    static class Inner {
        public final String value
        Inner(String string) {
            value = string
        }
        Inner() {
            this(VALUE.toString())
        }
    }
    public static Integer VALUE = 42
    static main(args) {
        assert new Inner().value == '42'
    }
}
{code}

The expression "this(VALUE.toString())" throws a cast exception at runtime.  It 
is compiled to {{this.getProperty("VALUE")}} -- however "this" is static at the 
point.



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

Reply via email to