Re:Java’s Checked Exceptions Are Evil? (2015)
by smsm42 on Wednesday September 26, 2018 @02:37PM
(#18078964)
Yes you can, but the problem is that this means reannotating all the stack up to "main" every time some tiny implementation detail changes - or you use different JSON parser that has "JsonParsingException" and not "JsonParserException", and so on. Or, you have to wrap them all into generic/runtime exceptions, which negates the whole benefit.
Re:Java’s Checked Exceptions Are Evil? (2015)
by rwmj on Sunday September 23, 2018 @09:02AM
(#18050899)
It's also been a long time for me, but I believe you're correct that annotating functions with "throws Exception" makes the function unchecked. However the problem is still twofold: (1) You have to change the called function. (2) The default is wrong.
It's been a while since I've done any Java, but I seem to remember that you can just annotate your function with the "throws" keyword to propagate exceptions up the call stack, so that you can handle them somewhere else.