#1258 Java 8 Lambda parse error on direct field access
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
/**
|
||||
* Fix for Lambda expressions without variables.
|
||||
*
|
||||
* Andreas Dangel 11/2014
|
||||
*====================================================================
|
||||
* Fix for Lambda expressions with two or three variables.
|
||||
*
|
||||
* Andreas Dangel 07/2014
|
||||
@ -1765,6 +1769,7 @@ void PrimaryPrefix() :
|
||||
Literal()
|
||||
| "this" {jjtThis.setUsesThisModifier();}
|
||||
| "super" {jjtThis.setUsesSuperModifier();}
|
||||
| LOOKAHEAD( "(" ")" "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( <IDENTIFIER> "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( "(" VariableDeclaratorId() "," VariableDeclaratorId() ["," VariableDeclaratorId()] ")" "->" ) LambdaExpression()
|
||||
| LOOKAHEAD( "(" FormalParameter() "," FormalParameter() ["," FormalParameter() ] ")" "->" ) LambdaExpression()
|
||||
|
@ -144,6 +144,14 @@ public class ParserCornerCases18 {
|
||||
})
|
||||
.count();
|
||||
}
|
||||
// https://sourceforge.net/p/pmd/bugs/1258/
|
||||
public void lambdaWithPropertyAssignment() {
|
||||
object.event = () -> {
|
||||
Request request = new Request();
|
||||
request.id = 42;
|
||||
// request.setId(42);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
* [#1253](https://sourceforge.net/p/pmd/bugs/1253/): Document default behaviour when CPD command line arguments "encoding" and "ignoreAnnotations" are not specified
|
||||
* [#1255](https://sourceforge.net/p/pmd/bugs/1255/): UseUtilityClass false positive with Exceptions
|
||||
* [#1256](https://sourceforge.net/p/pmd/bugs/1256/): PositionLiteralsFirstInComparisons false positive with Characters
|
||||
* [#1258](https://sourceforge.net/p/pmd/bugs/1258/): Java 8 Lambda parse error on direct field access
|
||||
* [#1259](https://sourceforge.net/p/pmd/bugs/1259/): CloseResource rule ignores conditionnals within finally blocks
|
||||
* [#1261](https://sourceforge.net/p/pmd/bugs/1261/): False positive "Avoid unused private methods" with Generics
|
||||
* [#1262](https://sourceforge.net/p/pmd/bugs/1262/): False positive for MissingBreakInSwitch
|
||||
|
Reference in New Issue
Block a user