Description
The parameter name '_' is prohibited by the parser for lambdas. This is correct behavior, but the error message is very unhelpful:
UnderscoreName.java:7: error: <identifier> expected
java.util.function.Function<String,String> f = _ -> "x";
^
UnderscoreName.java:7: error: illegal start of expression
java.util.function.Function<String,String> f = _ -> "x";
^
UnderscoreName.java:7: error: ';' expected
java.util.function.Function<String,String> f = _ -> "x";
^
A better approach would be to parse the name as is, and provide a descriptive error message in a later phase.
UnderscoreName.java:7: error: <identifier> expected
java.util.function.Function<String,String> f = _ -> "x";
^
UnderscoreName.java:7: error: illegal start of expression
java.util.function.Function<String,String> f = _ -> "x";
^
UnderscoreName.java:7: error: ';' expected
java.util.function.Function<String,String> f = _ -> "x";
^
A better approach would be to parse the name as is, and provide a descriptive error message in a later phase.