mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 10:48:09 +07:00
RedundantStringOperationInspection: SubstringZero and StringToString merged
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Remove 'toString'" "true"
|
||||
class Foo {
|
||||
public static void main(String[] args) {
|
||||
/*valuable comment!!!*/
|
||||
String s = args[0];
|
||||
}
|
||||
}
|
||||
@@ -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!!!*/);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Remove 'toString'" "true"
|
||||
class Foo {
|
||||
public static void main(String[] args) {
|
||||
String s = args[0].toString<caret>(/*valuable comment!!!*/);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user