Merge branch 'issue-206'

Closes #210 (rebased onto pmd/5.4.x)
This commit is contained in:
Andreas Dangel
2017-01-27 19:50:50 +01:00
3 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,9 @@
/**
* Change lookahead for AnnotationMethodDeclaration in AnnotationTypeMemberDeclaration.
* Bug #206
*
* Juan Martin Sotuyo Dodero 01/2017
*====================================================================
* Allow method references to specify generics.
* Bug #207
*
@ -2284,7 +2289,7 @@ void AnnotationTypeMemberDeclaration():
{
modifiers = Modifiers()
(
LOOKAHEAD(3) AnnotationMethodDeclaration(modifiers)
LOOKAHEAD(Type() <IDENTIFIER> "(") AnnotationMethodDeclaration(modifiers)
|
ClassOrInterfaceDeclaration(modifiers)
|

View File

@ -143,6 +143,15 @@ public class ParserCornersTest extends ParserTst {
parseJava18(c);
}
@Test
public void testBug206() throws Exception {
String code = "public @interface Foo {" + PMD.EOL
+ "static final ThreadLocal<Interner<Integer>> interner =" + PMD.EOL
+ " ThreadLocal.withInitial(Interners::newStrongInterner);" + PMD.EOL
+ "}";
parseJava18(code);
}
/**
* This triggered bug #1484 UnusedLocalVariable - false positive -
* parenthesis

View File

@ -235,6 +235,7 @@ to avoid XSS attacks.
* [#183](https://github.com/pmd/pmd/issues/183): \[apex] NCSS Method length is incorrect when using method chaining
* java
* [#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
* [#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