Disambiguating empty catch blocks

Martin Buchholz martinrb at google.com
Fri Apr 16 19:07:20 UTC 2010


On Thu, Apr 15, 2010 at 20:02, Andrew Thompson
<lordpixel+core-libs-dev at mac.com> wrote:
>
> On Apr 14, 2010, at 6:49 AM, Bruce Chapman wrote:
>
>>> One thing we definitely can do is to add a new constructor
>>> to AssertionError, that takes a cause as an argument,
>>> consistent with other exceptions.
>>>
>> Yeah, that was a minor niggle - I'll check  for an RFE and get the ball started on that.
>
>
> Actually, it does exist, it is just disguised as taking Object:
>
> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/AssertionError.html#AssertionError(java.lang.Object)

An awesome find, Andrew.
I had skimmed the (many) constructors for AssertionError,
and never suspected that this method is the one we want.

> It you want to RFE, I guess
>
> AssertionError(String additionalDetails, Throwable cause)

I'm guessing it's not critical, because the message of the cause
is a pretty good message for the wrapped exception.

The best reason for the new constructor is that humans can find it!

Martin



More information about the core-libs-dev mailing list