Hacker News new | ask | show | jobs
by michaelt 1 day ago
> The worst thing about exceptions is that you can't tell from the type signature of a function whether it might throw one.

In Java exceptions can be part of a method's declared type information, so handling is checked at compile time and IDEs can display the info.

Unfortunately certain Java missteps made this design unpopular these days. For example, for many years new String(bytes, "UTF-8"); made it mandatory to catch a UnsupportedEncodingException despite the language spec guaranteeing UTF-8 would be available. A later version of Java addressed it, but still...