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;
}
}