Exception transparency - lone throws (no checked exceptions)
Rémi Forax
forax at univ-mlv.fr
Thu Jun 17 15:58:49 PDT 2010
Le 18/06/2010 00:47, Stephen Colebourne a écrit :
> On 17 June 2010 22:52, Paul Benedict<pbenedict at apache.org> wrote:
>
>> My only comment is on the the "catch throws" clause.
>>
> ...
>
>> Why doesn't Java relax its exception catching rules so that it's legal
>> to catch undeclared checked exceptions? So the compiler cannot
>> definitively prove the exception will be thrown, so what? It should be
>> backwards compatible since it is illegal today, and it takes away this
>> "catch throws" clause that is a bit hackish -- albeit necessary.
>>
> This is perfectly possible and not backwards incompatible as far as I
> can see (it simply makes code that wouldn't compile today start to
> compile.)
>
It's possible but stupid.
My students must be able to write webservers and without checked exceptions,
it's hard to be done right. No one want a server that stop if a client
shutdown the connection randomly.
Checked exception is a good way to say You must do something here to deal
with this uncommon case.
> I would note that the catch side of checked exceptions is just as
> important as the throws side to those that favour checked. Thats why I
> chose the slightly less aggressive change with an additional keyword.
> Were this proposal to be seriously considered, I'd expect that this
> option would be very much on the table.
>
> Stephen
>
Rémi
More information about the lambda-dev
mailing list