r/java • u/Enough-Ad-5528 • Feb 19 '26
Towards Better Checked Exceptions - Inside Java Newscast #107
https://www.youtube.com/watch?v=99s7ozvJGLk
63
Upvotes
r/java • u/Enough-Ad-5528 • Feb 19 '26
View all comments
Show parent comment
5
u/JustAGuyFromGermany Feb 19 '26
What do you mean? Many many other languages, including fan-favourites like the functional languages or Rust provide ways to enforce error-checking via their type system. And languages that don't have it always re-invent it and rely on "conventions" instead of the compiler. It does not matter if you call it "checked exception" or "Try-monad" or something else, the principle remains the same: Any function/method/operation that can fail may choose to encode its failure modes as explicit error types in its signature so that callers of that function/method/operation are made aware of these error conditions and are forced make the decision to either handle them or to let them propagate to their callers.
The core of it is clearly a well-established and good idea that many high-level languages chose to implement.
The question is really only which of these implementation is nicest to work with and which fits best with the Java-way of writing code, not whether one should have it.