Re:Java’s Checked Exceptions Are Evil? (2015)
by bunderbunder on Sunday September 23, 2018 @10:14AM
(#18051151)
It'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"));
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.