paulk-asert commented on a change in pull request #1485:
URL: https://github.com/apache/groovy/pull/1485#discussion_r574836618
##########
File path: src/main/java/org/apache/groovy/parser/antlr4/SemanticPredicates.java
##########
@@ -179,10 +179,12 @@ public static boolean
isInvalidLocalVariableDeclaration(TokenStream ts) {
token = ts.LT(index);
tokenType = token.getType();
tokenType3 = ts.LT(index + 2).getType();
+ int nextCodePoint = token.getText().codePointAt(0);
return // VOID == tokenType ||
!(BuiltInPrimitiveType == tokenType ||
Arrays.binarySearch(MODIFIER_ARRAY, tokenType) >= 0)
- &&
Character.isLowerCase(token.getText().codePointAt(0))
+ && !Character.isUpperCase(nextCodePoint)
+ && nextCodePoint != '@'
Review comment:
I would have thought so too but without it the following annotation on a
local variable declaration failed:
> > Task :compileTestGroovy FAILED
> startup failed:
>
D:\projects\groovyCopy\src\test\gls\annotations\closures\AnnotationClosureOwnerCallTest.groovy:
45: Unexpected input: '@' @ line 45, column 9.
> @AnnWithClassElement(elem = { owner.answer() })
> ^
>
> 1 error
>
```
@AnnWithClassElement(elem = { owner.answer() })
def aLocal
```
Perhaps there is a better tweak to cover that case?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]