3 ms·
No. Only a certain subset, known as “checked exceptions” (as opposed to “runtime” exceptions), need to be in the signature. In what may come as a surprise, che
by riwsky 7y ago
No. Only a certain subset, known as “checked exceptions” (as opposed to “runtime” exceptions), need to be in the signature.
In what may come as a surprise, checked exceptions are actually frowned upon in modern java (e.g. new stdlib apis tend to avoid them). They do not compose very well with the rest of the type system (e.g. you cannot write a ”map” function that is polymorphic over checked exception types)—or at the very least, do not compose as well as some other patterns, like Optionals
- fuzzy2 7y agoHm okay. If it’s not “compatible” with streams, higher-order functions and whatnot I can see why it’s not popular. A pity, really.