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 2017/01/25 12:10:26 UTC

[jira] [Commented] (GROOVY-5510) Wrong line number for assignment

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

Daniel Sun commented on GROOVY-5510:
------------------------------------

The annotations can be thought as a part of declaration, so it is not an issue. e.g.

{code}
class Person {
    @Property name = 'Daniel'  // the very very old syntax to define a property
}
{code}

> Wrong line number for assignment
> --------------------------------
>
>                 Key: GROOVY-5510
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5510
>             Project: Groovy
>          Issue Type: Sub-task
>          Components: parser
>    Affects Versions: 2.0-rc-2
>            Reporter: Cédric Champeau
>             Fix For: 4.0
>
>
> It seems that annotating declarations breaks the line number of the AST node which is annotated, replacing it with the line number of the annotation itself.
> Test case:
> {code}
> void testLineNumber() {
>         assertScript '''//1
>             @ASTTest(phase=INSTRUCTION_SELECTION, value= { // 2
>                 assert node.lineNumber == 5 // 3
>             }) // 4
>             int x = 1
>         '''
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)