Java inspection: Updated messages for "Move return to computation", added tests for 'switch' (IDEA-121153)

This commit is contained in:
Pavel Dolgov
2016-09-07 15:23:50 +03:00
parent 26983131ac
commit 897a074fa6
107 changed files with 297 additions and 106 deletions
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 's'" "true"
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a[]) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 's'" "true"
// "Move 'return' closer to computation of the value of 's'" "true"
class T {
int f(String a) {
String s = a;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, boolean c) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 's'" "true"
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String a) {
String r = "";
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a, int b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String[] a) {
String r = "";
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = g();
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, int d) {
int n = d;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
}
return n;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
}
return n;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
default:
return 0;
}
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
default:
return 0;
case 0:
}
return n;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
default:
return 0;
case 2:
return 4;
}
}
}
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String p) {
String r = null;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String p) {
String r = null;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
long f() {
long r;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "false"
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int f(int a) {
int n = a;
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int x;
int y;
int f(int a) {
int n = -1;
if (a != 0) {
n = a;
n = 31 * x + n;
n = 31 * y + n;
}
re<caret>turn n;
}
}
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 's'" "true"
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a[]) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'result'" "false"
// "Move 'return' closer to computation of the value of 'result'" "false"
class T {
int size;
int width;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 's'" "true"
// "Move 'return' closer to computation of the value of 's'" "true"
class T {
int f(String a) {
String s = a;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "false"
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "false"
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, boolean c) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 's'" "true"
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String a) {
String r = "";
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a, int b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String[] a) {
String r = "";
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = g();
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, int d) {
int n = d;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
break;
}
r<caret>eturn n;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
}
ret<caret>urn n;
}
}
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
break;
default:
n = 0;
}
ret<caret>urn n;
}
}
@@ -0,0 +1,19 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
break;
default:
n = 0;
break;
case 0:
}
re<caret>turn n;
}
}
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
default:
n = 0;
break;
case 2:
n = 4;
}
ret<caret>urn n;
}
}
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "false"
// "Move 'return' closer to computation of the value of 'n'" "false"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "false"
// "Move 'return' closer to computation of the value of 'n'" "false"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String p) {
String r = null;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'r'" "true"
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String p) {
String r = null;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
@@ -1,4 +1,4 @@
// "Move 'return' to computation of the value of 'n'" "true"
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;

Some files were not shown because too many files have changed in this diff Show More