Affects PMD Version:6.47.0
Rule:UseStringBufferForStringAppends
Please provide the rule name and a link to the rule documentation:
https://pmd.sourceforge.io/pmd-6.48.0/pmd_rules_java_performance.html#usestringbufferforstringappends
Description:
Hi, we are doing research in testing static analyzer. Our approach found a false positive about the rule UseStringBufferForStringAppends, PMD should report two duplicated warnings at line 5, but it is equivalent to line 3. Considering the results should be consistent, hence, I think this is a false positive.
Code Sample demonstrating the issue:
public void bar(boolean tag) {
String x = "foo";
x += "bar" + x; // report one warning in this line
if (false) {
x += "bar" + x; // report two duplicated warnings
}
}
The following case is more neat, but still has similar problems:
public void bar(boolean tag) {
String x = "foo";
x += "bar" + x; // report one warning in this line
x += "bar" + x; // report two duplicated warnings
}
Running PMD through: [Maven]
Affects PMD Version:6.47.0
Rule:UseStringBufferForStringAppends
Please provide the rule name and a link to the rule documentation:
https://pmd.sourceforge.io/pmd-6.48.0/pmd_rules_java_performance.html#usestringbufferforstringappends
Description:
Hi, we are doing research in testing static analyzer. Our approach found a false positive about the rule UseStringBufferForStringAppends, PMD should report two duplicated warnings at line 5, but it is equivalent to line 3. Considering the results should be consistent, hence, I think this is a false positive.
Code Sample demonstrating the issue:
The following case is more neat, but still has similar problems:
Running PMD through: [Maven]