pmd: fixed #1107 PMD 5.0.4 couldn't parse call of parent outer java class method from inner class

This commit is contained in:
Andreas Dangel 2013-08-03 21:38:16 +02:00
parent d0c103ab62
commit 0859285b8b
3 changed files with 26 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Fixed bug 991: AvoidSynchronizedAtMethodLevel for static methods
Fixed bug 1084: NPE at UselessStringValueOfRule.java:36
Fixed bug 1092: Wrong Attribute "excludemarker" in Ant Task Documentation
Fixed bug 1104: IdempotentOperation false positive
Fixed bug 1107: PMD 5.0.4 couldn't parse call of parent outer java class method from inner class
Fixed bug 1111: False positive: Useless parentheses
Fixed bug 1114: CPD - Tokenizer not initialized with requested properties
Fixed bug 1118: ClassCastException in pmd.lang.ecmascript.ast.ASTElementGet

View File

@ -1719,6 +1719,7 @@ void PrimaryPrefix() :
void PrimarySuffix() :
{Token t;}
{ LOOKAHEAD(2) "." "this"
| LOOKAHEAD(2) "." "super"
| LOOKAHEAD(2) "." AllocationExpression()
| LOOKAHEAD(3) MemberSelector()
| "[" Expression() "]" {jjtThis.setIsArrayDereference();}

View File

@ -16,6 +16,30 @@ import org.junit.Test;
public class ParserCornersTest extends ParserTst {
/**
* #1107 PMD 5.0.4 couldn't parse call of parent outer java class method from inner class
* @throws Exception any error
*/
@Test
public void testInnerOuterClass() throws Exception {
parseJava17("/**\n" +
" * @author azagorulko\n" +
" *\n" +
" */\n" +
"public class TestInnerClassCallsOuterParent {\n" +
"\n" +
" public void test() {\n" +
" new Runnable() {\n" +
" @Override\n" +
" public void run() {\n" +
" TestInnerClassCallsOuterParent.super.toString();\n" +
" }\n" +
" };\n" +
" }\n" +
"}\n"
);
}
@Test
public final void testGetFirstASTNameImageNull() throws Throwable {
parseJava14(ABSTRACT_METHOD_LEVEL_CLASS_DECL);