|
|
|
|
|
by geoka9
3423 days ago
|
|
I see nothing wrong with that - those _are_ fatal conditions that indicate that something is dangerously wrong in the program. And those panics do give you a helpful stack trace, complete with source code line numbers, so it's easy to find the culprit (as opposed to "bubbling up" exceptions). |
|
The canonical use of checked exceptions in Java is for unpredictable events - almost always related to interaction with the outside world, like IO, networking, parsing, etc. These are things the programmer can't prevent, and must defend against, so the type system allows, and in fact forces, the programmer to explicitly address them.
This is all explained beautifully, and at length, in this monograph:
http://joeduffyblog.com/2016/02/07/the-error-model/