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 2020/08/01 11:37:00 UTC
[jira] [Resolved] (GROOVY-7304) Cannot mutate private field from
within an AIC or a closure
[ https://issues.apache.org/jira/browse/GROOVY-7304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Sun resolved GROOVY-7304.
--------------------------------
Fix Version/s: 3.0.6
4.0.0-alpha-1
Resolution: Fixed
> Cannot mutate private field from within an AIC or a closure
> -----------------------------------------------------------
>
> Key: GROOVY-7304
> URL: https://issues.apache.org/jira/browse/GROOVY-7304
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Reporter: Jochen Theodorou
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-alpha-1, 3.0.6
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> {code:Java}
> class Foo {
> private int i = 1
> @groovy.transform.CompileStatic
> def m() { new String().with {++i}}
> }
> assert new Foo().m() == 2
> class Bar extends Foo {}
> assert new Bar().m() == 2{code}
> The static compiler is unable to generate code which handles the mutation of a private field like in the example above.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)