[
https://issues.apache.org/jira/browse/GROOVY-12475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131173#comment-18131173
]
ASF GitHub Bot commented on GROOVY-12475:
-----------------------------------------
paulk-asert opened a new pull request, #3018:
URL: https://github.com/apache/groovy/pull/3018
The annotated declaration was not the one taken as the field, so the
documented form (property first) failed with "declared multiple times", and
since GROOVY-11159 the reversed form left two fields of that name, an invalid
class. Both orders now give one package-private field, the field and property
types are checked, and def, var and val match Object.
> split property definition and PackageScope transform
> ----------------------------------------------------
>
> Key: GROOVY-12475
> URL: https://issues.apache.org/jira/browse/GROOVY-12475
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 4.0.33, 5.1.3, 6.0.0
> Reporter: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> class C {
> def foo = 'bar'
> @groovy.transform.PackageScope Object foo
> }
> println new C().foo
> println new C().@foo
> println new C().getFoo()
> {code}
> Fails with "The field 'foo' is declared multiple times." And if I move "=
> 'bar'" to the field, I instead get "The split property definition named 'foo'
> must not have an initial value for both the field and the property."
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)