3 ms·
Checked exceptions are probably are of my biggest pet-peeves about Java (erasure and lack of closures/first order functions are the other ones). They create exc
by strlen 17y ago
Checked exceptions are probably are of my biggest pet-peeves about Java (erasure and lack of closures/first order functions are the other ones). They create excess verbosity, but what good are they if most code I've seen does this:
try {
foo.bar();
} catch (FooException fe) {
logger.error(fe);
}
A descriptive crash would be more useful, especially if the exception is thrown as a result of an invariant being violated. Scala is a step forwards in this manner, but now there's the issue of remembering which Java methods (foreign to Scala) rely on exceptions to convey important information (e.g. anything which throws InterruptedException).
- spectre 17y agoMost try-catches are considered boiler plate and are often generated. For example of the default options in NetBeans generates the following: try { foo.bar(); } catch (Exception ex) { Logger.getLogger(InvalidConversionException.class.getName()).log(Level.SEVERE, null, ex); }