Findbugs or PMD rule to detect when StringBuffer should be replaced with StringBuilder
-
28-10-2019 - |
Question
Is there a rule in FindBugs or PMD that will warn when StringBuffer, which is synchronized, can be safely replaced with StringBuilder?
For example when a StringBuffer variable reference never escapes (to another Thread) from a method it would be possible to safely replace it with StringBuilder.
Solution
http://fb-contrib.sf.net has one, called LocalSynchronizedCollections
this is a plugin for findbugs.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow