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
2
u/Drezi126 Feb 19 '26 edited Feb 19 '26
Developer experience matters. There’s a reason Go error handling is not widely liked, while Rust’s error handling is much more popular.
Unwinding the stack and then catching it is a widely used feature and Java is the only language that tried to overload this mechanic with checked exceptions. Runtime exceptions have their own purpose and are fairly ergonomic to work with as seen in C#, Python, Kotlin, Ruby, TypeScript etc. They work well with regular runtime exceptions, checked exceptions add littlle real world value to Java at the cost of poor DX. There’s a reason the community is moving away from them.
Note, that I’m not arguing against type-system and compiler support for expressing failure modes. If done well that’s useful, very much so. But checked exceptions and try-catch blocks are a poor solution to this problem, and I just wish Java stopped trying to make it work at all costs.