-
Bug
-
Resolution: Fixed
-
P3
-
14
As reported [1], JLS14 14.22 [2] does not believe that the following switch statement can complete normally:
switch (b) {
case 1 -> throw new Exception();
}
However, when b is != 1, the switch statement does, in fact, complete normally, per 14.11.3. The definition of "can complete normally" for a switch statement whose switch block consists of switch rules is missing the clause:
" - The switch block does not contain a default label."
[1] http://mail.openjdk.java.net/pipermail/amber-spec-experts/2020-May/002211.html
[2] https://docs.oracle.com/javase/specs/jls/se14/html/jls-14.html#jls-14.22
switch (b) {
case 1 -> throw new Exception();
}
However, when b is != 1, the switch statement does, in fact, complete normally, per 14.11.3. The definition of "can complete normally" for a switch statement whose switch block consists of switch rules is missing the clause:
" - The switch block does not contain a default label."
[1] http://mail.openjdk.java.net/pipermail/amber-spec-experts/2020-May/002211.html
[2] https://docs.oracle.com/javase/specs/jls/se14/html/jls-14.html#jls-14.22