mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
Support of enhanced Java 12 switch statements in DFA (IDEA-202132, no expressions yet)
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// "Remove switch label '0-/*x*/1'" "true"
|
||||
class Main {
|
||||
static void fff(int x) {
|
||||
if (x > 0) {
|
||||
switch (x) {
|
||||
case 1, 3 /*x*/: System.out.println("one"); //1
|
||||
case 2: System.out.println("two"); //2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Remove switch branch '-/*x*/1'" "true"
|
||||
class Main {
|
||||
static void fff(int x) {
|
||||
if (x > 0) {
|
||||
switch (x) {
|
||||
case 2 -> System.out.println("two"); //2
|
||||
//1
|
||||
/*x*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class Main {
|
||||
static void fff(int x) {
|
||||
if (x == 5) {
|
||||
//1
|
||||
//2
|
||||
//3
|
||||
//4
|
||||
System.out.println("five-ten-fifteen"); //5
|
||||
System.out.println("six"); //6
|
||||
System.out.println("seven"); //7
|
||||
//other
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
fff();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Remove switch label '0-/*x*/1'" "true"
|
||||
class Main {
|
||||
static void fff(int x) {
|
||||
if (x > 0) {
|
||||
switch (x) {
|
||||
case 1, 3, 0-<caret>/*x*/1: System.out.println("one"); //1
|
||||
case 2: System.out.println("two"); //2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Remove switch branch '-/*x*/1'" "true"
|
||||
class Main {
|
||||
static void fff(int x) {
|
||||
if (x > 0) {
|
||||
switch (x) {
|
||||
case 2 -> System.out.println("two"); //2
|
||||
case -<caret>/*x*/1 -> System.out.println("one"); //1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ class Main {
|
||||
void t() {
|
||||
int i = 5;
|
||||
switch(i) {
|
||||
c<caret>ase 1: case 3: // Apply 'Fix all problems in the file'
|
||||
case <caret>1: case 3: // Apply 'Fix all problems in the file'
|
||||
System.out.println("odd");
|
||||
break;
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class Main {
|
||||
static void fff(int x) {
|
||||
if (x == 5) {
|
||||
switch (x) {
|
||||
case 1: System.out.println("one"); //1
|
||||
case 2: System.out.println("two"); //2
|
||||
case 3: System.out.println("three"); //3
|
||||
case 4: System.out.println("four"); //4
|
||||
case 0, <caret>5, 10: System.out.println("five-ten-fifteen"); //5
|
||||
case 6: System.out.println("six"); //6
|
||||
case 7: System.out.println("seven"); //7
|
||||
break;
|
||||
default: System.out.println("and more"); //other
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
fff();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user