These checkers deal with different problems that can occur with String manipulation.
Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
Here's an example of code that would trigger this checker:
public class Foo {
private void bar() {
buz("Howdy");
buz("Howdy");
buz("Howdy");
buz("Howdy");
}
private void buz(String x) {}
}
Detects when the return value of a String method call is not used
Here's an example of code that would trigger this checker:
public class StringReturnIgnoreExample {
public void bar() {
String x = "Hello";
x.concat(" too good");
System.out.println("Hello World!" + x);// /Display the string.
}
}