Re: RFC: AbstractStringBuilder sharing its buffer with String

2015-11-30 Thread Peter Levart
On 11/30/2015 03:19 PM, Vitaly Davidovich wrote: Hi Peter, I see your point about someone deliberately doing this to break String invariants. But by this logic, everything should be "threadsafe" in case someone attempts to break it via concurrency. Anything related to security, yes. R

Re: RFC: AbstractStringBuilder sharing its buffer with String

2015-11-30 Thread Vitaly Davidovich
Hi Peter, I see your point about someone deliberately doing this to break String invariants. But by this logic, everything should be "threadsafe" in case someone attempts to break it via concurrency. sent from my phone On Nov 28, 2015 7:19 PM, "Peter Levart" wrote: > > > On 11/28/2015 08:19 PM

Re: RFC: AbstractStringBuilder sharing its buffer with String

2015-11-29 Thread Ivan Gerasimov
Hi Peter! On 27.11.2015 18:15, Peter Levart wrote: On 11/27/2015 01:39 PM, Ivan Gerasimov wrote: Hello! Prior to Java5, StringBuffer used to be able to share its internal char[] buffer with the String, returned with toString(). With introducing of the new StringBuilder class this functionali

Re: RFC: AbstractStringBuilder sharing its buffer with String

2015-11-28 Thread Peter Levart
On 11/28/2015 08:19 PM, Vitaly Davidovich wrote: Is that a valid example given StringBuilder isn't threadsafe to begin with? If the SB instance is shared among threads that perform writes to it without external synchronization, it's a bug in that code. Am I missing something? That "bug

Re: RFC: AbstractStringBuilder sharing its buffer with String

2015-11-28 Thread Vitaly Davidovich
Is that a valid example given StringBuilder isn't threadsafe to begin with? If the SB instance is shared among threads that perform writes to it without external synchronization, it's a bug in that code. Am I missing something? You'd have to ensure that the returned String is stable and effective

Re: RFC: AbstractStringBuilder sharing its buffer with String

2015-11-28 Thread Remi Forax
De: "Peter Levart" > À: "Ivan Gerasimov" , > [email protected] > Envoyé: Vendredi 27 Novembre 2015 16:15:40 > Objet: Re: RFC: AbstractStringBuilder sharing its buffer with String > > > > On 11/27/2015 01:39 PM, Ivan Gerasimov wrote: >

Re: RFC: AbstractStringBuilder sharing its buffer with String

2015-11-27 Thread Peter Levart
On 11/27/2015 01:39 PM, Ivan Gerasimov wrote: Hello! Prior to Java5, StringBuffer used to be able to share its internal char[] buffer with the String, returned with toString(). With introducing of the new StringBuilder class this functionality was removed. It seems tempting to reintroduce