Menu

#381 Single character StringBuffer.append

closed
None
5
2012-10-07
2005-12-05
No

Another suggestion from Brian R:

==================
I'd also like to see a rule that flags append() calls
that use single characters as string values:

sb.append("!")

..since appending a character as single character
reults in a more efficient method call:

sb.append('!');

Thanks Brian!

Discussion

  • Allan Caplan

    Allan Caplan - 2005-12-08

    Logged In: YES
    user_id=1127445

    Was bored.

    See Patch #1375829

     
  • Tom Copeland

    Tom Copeland - 2005-12-08

    Logged In: YES
    user_id=5159

    Checked into CVS, and you can download a new pmd-3.4.jar
    file here:

    http://infoether.com/~tom/pmd-3.4.jar

    that contains this new rule in the 'strings' ruleset.

    Thanks Allan!

    Yours,

    Tom
    Using PMD? Get the book, "PMD Applied"! http://pmdapplied.com/

     

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.