PROPOSAL: Unchecked Exceptions as Subclasses of Checked Exceptions

Reinier Zwitserloot reinier at zwitserloot.com
Wed Mar 25 16:51:43 PDT 2009


Any library that, for whatever reason, needs to know if a given  
Throwable object is checked or not, currently does this with:

(x instanceof Error || x instanceof RuntimeException).

There's no .isChecked() method.

This proposal would break that, so its not backwards compatible. I  
think it's a neat idea, but that would auto-disqualify it from coin, I  
think.

  --Reinier Zwitserloot



On Mar 26, 2009, at 00:10, Stephen Colebourne wrote:

> Alan Snyder wrote:
>> Unchecked Exceptions as Subclasses of Checked Exceptions
>> 	public class TheCheckedException extends Exception {};
>>
>> 	public class TheUncheckedException extends TheCheckedException  
>> implements
>> UncheckedException {};
>
> I like the idea.
>
> I'm not sure if its actually feasible. I suspect that its more complex
> than it seems.
>
> I'm also not sure whether there are that many real use cases. Most of
> the time you control your exception hierarchy (so you can choose
> unchecked) or you have to live with a published API (the JDK) and so  
> it
> can't be changed.
>
> Stephen
>




More information about the coin-dev mailing list