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