diff --git a/pmd-java/src/main/resources/rulesets/java/strings.xml b/pmd-java/src/main/resources/rulesets/java/strings.xml index 5fec567d09..dc3f70cd76 100644 --- a/pmd-java/src/main/resources/rulesets/java/strings.xml +++ b/pmd-java/src/main/resources/rulesets/java/strings.xml @@ -154,7 +154,8 @@ sb.append('a'); // use this instead class="net.sourceforge.pmd.lang.java.rule.strings.ConsecutiveAppendsShouldReuseRule" externalInfoUrl="${pmd.website.baseurl}/rules/java/strings.html#ConsecutiveAppendsShouldReuse"> -Consecutively calls to StringBuffer/StringBuilder .append should reuse the target object. This can improve the performance. +Consecutive calls to StringBuffer/StringBuilder .append should be chained, reusing the target object. This can improve the performance +by producing a smaller bytecode, reducing overhead and improving inlining. A complete analysis can be found [here](https://github.com/pmd/pmd/issues/202#issuecomment-274349067) 3 @@ -398,4 +399,4 @@ public class Foo { - \ No newline at end of file + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 38be6b62aa..b91ea27d68 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -252,6 +252,8 @@ to avoid XSS attacks. * [#1551](https://sourceforge.net/p/pmd/bugs/1551/): \[java] InvalidSlf4jMessageFormat: fails with NPE * java-unnecessary * [#199](https://github.com/pmd/pmd/issues/199): \[java] UselessParentheses: Parentheses in return statement are incorrectly reported as useless +* java-strings + * [#202](https://github.com/pmd/pmd/issues/202): \[java] \[doc] ConsecutiveAppendsShouldReuse is not really an optimization * XML * [#1518](https://sourceforge.net/p/pmd/bugs/1518/): \[xml] Error while processing xml file with ".webapp" in the file or directory name * psql