You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/18 10:17:00 UTC

[jira] [Resolved] (GROOVY-7031) @CompileStatic breaks assign in combination with dereferencing

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

Daniel Sun resolved GROOVY-7031.
--------------------------------
       Resolution: Fixed
         Assignee: Daniel Sun
    Fix Version/s: 2.5.0-rc-3
                   3.0.0-alpha-3
                   2.6.0-alpha-4

It is fixed. https://github.com/apache/groovy/commit/42aa69f7467c26edbac3fe623b13c24a6adf9a1b

> @CompileStatic breaks assign in combination with dereferencing
> --------------------------------------------------------------
>
>                 Key: GROOVY-7031
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7031
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.3.6, 2.4.0-rc-1
>         Environment: java version "1.8.0_11"
>            Reporter: Florian Freudenberg
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0-rc-3
>
>         Attachments: CompileStaticAssignmentTest.groovy
>
>
> @CompileStatic breaks assignment for code like
> {code}
> @groovy.transform.CompileStatic
> class StaticClass {
>     StringHolder holder = new StringHolder()
>     String str
>     StaticClass(String s) {
>         str = holder.str = s
>     }
> }
> class StringHolder {
>     String str
> }
> def s = new StaticClass('test')
> assert s.holder.str == 'test'
> assert s.str != 'test'
> {code}
> The second assert fails because s.str == null. Without @CompileStatic it works correctly (and as java).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)