-
Bug
-
Resolution: Fixed
-
P3
-
21
-
b07
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8312955 | 21.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b04 |
JDK-8312159 | 21 | Jan Lahoda | P3 | Resolved | Fixed | b32 |
Originally reported here:
https://mail.openjdk.org/pipermail/compiler-dev/2023-July/023724.html
Consider the following code:
```
class Test22 {
record Pair(I i1, I i2) {}
sealed interface I {}
record C() implements I {}
record D() implements I {}
void exhaustinvenessWithInterface(Pair pairI) {
switch (pairI) {
case Pair(D fst, C snd) -> {
}
case Pair(C fst, C snd) -> {
}
case Pair(C fst, I snd) -> {
}
case Pair(D fst, D snd) -> {
}
}
}
}
```
The switch in this code should be exhaustive, but javac reports an exhaustivity error for this code:
```
$ javac Test22.java
Test22.java:13: error: the switch statement does not cover all possible input values
switch (pairI) {
^
1 error
```
https://mail.openjdk.org/pipermail/compiler-dev/2023-July/023724.html
Consider the following code:
```
class Test22 {
record Pair(I i1, I i2) {}
sealed interface I {}
record C() implements I {}
record D() implements I {}
void exhaustinvenessWithInterface(Pair pairI) {
switch (pairI) {
case Pair(D fst, C snd) -> {
}
case Pair(C fst, C snd) -> {
}
case Pair(C fst, I snd) -> {
}
case Pair(D fst, D snd) -> {
}
}
}
}
```
The switch in this code should be exhaustive, but javac reports an exhaustivity error for this code:
```
$ javac Test22.java
Test22.java:13: error: the switch statement does not cover all possible input values
switch (pairI) {
^
1 error
```
- backported by
-
JDK-8312159 Incorrect exhaustivity computation
-
- Resolved
-
-
JDK-8312955 Incorrect exhaustivity computation
-
- Resolved
-
- links to
-
Commit openjdk/jdk21/6d9da7ce
-
Commit openjdk/jdk/a4412166
-
Review openjdk/jdk21/138
-
Review openjdk/jdk/14872
(1 links to)