RedundantStringOperationInspection: SubstringZero and StringToString merged

This commit is contained in:
Tagir Valeev
2017-10-11 12:55:14 +07:00
parent ea0530a7f8
commit 454efb3280
17 changed files with 220 additions and 308 deletions

View File

@@ -0,0 +1,14 @@
// "Fix all 'Redundant String operation' problems in file" "true"
class Foo {
void test(String s) {
String s1 = s.substring(1);
// check merger
//noinspection SubstringZero
String sOld = s.substring(0x0);
String s2 = s;
String s3 = s.substring(0, 20);
/*up until the string length*/
String s4 = s;
String s5 = s.substring(0, s.length()-1);
}
}

View File

@@ -0,0 +1,7 @@
// "Remove 'toString'" "true"
class Foo {
public static void main(String[] args) {
/*valuable comment!!!*/
String s = args[0];
}
}

View File

@@ -0,0 +1,7 @@
// "Remove 'toString'" "false"
class Foo {
public static void main(String[] args) {
Object[] a = args;
String s = a[0].toString<caret>(/*valuable comment!!!*/);
}
}

View File

@@ -0,0 +1,13 @@
// "Fix all 'Redundant String operation' problems in file" "true"
class Foo {
void test(String s) {
String s1 = s.substring(1);
// check merger
//noinspection SubstringZero
String sOld = s.substring(0x0);
String s2 = s.su<caret>bstring(0x0);
String s3 = s.substring(0, 20);
String s4 = s.substring(0, /*up until the string length*/ s.length());
String s5 = s.substring(0, s.length()-1);
}
}

View File

@@ -0,0 +1,6 @@
// "Remove 'toString'" "true"
class Foo {
public static void main(String[] args) {
String s = args[0].toString<caret>(/*valuable comment!!!*/);
}
}