Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever
by vbezhenar on Friday July 14, 2023 @01:26AM
(#36719822)
There's one big problem with this approach. You can't catch checked exception if the try-block does not throw it (according to compiler). That's compiler error.
So yes, you can throw IOException masking it to RuntimeException, however you can't catch it later without another gimmicks like catching Exception and checking if it's IOException (and even that check causes linter warnings in Idea, so now you need to suppress those warnings...).
Throwing and catching UncheckedIOException does not have this problem.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever
by rogerkeays on Friday July 14, 2023 @04:20AM
(#36720895)
Good point. Actually the plugin didn't handle this case either (fixed now). Thanks for the feedback.
This is from my original solution to the problem: https://github.com/rogerkeays/jamaica-core/blob/0cc98b114998...