Merge branch 'issue-208' into pmd/5.5.x

Closes #211 (rebased onto pmd/5.4.x)
This commit is contained in:
Andreas Dangel
2017-01-27 20:04:51 +01:00
4 changed files with 24 additions and 1 deletions

View File

@ -1,4 +1,9 @@
/**
* Allow local classes to carry more than one annotation.
* Bug #208
*
* Juan Martin Sotuyo Dodero 01/2017
*====================================================================
* Change lookahead for AnnotationMethodDeclaration in AnnotationTypeMemberDeclaration.
* Bug #206
*
@ -1982,7 +1987,7 @@ void BlockStatement():
ClassOrInterfaceDeclaration, but that seems like a hack that
could break other things...
*/
LOOKAHEAD( [Annotation()] ["final"|"abstract"] "class") [Annotation()] ClassOrInterfaceDeclaration(0)
LOOKAHEAD( (Annotation())* ["final"|"abstract"] "class") (Annotation())* ClassOrInterfaceDeclaration(0)
}
void LocalVariableDeclaration() :

View File

@ -152,6 +152,12 @@ public class ParserCornersTest extends ParserTst {
parseJava18(code);
}
@Test
public void testGitHubBug208ParseError() throws Exception {
String c = IOUtils.toString(this.getClass().getResourceAsStream("GitHubBug208.java"));
parseJava15(c);
}
/**
* This triggered bug #1484 UnusedLocalVariable - false positive - parenthesis
* @throws Exception

View File

@ -0,0 +1,11 @@
public class GitHubBug208 {
public void testMethod() {
@Lazy
@Configuration
class LocalClass {
@Bean Object foo() {
return null;
}
}
}
}

View File

@ -194,6 +194,7 @@ See also [bugfix #1556](https://sourceforge.net/p/pmd/bugs/1556/).
* [#185](https://github.com/pmd/pmd/issues/185): \[java] CPD runs into NPE when analyzing Lucene
* [#206](https://github.com/pmd/pmd/issues/206): \[java] Parse error on annotation fields with generics
* [#207](https://github.com/pmd/pmd/issues/207): \[java] Parse error on method reference with generics
* [#208](https://github.com/pmd/pmd/issues/208): \[java] Parse error with local class with 2 or more annotations
* [#213](https://github.com/pmd/pmd/issues/213): \[java] CPD: OutOfMemory when analyzing Lucene
* [#1542](https://sourceforge.net/p/pmd/bugs/1542/): \[java] CPD throws an NPE when parsing enums with -ignore-identifiers
* [#1545](https://sourceforge.net/p/pmd/bugs/1545/): \[java] Symbol Table fails to resolve inner classes