[jdk12] adding support for the new nodes introduced for the improvements to switch statements, and the ‘switch expression’ preview feature, as well as support for the concept of preview features in general.

This commit is contained in:
Reinier Zwitserloot committed 2019-04-24 13:52:17 +02:00
1 parent 031da25e35
commit ccaefff69f
6 files changed
+154 -9

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
// version 12:
public class Switch12 {
public void basic() {
switch (5) {
case 1:
case 2:
System.out.println("OK");
break;
default:
}
}
public void multiCase() {
switch (5) {
case 1, 2:
System.out.println("OK");
default:
}
}
public int switchExpr() {
return switch (5) {
case 1, 2 -> 0;
case 3 -> {
break 10;
}
default -> 10;
} + 10;
}
}