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 2021/07/25 17:18:00 UTC

[jira] [Commented] (GROOVY-10181) Groovy 3 AST for annotated fields reports wrong lastLineNumber if field not initialized

    [ https://issues.apache.org/jira/browse/GROOVY-10181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17386922#comment-17386922 ] 

Daniel Sun commented on GROOVY-10181:
-------------------------------------

I'll take a look.

> 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
>            Priority: Minor
>
> 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.3.4#803005)