-
Notifications
You must be signed in to change notification settings - Fork 163
Open
Labels
bugSomething isn't workingSomething isn't workingcompilerEclipse Java Compiler (ecj) related issuesEclipse Java Compiler (ecj) related issues
Description
Found during experiments for #859.
To reproduce, compile snippet:
public class X {
public interface S<T> {
T s(T t);
}
public void f() {
S<?> s = v -> v ) ;
}
}
Observe compile error from ecj (4.27):
----------
1. ERROR in .../X.java (at line 6)
S<?> s = v -> v ) ;
^
Syntax error on token ")", ElidedSemicolonAndRightBrace expected
----------
1 problem (1 error)
Compile error from javac (OpenJDK 17):
X.java:6: error: ';' expected
S<?> s = v -> v ) ;
^
1 error
This seems to not be expected (unsurprisingly), see ProblemReporter.replaceIfSynthetic(String):
private String replaceIfSynthetic(String token) {
/* Java 8 grammar changes use some synthetic tokens to make the grammar LALR(1). These tokens should not be exposed in messages
as it would make no sense to the programmer whatsoever. Replace such artificial tokens with some "suitable" alternative. At
the moment, there are two synthetic tokens that need such massaging viz : "BeginLambda" and "BeginTypeArguments". There is a
third synthetic token "ElidedSemicolonAndRightBrace" that we don't expect to show up in messages since it is manufactured by
the parser automatically.
*/
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompilerEclipse Java Compiler (ecj) related issuesEclipse Java Compiler (ecj) related issues