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.

Was it helpful?

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
scroll top