Java inspection: Don't look for assignment chains in nested code blocks in "Move return to computation" inspection (IDEA-121153)

This commit is contained in:
Pavel Dolgov
2016-09-08 16:22:07 +03:00
parent afff3b41d5
commit 6212f4138a
3 changed files with 27 additions and 18 deletions
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int x;
int y;
int f(int a) {
int n = -1;
if (a != 0) {
n = a;
n = 31 * x + n;
return 31 * y + n;
}
return n;
}
}
@@ -1,15 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int x;
int y;
int x;
int y;
int f(int a) {
int n = -1;
if (a != 0) {
n = a;
n = 31 * x + n;
n = 31 * y + n;
int f(int a) {
int n = -1;
if (a != 0) {
n = a;
n = 31 * x + n;
n = 31 * y + n;
}
re<caret>turn n;
}
re<caret>turn n;
}
}