Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0.8
-
None
Description
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.