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

Shil Sinha commented on GROOVY-6825:
------------------------------------

In Groovy 2.4.5, the bytecode of Inner#fromInner is:

{code}
 L0
    LINENUMBER 6 L0
    LDC "outer"
    DUP
    ASTORE 1
    ALOAD 0
    GETFIELD Outer$Inner.this$0 : LOuter;
    ALOAD 1
    INVOKEVIRTUAL Outer.setOuterProperty (Ljava/lang/String;)V
    ACONST_NULL
    POP
    ARETURN
   L1
    ACONST_NULL
    ARETURN
{code}

So setOuterProperty is invoked on the outer class reference of the inner 
instance. That looks like a direct setter call to me, but perhaps Cédric meant 
something else.

> Static compiler does not always make direct setter call inside inner class
> --------------------------------------------------------------------------
>
>                 Key: GROOVY-6825
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6825
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.3.1
>            Reporter: Cédric Champeau
>            Assignee: Cédric Champeau
>
> Similarily to GROOVY-6823, this code doesn't produce a direct setter call. 
> However, this one is more complex to fix due to the current static 
> compilation architecture.
> {code}
> @groovy.transform.CompileStatic
> class Outer {
>     String outerProperty
>     private class Inner {
>         String fromInner() {
>             outerProperty = 'outer'
>             //uterProperty
>         }
>     }
>     String blah() {
>         new Inner().fromInner()
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to