Fixes #1470 Error with type-bound lambda
This commit is contained in:
@ -1,4 +1,9 @@
|
||||
/**
|
||||
* Fix for Lambda expression with one variable
|
||||
* Bug #1470
|
||||
*
|
||||
* Andreas Dangel 04/2016
|
||||
*====================================================================
|
||||
* Added support for explicit receiver parameters.
|
||||
* Bug #1455
|
||||
*
|
||||
@ -1798,7 +1803,9 @@ void PrimaryPrefix() :
|
||||
| "super" {jjtThis.setUsesSuperModifier();}
|
||||
| LOOKAHEAD( "(" ")" "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( <IDENTIFIER> "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( "(" VariableDeclaratorId() ")" "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( "(" VariableDeclaratorId() "," VariableDeclaratorId() ["," VariableDeclaratorId()] ")" "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( "(" FormalParameter() ")" "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( "(" FormalParameter() "," FormalParameter() ["," FormalParameter() ] ")" "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( LambdaExpression() ) LambdaExpression()
|
||||
| LOOKAHEAD(3) "(" Expression() ")"
|
||||
|
@ -90,6 +90,12 @@ public class ParserCornersTest extends ParserTst {
|
||||
+ " private void deleteDirectory(String path) {\n" + " LOG.debug(path);\n" + " }\n" + "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLambdaBug1470() throws Exception {
|
||||
String code = IOUtils.toString(ParserCornersTest.class.getResourceAsStream("LambdaBug1470.java"), "UTF-8");
|
||||
parseJava18(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for https://sourceforge.net/p/pmd/bugs/1355/
|
||||
*/
|
||||
|
@ -0,0 +1,27 @@
|
||||
package com.sample.test;
|
||||
|
||||
import rx.Observable;
|
||||
import rx.Subscriber;
|
||||
|
||||
public class pmdTest {
|
||||
|
||||
private boolean stuff;
|
||||
|
||||
public Observable<Boolean> testSuper() {
|
||||
return Observable.create(
|
||||
(Subscriber<? super String> subscriber) -> {
|
||||
|
||||
stuff=true;
|
||||
})
|
||||
.map(authToken -> false);
|
||||
}
|
||||
|
||||
public Observable<Boolean> testSuper2() {
|
||||
return Observable.create(
|
||||
(subscriber) -> {
|
||||
|
||||
stuff=true;
|
||||
})
|
||||
.map(authToken -> false);
|
||||
}
|
||||
}
|
@ -55,6 +55,7 @@
|
||||
* [#1455](https://sourceforge.net/p/pmd/bugs/1455/): PMD doesn't handle Java 8 explicit receiver parameters
|
||||
* [#1458](https://sourceforge.net/p/pmd/bugs/1458/): Performance degradation scanning large XML files with XPath custom rules
|
||||
* [#1461](https://sourceforge.net/p/pmd/bugs/1461/): Possible threading issue due to PR#75
|
||||
* [#1470](https://sourceforge.net/p/pmd/bugs/1470/): Error with type-bound lambda
|
||||
|
||||
**API Changes:**
|
||||
|
||||
|
Reference in New Issue
Block a user