- summary: Better explanation for AddEmptyString --> [java] [doc] Better explanation for AddEmptyString
In the documentation of AddEmptyString, it refers to type conversion, but should also refers to string concatenation.
Ex code.
String customString = "foo" + bar + "";
Current text in pmd-java/src/main/resources/rulesets/java/optimizations.xml
The conversion of literals to strings by concatenating them with empty strings is inefficient.
It is much better to use one of the type-specific toString() methods instead.
It shoud be something like (somebody with better English than me shoud polish it)
The conversion of literals to strings by concatenating them with empty strings is inefficient.
It is much better to use one of the type-specific toString() methods instead.
Note that adding an empty String to other String has no effect and has a cost.