chen870647924 / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Propagate undeclared checked exception #903

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Additionally to Throwables.propagate(Throwable throwable) which wraps checked 
exception in a RuntimeException, how about a
Throwables.propagateUnchecked( Throwable throwable) with the semantics of 
http://www.eishay.com/2011/11/throw-undeclared-checked-exception-in.html?

Original issue reported on code.google.com by stefan.l...@gmail.com on 20 Feb 2012 at 12:53

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
So let me get this straight: you want to throw checked exceptions without 
declaring them?

...I'm not clear on why that would be a good idea, and it seems to go against 
how Java designed checked exceptions in the first place.

Original comment by wasserman.louis on 20 Feb 2012 at 5:07

GoogleCodeExporter commented 9 years ago
Hmm, the more I think about it, I think it is not good. At first I was 
impressed by getting rid of the additional wrapping RuntimeException.
The "badness" of this unveils when thinking about handling of exceptions, e.g. 
a IOException (thrown unchecked) would bypass exception handling for Error and 
RuntimException, because it is unexpected.

Sorry about that, please close it.

Original comment by stefan.l...@gmail.com on 21 Feb 2012 at 7:16

GoogleCodeExporter commented 9 years ago

Original comment by cgdec...@gmail.com on 21 Feb 2012 at 4:11

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:14

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08