RedundantStringOperationInspection: fixes after review IDEA-CR-25339

1. messages cleanup
2. new StringBuilder(""). PrintStream.println("") are warned
This commit is contained in:
Tagir Valeev
2017-10-17 10:58:07 +07:00
parent 4592ef4516
commit e4efb836cd
15 changed files with 72 additions and 16 deletions

View File

@@ -0,0 +1,6 @@
// "Delete element" "true"
class Foo {
public static void main(String[] args) {
System.out.println();
}
}

View File

@@ -1,4 +1,4 @@
// "Remove redundant 'append' call" "true"
// "Remove redundant 'append()' call" "true"
class Foo {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();

View File

@@ -0,0 +1,6 @@
// "Delete element" "true"
class Foo {
public static void main(String[] args) {
StringBuilder s = new StringBuilder();
}
}

View File

@@ -1,4 +1,4 @@
// "Remove redundant 'intern' call" "true"
// "Remove redundant 'intern()' call" "true"
class Foo {
private static final String x = ("Hello "+"World"+'!');
}

View File

@@ -1,4 +1,4 @@
// "Remove redundant 'toString' call" "true"
// "Remove redundant 'toString()' call" "true"
class Foo {
public static void main(String[] args) {
/*valuable comment!!!*/

View File

@@ -1,4 +1,4 @@
// "Remove redundant 'toString' call" "false"
// "Remove redundant 'toString()' call" "false"
class Foo {
public static void main(String[] args) {
Object[] a = args;

View File

@@ -0,0 +1,6 @@
// "Delete element" "true"
class Foo {
public static void main(String[] args) {
System.out.println("<caret>");
}
}

View File

@@ -1,4 +1,4 @@
// "Remove redundant 'append' call" "true"
// "Remove redundant 'append()' call" "true"
class Foo {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();

View File

@@ -0,0 +1,6 @@
// "Delete element" "true"
class Foo {
public static void main(String[] args) {
StringBuilder s = new StringBuilder(("<caret>"));
}
}

View File

@@ -1,4 +1,4 @@
// "Remove redundant 'intern' call" "true"
// "Remove redundant 'intern()' call" "true"
class Foo {
private static final String x = ("Hello "+"World"+'!').inte<caret>rn();
}

View File

@@ -1,4 +1,4 @@
// "Remove redundant 'intern' call" "false"
// "Remove redundant 'intern()' call" "false"
class Foo {
private static final String x = ("Hello "+"World".trim()+'!').inte<caret>rn();
}

View File

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