Consider:
---
sealed interface Intf permits A, B {}
final static class A implements Intf {}
final static class B implements Intf {}
private int test(Intf selectorParam, Boolean b) {
return switch (selectorParam) {
case A a when b -> 2;
case B b -> 1;
};
}
---
This used to compile as exhaustive, although it should not.
---
sealed interface Intf permits A, B {}
final static class A implements Intf {}
final static class B implements Intf {}
private int test(Intf selectorParam, Boolean b) {
return switch (selectorParam) {
case A a when b -> 2;
case B b -> 1;
};
}
---
This used to compile as exhaustive, although it should not.