-
Bug
-
Resolution: Fixed
-
P3
-
21
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8310430 | 21.0.1 | Angelos Bimpoudis | P3 | Resolved | Fixed | b02 |
JDK-8310199 | 21 | Angelos Bimpoudis | P3 | Resolved | Fixed | b28 |
sealed interface Animal permits Dog, Chicken {};
record Dog(String name, int age) implements Animal {};
record Chicken(String name, int age) implements Animal {};
void main() {
Animal a1 = new Dog("Yodel", 4);
Animal a2 = new Chicken("Purple Head", 5);
switch (a1) {
case Dog(var name, _) -> System.out.println("Dog: " + name);
case Chicken(var name, _) -> System.out.println("Chicken: " + name);
// default -> System.out.println("Unknown animal");
}
}
record Dog(String name, int age) implements Animal {};
record Chicken(String name, int age) implements Animal {};
void main() {
Animal a1 = new Dog("Yodel", 4);
Animal a2 = new Chicken("Purple Head", 5);
switch (a1) {
case Dog(var name, _) -> System.out.println("Dog: " + name);
case Chicken(var name, _) -> System.out.println("Chicken: " + name);
// default -> System.out.println("Unknown animal");
}
}
- backported by
-
JDK-8310199 Switch with unnamed patterns erroneously non-exhaustive
- Resolved
-
JDK-8310430 Switch with unnamed patterns erroneously non-exhaustive
- Resolved
- links to
-
Commit openjdk/jdk21/aced1144
-
Commit openjdk/jdk/32243ef4
-
Review openjdk/jdk21/23
-
Review openjdk/jdk/14488
(1 links to)