On Sun, Mar 21, 2010 at 05:00, Ulf Zibis <[email protected]> wrote:
>>
>> On Sat, Mar 20, 2010 at 14:52, Ulf Zibis<[email protected]>  wrote:
>>
>>>
>>> - A little "bug" in javadoc:
>>> �...@exception ArrayIndexOutOfBoundsException
>>>  instead    IndexOutOfBoundsException
>>>
>>
>> Not a bug.
>>
>
> Yes, but decreases the users capabilities catching exceptions more precise
> and flexible.

There is a debate about whether to reuse existing exception classes
or to throw class-specific subclasses.  IMO, IOOBE is a sufficiently expressive
exception that I might have used just that, with expressive detail messages.

But that's only a consideration when designing new API or a new platform.
Old API must stay unchanged, for compatibility.

> Imagine, a method would throw an IndexOutOfBoundsException for some reason
> and too calls Character.toChars(). The caller of such a method could
> distinguish, where the exception would come from, and have separate catch
> blocks. But if not documented ... :-(
>
> In extreme, following too would not be a bug in your sense:
> �...@exception Exception
>
> I became sensitive on this, as I have seen real bugs in
> AbstractStringBuilder vice versa, where methods actually throw
> IndexOutOfBoundsExceptions, but their javadoc states StringIndexOutOf
> BoundsException.

Now that's a real bug.

Martin

Reply via email to