Found by code inspection & white box testing:
The following program is rejected by javac JDK23 (error: the switch statement does not cover all possible input values) but ECJ faultily compiles the program resulting in MatchException being thrown at runtime.
public sealed interface X {
record R(X x) {}
final class C1 implements X {}
final class C2 implements X {}
public static void main(String[] args) {
bar(new R(new C1()));
}
public static void bar(R r) {
switch (r) {
case R(C1 c1) when c1 == null -> System.out.println();
case R(C2 c1) -> System.out.println();
}
}
}
Problem dates back to atleast 4.32. 4.31 rejects the program but not sure if it doing correct thing correctly or is doing the correct thing incorrectly ;-)