Menu

#1401 False positive for StringBuilder.append called with constructor

PMD-5.3.4
closed
None
PMD
3-Major
Bug
5.3.3
java/strings/ConsecutiveLiteralAppends
2015-09-05
2015-09-04
Rei Angelus
No

There is a false positive with the example below :

    <test-code>
        <description>False positive for StringBuilder.append called wtih constructor</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    public String foo(final String value)
    {
        StringBuilder s = new StringBuilder("start:").append(value).append(":end");

        return s.toString();
    }
}
        ]]></code>
    </test-code>

Thanks,

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-09-05
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,7 @@
     There is a false positive with the example below :
    
    +~~~~~
     :::xml
    -
         <test-code>
             <description>False positive for StringBuilder.append called wtih constructor</description>
             <expected-problems>0</expected-problems>
    @@ -16,5 +16,6 @@
     }
             ]]></code>
         </test-code>
    +~~~~~
    
     Thanks,
    
     
  • Andreas Dangel

    Andreas Dangel - 2015-09-05
    • Ruleset / Rule: --> java/strings/ConsecutiveLiteralAppends
     
  • Andreas Dangel

    Andreas Dangel - 2015-09-05
    • summary: False positive for StringBuilder.append called wtih constructor --> False positive for StringBuilder.append called with constructor
    • status: open --> in-progress
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.4
     
  • Andreas Dangel

    Andreas Dangel - 2015-09-05
    • status: in-progress --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.