mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8212982: Rule cases in switch expression accepted even if complete normally
Ensure an error is reported if switch expression does not correctly produce a value. Reviewed-by: mcimadamore
This commit is contained in:
parent
9314c7f110
commit
60b32f222f
10 changed files with 280 additions and 55 deletions
|
@ -46,7 +46,7 @@ public class ExpSwitchNestingTest extends JavacTemplateTestBase {
|
|||
private static final String ESWITCH_S = "String res_string = switch (x) { case 0 -> { # } default -> \"default\"; };";
|
||||
private static final String INT_FN_ESWITCH = "java.util.function.IntSupplier r = switch (x) { case 0 -> { # } default -> null; };";
|
||||
private static final String INT_ESWITCH_DEFAULT = "int res = switch (x) { default -> { # } };";
|
||||
private static final String IF = "if (cond) { # }";
|
||||
private static final String IF = "if (cond) { # } else throw new RuntimeException();";
|
||||
private static final String BLOCK = "{ # }";
|
||||
private static final String BREAK_Z = "break 0;";
|
||||
private static final String BREAK_S = "break \"hello world\";";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue