[
https://issues.apache.org/jira/browse/GROOVY-7031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410600#comment-15410600
]
Paul King commented on GROOVY-7031:
-----------------------------------
This seems to work on 2.4.7 and master. I am assuming that the last assert is
supposed to have '=='.
> @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
> 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
(v6.3.4#6332)