-
Bug
-
Resolution: Fixed
-
P2
-
13
-
b28
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8226969 | 14 | Jan Lahoda | P2 | Resolved | Fixed | b04 |
JDK-8228262 | 13.0.2 | Jan Lahoda | P2 | Resolved | Fixed | b01 |
JDK-8228046 | 13.0.1 | Jan Lahoda | P2 | Resolved | Fixed | master |
The below code should throw a compilation error as there is no result expression for the switch expression. However, the compilation goes through successfully.
public class SwitchTest {
public static void main(String[] args) throws MyException {
int i = 0;
int a = switch (i) {
default -> throw new MyException();
};
System.out.println(a);
}
}
class MyException extends Exception {
}
public class SwitchTest {
public static void main(String[] args) throws MyException {
int i = 0;
int a = switch (i) {
default -> throw new MyException();
};
System.out.println(a);
}
}
class MyException extends Exception {
}
- backported by
-
JDK-8226969 No compilation error when switch expression has no result expressions
-
- Resolved
-
-
JDK-8228046 No compilation error when switch expression has no result expressions
-
- Resolved
-
-
JDK-8228262 No compilation error when switch expression has no result expressions
-
- Resolved
-