review request for 6798511/6860431: Include functionality of Surrogate in Character
martinrb at google.com
Sun Mar 21 16:16:35 UTC 2010
On Sun, Mar 21, 2010 at 05:00, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
>> On Sat, Mar 20, 2010 at 14:52, Ulf Zibis<Ulf.Zibis at gmx.de> 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
Now that's a real bug.
More information about the core-libs-dev