2 ms·
That whole discussion would not exist if java had a convenience syntax for rethrowing checked exceptions wrapped in a RuntimeException, in less than the customa
by usrusr 8y ago
That whole discussion would not exist if java had a convenience syntax for rethrowing checked exceptions wrapped in a RuntimeException, in less than the customary four extra lines.
Some kind of call-site use of the throws keyword perhaps?
byte[] bytes = "Example".getBytes("UTF-8") throws RuntimeException;
I can't really think of a reasonable use case for anything other than RuntimeException, but in the old days, some people would surely have loved to rethrow wrapped as MyCompanyException.
- bunderbunder 8y agoIt's fairly easy to get something like this with Java 8. I have my own set of wrapper functions that let me do something like: byte[] bytes = unchecked(() -> "Example".getBytes("UTF-8"));