From 567be45b8c3a023770f7551d4a7ce797a3f00031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 14 Oct 2016 10:06:29 -0300 Subject: [PATCH] Simplify VariableDeclaratorId parsing - Don't look for arrays where there can be none --- pmd-java/etc/grammar/Java.jjt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 5b2b631c37..6fca4a88b1 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1,4 +1,9 @@ /** + * Simplify VariableDeclaratorId, forbidding illegal sequences such as + * this[] and MyClass.this[] + * + * Juan Martin Sotuyo Dodero 10/2016 + *==================================================================== * Fix for an expression within an additive expression that was * wrongly taken as a cast expression. * Bug #1484 @@ -1418,9 +1423,8 @@ void VariableDeclaratorId() : { (LOOKAHEAD(2) t= "." { checkforBadExplicitReceiverParameter(); jjtThis.setExplicitReceiverParameter(); image=t.image + ".this"; } | t= { checkforBadExplicitReceiverParameter(); jjtThis.setExplicitReceiverParameter(); image = t.image;} - | t= { image = t.image; } + | t= { image = t.image; } ( "[" "]" { jjtThis.bumpArrayDepth(); })* ) - ( "[" "]" { jjtThis.bumpArrayDepth(); })* { checkForBadAssertUsage(image, "a variable name"); checkForBadEnumUsage(image, "a variable name");