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

Eric Milles updated GROOVY-11483:
---------------------------------
    Component/s: Static compilation

> 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
>          Components: Static compilation
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> 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