1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8206986
4 * @summary Verify behavior of not exhaustive switch expressions.
5 * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchNotExhaustive.java
6 */
7
8 public class ExpressionSwitchNotExhaustive {
9 private String print(int i) {
10 return switch (i) {
11 case 42 -> "42";
12 case 43 -> "43";
13 };
14 }
15 private String e(E e) {
16 return switch (e) {
17 case A -> "42";
18 };
19 }
20 private String f(int i, E e) {
21 return switch (i) {
22 case 0:
23 String s;
24 switch (e) {
25 case A:
|
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8206986
4 * @summary Verify behavior of not exhaustive switch expressions.
5 * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchNotExhaustive.java
6 */
7
8 public class ExpressionSwitchNotExhaustive {
9 private String print(int i) {
10 return switch (i) {
11 case 42 -> "42";
12 case 43 -> "43";
13 };
14 }
15 private String e(E e) {
16 return switch (e) {
17 case A -> "42";
18 };
19 }
20 private String f(int i, E e) {
21 return switch (i) {
22 case 0:
23 String s;
24 switch (e) {
25 case A:
|