1 /** 2 * @test /nodynamiccopyright/ 3 * @bug 8206986 4 * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source 12 SwitchStatementBroken2.java 5 */ 6 7 public class SwitchStatementBroken2 { 8 9 private void statementArrowNotArbitraryStatements(int i, int j) { 10 String res; 11 12 switch (i) { 13 case 0 -> res = "NULL-A"; 14 case 1 -> { res = "NULL-A"; } 15 case 2 -> throw new IllegalStateException(); 16 case 3 -> if (j < 0) res = "A"; else res = "B"; 17 case 4 -> while (j-- > 0) res += "I"; 18 case 5 -> switch (j) { 19 case 0: res = "0"; break; 20 } 21 default -> if (j < 0) res = "A"; else res = "B"; 22 } 23 } 24 25 }