2 Questions on StringBuffer

Martin Buchholz martinrb at google.com
Wed Mar 17 19:12:41 UTC 2010


On Wed, Mar 17, 2010 at 10:02, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> Am 17.03.2010 18:41, schrieb Martin Buchholz:
>>
>> On Wed, Mar 17, 2010 at 08:29, Ulf Zibis<Ulf.Zibis at gmx.de>  wrote:
>>
>>>
>>> Why there are 2 methods which do not use the super method, where I can't
>>> see
>>> any difference? :
>>>
>>>    public synchronized char charAt(int index)
>>>    public synchronized void setCharAt(int index, char ch)
>>>
>>
>> You're correct that these methods
>> could be refactored to call super ("DRY"),
>> but the code duplication is small,
>> and these methods are performance-critical,
>> so let's just leave them as is.
>>
>
> Additionally I think, there's a bug in javadoc of those methods.
> Actually they throw StringIndexOutOfBoundsException.

Why would that be a bug?

Martin



More information about the core-libs-dev mailing list