[ 
https://issues.apache.org/jira/browse/GROOVY-11612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17945999#comment-17945999
 ] 

Eric Milles commented on GROOVY-11612:
--------------------------------------

If fix version does not include Groovy 5, then it should work there already. 
Can you confirm?

> Groovy incorrectly compiles the accessing of InnerClass's variables when the 
> OuterClass has a getter for it
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11612
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11612
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 4.0.21
>            Reporter: Saravanan
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.22
>
>
> {code:java}
> @groovy.transform.CompileStatic
> class Outer {
>     public String description
>     public Outer(Inner inner) {
>         // Groovy will compile this but the statement looks like this and 
> will create a runtime error
>         //    String var3 = ((Outer)ScriptBytecodeAdapter.castToType(inner, 
> Outer.class)).getDescription();
>         this.description = inner.description;
>     }
>     public String getDescription() {
>         return description
>     }
>     static Inner inner() {
>         return new Inner()
>     }
>     static class Inner {
>         public String description = "test"
>     }
> }
> {code}
> Compiles successfully but the generated code fails at runtime



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

Reply via email to