RE: StringBuffer usage

2020-06-08 Thread Uwe Schindler
m: Uwe Schindler > Sent: Monday, June 8, 2020 3:09 PM > To: dev@lucene.apache.org > Subject: RE: StringBuffer usage > > Hi, > > I think, it might be still a good idea to review the uses of StringBuffer. I > think > they might be some relics from former times. I co

RE: StringBuffer usage

2020-06-08 Thread Uwe Schindler
ssage- > From: Erick Erickson > Sent: Sunday, June 7, 2020 9:23 PM > To: dev@lucene.apache.org > Subject: Re: StringBuffer usage > > Uwe: > > In that case we can ignore the question, this was just a reflex on my part. > > > On Jun 7, 2020, at 11:38 AM, Uwe Sch

Re: StringBuffer usage

2020-06-07 Thread Erick Erickson
Uwe: In that case we can ignore the question, this was just a reflex on my part. > On Jun 7, 2020, at 11:38 AM, Uwe Schindler wrote: > > Hi, > > The main reason to use StringBuffer ist legacy Apis. One example is all > Formatters low level apis (DecimalFormat, Formatter,...) Use StringBuffer

Re: StringBuffer usage

2020-06-07 Thread Uwe Schindler
Hi, The main reason to use StringBuffer ist legacy Apis. One example is all Formatters low level apis (DecimalFormat, Formatter,...) Use StringBuffer to implement itsself. Nowadays there is no performance impact anymore. If you use StringBuffer from one thread, JVM removes the

Re: StringBuffer usage

2020-06-07 Thread Bram Van Dam
On 06/06/2020 22:48, Erick Erickson wrote: > When is there a good reason to use StringBuffer rather than StringBuilder? > While going through some of the warnings I happened to run across a few of > these. I haven’t changed them, and at least one (AuditEvent) has a comment > about back-compat

Re: StringBuffer usage

2020-06-07 Thread Erick Erickson
Thanks Ilan: Suppressing forbidden api check for specific methods is easy, BTW. @SuppressForbidden(reason=“explanatory note”) > On Jun 6, 2020, at 7:05 PM, Ilan Ginzburg wrote: > > From > https://stackoverflow.com/questions/355089/difference-between-stringbuilder-and-stringbuffer > > “

Re: StringBuffer usage

2020-06-06 Thread Ilan Ginzburg
From https://stackoverflow.com/questions/355089/difference-between-stringbuilder-and-stringbuffer “ StringBuffer is synchronized, StringBuilder is not.”

StringBuffer usage

2020-06-06 Thread Erick Erickson
When is there a good reason to use StringBuffer rather than StringBuilder? While going through some of the warnings I happened to run across a few of these. I haven’t changed them, and at least one (AuditEvent) has a comment about back-compat and is quite recent… Otherwise I though