In some cases, there are some extraneous error messages when an opening brace is missing. Error recovery could be improved to reduce the number of error messages for a single syntax error.
i.e. - in JDK 22, the following missing open brace on a method generates 4 error messages, one more than with JDK 21.
package tests; // TestB.java:1: error: implicitly declared class should not have package declaration
public class TestB {
public static boolean test() // <--- missing open brace
return true;
}
public static boolean test2() {
return true;
}
}
i.e. - in JDK 22, the following missing open brace on a method generates 4 error messages, one more than with JDK 21.
package tests; // TestB.java:1: error: implicitly declared class should not have package declaration
public class TestB {
public static boolean test() // <--- missing open brace
return true;
}
public static boolean test2() {
return true;
}
}
- relates to
-
JDK-8323335 JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview)
- Closed
- links to
-
Commit(master) openjdk/jdk/0b4a7d53
-
Review(master) openjdk/jdk/20070