Adding a constructor to AssertionError that takes throwable
Rémi Forax
forax at univ-mlv.fr
Sun Jan 10 15:48:55 UTC 2010
Le 10/01/2010 09:33, Paulo Levi a écrit :
> Hi.
> A funtion i had to implement is one that returns a assertionerror
> given a msg and a throwable (initCause with the throwable) simply
> because it's such a common pattern to throw a assertionerror on
> "impossible" (buggy) exceptions. Without the cause, it's sometimes
> hard to guess the problem without recompiling the code more than once.
>
> I'd like another constructor in AssertionError (that takes a msg and a
> throwable).
>
> As i said i did this on a static function, so it's not important to
> me, but might simplify things for others (-3 lines of code in catch
> clauses).
You can't add constructor that takes a Throwable, this is not source
compatible.
Throwable is a subtype of Object and a constructor that takes an Object
already exist.
Rémi
More information about the core-libs-dev
mailing list