[
https://issues.apache.org/jira/browse/GROOVY-10181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-10181.
------------------------------
> Groovy 3 AST for annotated fields reports wrong lastLineNumber if field not
> initialized
> ---------------------------------------------------------------------------------------
>
> Key: GROOVY-10181
> URL: https://issues.apache.org/jira/browse/GROOVY-10181
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 3.0.8
> Reporter: Chris Mair
> Assignee: Daniel Sun
> Priority: Minor
> Fix For: 4.0.0-beta-1, 3.0.9
>
>
> If an annotated field does not have an initializer, then the AST incorrectly
> reports the field *lastLineNumber* == *lineNumber* == first line of
> annotations.
> {{For instance:}}
> {{ class Test { // 1}}
> {{ @Deprecated // 2}}
> {{ private int count1 // 3}}
> {{ // 4}}
> {{ @Deprecated // 5}}
> {{ private int count2 = 99 // 6}}
> {{ }}}
> For _count1_, *lastLineNumber* == 2 (should be 3).
> But for _count2_, *lastLineNumber* == 6 (correct).
> This problem does not appear in Groovy 2.5.14.
> This was discovered from a CodeNarc issue
> [#617|https://github.com/CodeNarc/CodeNarc/issues/617].
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)