mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java: Improvements in intention to split switch branch with multiple values into separate branches (IDEA-203895)
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 2:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 3:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 4:
|
||||
System.out.println("bye");
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
case 2:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
<caret>case 1:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
// 1
|
||||
case /*2*/ /*3*/2: // 4
|
||||
// 5
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 1:
|
||||
// 5
|
||||
System.out.println("hello");
|
||||
break;
|
||||
/*6*/
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
<caret>case 2:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 1 + 1:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
// 1
|
||||
case /*2*/1 /*3*/ /*4*/: //5
|
||||
// 6
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 2:
|
||||
// 6
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 3:
|
||||
// 6
|
||||
System.out.println("hello");
|
||||
break;
|
||||
// 7
|
||||
case 4:
|
||||
System.out.println("bye");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
switch (n) {
|
||||
case 3 -> s = "x";
|
||||
case 1 + 1 -> s = "x";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "false"
|
||||
// "Split values of 'switch' branch" "false"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
<caret>case 1, 2, 3:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
case 4:
|
||||
System.out.println("bye");
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
case 1<caret>, 2:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
// 1
|
||||
case /*2*/1<caret>, /*3*/2: // 4
|
||||
// 5
|
||||
System.out.println("hello");
|
||||
break;
|
||||
/*6*/
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
case 1, <caret>2:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
case 1, 1+1<caret>:
|
||||
System.out.println("hello");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void test(int i) {
|
||||
switch (i) {
|
||||
// 1
|
||||
<caret>case /*2*/1, /*3*/2, /*4*/3: //5
|
||||
// 6
|
||||
System.out.println("hello");
|
||||
break;
|
||||
// 7
|
||||
case 4:
|
||||
System.out.println("bye");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Split values of 'switch' rule" "true"
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Split values of 'switch' branch" "true"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s = "";
|
||||
switch (n) {
|
||||
case <caret>1 + 1, 3 -> s = "x";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user