mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java inspection: Highlight the whole return statement in "Move return to computation", removed duplicate test cases, changed inspection's level to INFO (IDEA-121153)
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' closer to computation of the value of 'raw'" "true"
|
||||
import java.util.*;
|
||||
|
||||
class T {
|
||||
List<String> f(boolean b) {
|
||||
List raw = null;
|
||||
if (b) {
|
||||
return g();
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
List<String> g() {
|
||||
return Collections.singletonList("");
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Move 'return' closer to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int[][] a) {
|
||||
int n = -1;
|
||||
myLabel:
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
for (int j = 0; j < a[i].length; j++) {
|
||||
if (a[i][j] == 0) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Move 'return' closer to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int[][] a) {
|
||||
int n = -1;
|
||||
myLabel:
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (a[i].length == 0) {
|
||||
return -i - 1;
|
||||
}
|
||||
for(int j = 0; j < a[i].length; j++) {
|
||||
n = j;
|
||||
if (a[i][j] == 0) return n;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' closer to computation of the value of 'raw'" "true"
|
||||
import java.util.*;
|
||||
|
||||
class T {
|
||||
List<String> f(boolean b) {
|
||||
List raw = null;
|
||||
if (b) {
|
||||
raw = g();
|
||||
}
|
||||
re<caret>turn raw;
|
||||
}
|
||||
|
||||
List<String> g() {
|
||||
return Collections.singletonList("");
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' closer to computation of the value of 'raw'" "false"
|
||||
import java.util.*;
|
||||
|
||||
class T {
|
||||
List<Object> f(boolean b) {
|
||||
List raw = null;
|
||||
if (b) {
|
||||
raw = g();
|
||||
}
|
||||
re<caret>turn raw;
|
||||
}
|
||||
|
||||
List<String> g() {
|
||||
return Collections.singletonList("");
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' closer to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int[][] a) {
|
||||
int n = -1;
|
||||
myLabel:
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
for (int j = 0; j < a[i].length; j++) {
|
||||
if (a[i][j] == 0) {
|
||||
n = j;
|
||||
break myLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
re<caret>turn n;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Move 'return' closer to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int[][] a) {
|
||||
int n = -1;
|
||||
myLabel:
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (a[i].length == 0) {
|
||||
n = -i - 1;
|
||||
break myLabel;
|
||||
}
|
||||
for(int j = 0; j < a[i].length; j++) {
|
||||
n = j;
|
||||
if (a[i][j] == 0) break myLabel;
|
||||
}
|
||||
}
|
||||
re<caret>turn n;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Move 'return' closer to computation of the value of 'r'" "false"
|
||||
class T {
|
||||
int[] f(boolean b) {
|
||||
int[] r = new int[]{-1};
|
||||
if (b) {
|
||||
r[0] = 1;
|
||||
}
|
||||
re<caret>turn r;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user