Merge branch 'issue-207'

Closes #209 (rebased onto pmd/5.4.x)
This commit is contained in:
Andreas Dangel
2017-01-27 19:26:56 +01:00
4 changed files with 18 additions and 1 deletions

View File

@ -1,4 +1,9 @@
/**
* Allow method references to specify generics.
* Bug #207
*
* Juan Martin Sotuyo Dodero 01/2017
*====================================================================
* Simplify VariableDeclaratorId, forbidding illegal sequences such as
* this[] and MyClass.this[]
*
@ -1812,7 +1817,7 @@ Token t;
void MethodReference() :
{Token t; checkForBadMethodReferenceUsage();}
{
"::" ("new" {jjtThis.setImage("new");} | t=<IDENTIFIER> {jjtThis.setImage(t.image);} )
"::" ("new" {jjtThis.setImage("new");} | [TypeArguments()] t=<IDENTIFIER> {jjtThis.setImage(t.image);} )
}
void PrimaryPrefix() :

View File

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

View File

@ -0,0 +1,5 @@
public class GitHubBug207 {
private static HttpMessageWriter<Resource> resourceHttpMessageWriter(BodyInserter.Context context) {
return context.map(BodyInserters::<Resource>cast);
}
}

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
* [#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
* [#1545](https://sourceforge.net/p/pmd/bugs/1545/): \[java] Symbol Table fails to resolve inner classes