1 /*
2 * @test /nodymaticcopyright/
3 * @bug 8206986
4 * @summary Verify rule cases work properly.
5 * @compile/fail/ref=SwitchStatementArrow-old.out -source 9 -Xlint:-options -XDrawDiagnostics SwitchStatementArrow.java
6 * @compile --enable-preview -source ${jdk.version} SwitchStatementArrow.java
7 * @run main/othervm --enable-preview SwitchStatementArrow
8 */
9
10 import java.util.Objects;
11 import java.util.function.Function;
12
13 public class SwitchStatementArrow {
14 public static void main(String... args) {
15 new SwitchStatementArrow().run();
16 }
17
18 private void run() {
19 runTest(this::statement1);
20 runTest(this::scope);
21 }
22
23 private void runTest(Function<T, String> print) {
24 check(T.A, print, "A");
25 check(T.B, print, "B-C");
26 check(T.C, print, "B-C");
27 try {
|
1 /*
2 * @test /nodymaticcopyright/
3 * @bug 8206986
4 * @summary Verify rule cases work properly.
5 * @compile/fail/ref=SwitchStatementArrow-old.out -source 9 -Xlint:-options -XDrawDiagnostics SwitchStatementArrow.java
6 * @compile SwitchStatementArrow.java
7 * @run main SwitchStatementArrow
8 */
9
10 import java.util.Objects;
11 import java.util.function.Function;
12
13 public class SwitchStatementArrow {
14 public static void main(String... args) {
15 new SwitchStatementArrow().run();
16 }
17
18 private void run() {
19 runTest(this::statement1);
20 runTest(this::scope);
21 }
22
23 private void runTest(Function<T, String> print) {
24 check(T.A, print, "A");
25 check(T.B, print, "B-C");
26 check(T.C, print, "B-C");
27 try {
|