commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Brisard <sebastien.bris...@m4x.org>
Subject Re: [all] FindBugs' Switch statement found in class.method where default case is missing
Date Tue, 04 Sep 2012 15:16:10 GMT
Sorry James,
you misunderstood me. My point was just that Bloch seems to be
consistently using the same exception, namely AssertionError, but that
I'd rather use IllegalStateException.
Of course, in some cases IllegalArgumentException would make sense.
S

2012/9/4 James Carman <james@carmanconsulting.com>:
> I wasn't necessarily saying that we should always use
> IllegalArgumentException (although it can be applicable if the thing
> being switched upon is an argument to the method).  The idea was that
> we could throw an exception of some sort in our default clause.
>
> On Tue, Sep 4, 2012 at 10:44 AM, Sébastien Brisard
> <sebastien.brisard@m4x.org> wrote:
>> Hello,
>>
>> 2012/9/4 James Carman <james@carmanconsulting.com>:
>>> Something like:
>>>
>>> throw new IllegalArgumentException("This should never happen because
>>> we are so smart we thought of every possibility in our case
>>> statement.");
>>>
>>> would suffice :)
>>>
>> Not that it really matters, since this is never going to occur, but I
>> think Bloch throws AssertionError in such cases.
>> I think that IllegalStateException would be more appropriate in this
>> case. But it really is for the sake of the argument anyway...
>>
>> Sébastien
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message