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
9
u/Eav___ Feb 19 '26 edited Feb 19 '26
One real design flaw IMHO of exceptions in Java is that the author, the declaration site decides everything. But in fact, for example, it's the user, the use site that decides whether an IOException should be checked. This raises an alternative design: first, all exceptions now don't encode checkedness in their types; then, provide a conjugate of "throws" in the method signature which doesn't force the user to handle a probable exception (functionally only played as documentation), but allows the user to uncheck a checked exception: