mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java inspection: Fixed handling of break and continue in "Move return to computation" (IDEA-121153)
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (true) {
|
||||
n = g();
|
||||
if(n != 0) return n;
|
||||
}
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (n <= 0) {
|
||||
n = g();
|
||||
if (n != 0) return n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -5,16 +5,15 @@ class T {
|
||||
int t = a;
|
||||
while (t != null) {
|
||||
if (t == 1) {
|
||||
n = 10;
|
||||
return 10;
|
||||
}
|
||||
else if (t == 2) {
|
||||
n = 20;
|
||||
return 20;
|
||||
}
|
||||
else {
|
||||
t = t + 1;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (true) {
|
||||
n = g();
|
||||
if(n == 0) continue;
|
||||
else return n;
|
||||
}
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (true) {
|
||||
n = g();
|
||||
if(n == 0) continue;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (true) {
|
||||
n = g();
|
||||
if(n != 0) break;
|
||||
}
|
||||
ret<caret>urn n;
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (n <= 0) {
|
||||
n = g();
|
||||
if (n != 0) break;
|
||||
}
|
||||
ret<caret>urn n;
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (true) {
|
||||
n = g();
|
||||
if(n == 0) continue;
|
||||
else break;
|
||||
}
|
||||
ret<caret>urn n;
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (true) {
|
||||
n = g();
|
||||
if(n == 0) continue;
|
||||
break;
|
||||
}
|
||||
ret<caret>urn n;
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "false"
|
||||
class T {
|
||||
int f(int a) {
|
||||
int n = -1;
|
||||
while (n <= 0) {
|
||||
n = g();
|
||||
if (n == 0) continue;
|
||||
n++;
|
||||
}
|
||||
ret<caret>urn n;
|
||||
}
|
||||
|
||||
int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user