2 Questions on StringBuffer

Martin Buchholz martinrb at google.com
Wed Mar 17 22:00:31 UTC 2010


On Wed, Mar 17, 2010 at 14:24, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> Am 17.03.2010 20:12, schrieb Martin Buchholz:
>>
>> On Wed, Mar 17, 2010 at 10:02, Ulf Zibis<Ulf.Zibis at gmx.de>  wrote:
>>
>>>
>>> Additionally I think, there's a bug in javadoc of those methods.
>>> Actually they throw StringIndexOutOfBoundsException.
>>>
>>
>> Why would that be a bug?
>>
>
> I think, javadoc should indicate StringIndexOutOfBoundsException here:

That would be an incompatible tightening of the spec.

To understand this, you need to think abstractly about
the specification and implementation of the Java Platform
as two completely separate things.

Martin

>    /**
>     * @throws IndexOutOfBoundsException {@inheritDoc}
>     * @see        #length()
>     */
>    public synchronized char charAt(int index) {
>        if ((index < 0) || (index >= count))
>            throw new StringIndexOutOfBoundsException(index);
>        return value[index];
>    }
>
>
> Or am I not enough informed about {@inheritDoc} ?
>
> -Ulf
>
>
>
>



More information about the core-libs-dev mailing list