mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java inspection: Don't look for assignment chains in 'switch' and loop statements in "Move return to computation" inspection (IDEA-121153)
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
// "Move 'return' closer to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
switch (a) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
return n;
|
||||
case 10:
|
||||
case 20:
|
||||
return n + 1;
|
||||
case 30:
|
||||
case 40:
|
||||
case 50:
|
||||
return 2;
|
||||
case 90:
|
||||
return 3;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// "Move 'return' closer to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
switch (a) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
break;
|
||||
case 10:
|
||||
case 20:
|
||||
n = n + 1;
|
||||
break;
|
||||
case 30:
|
||||
case 40:
|
||||
case 50:
|
||||
n = 2;
|
||||
break;
|
||||
case 90:
|
||||
n = 3;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
r<caret>eturn n;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user