4 ms·
Java has @SneakyThrows. Fight me.
by speed_spread 3y ago
Java has @SneakyThrows. Fight me.
- anonymoushn 3y agoJava has a whole system of annotations that seems designed to make it impossible to figure out what code will actually be run, apparently designed by someone who thought lisp macros were too explicit.
- int_19h 3y agoWhich is a hack that amounts to throwing one's hands up and declaring, "we couldn't make it work properly".
- speed_spread 3y agoWho couldn't make it work properly, the language designer, the stdlib writers or the Java programmers? There is no way to make e.g. InterruptedException "work properly" as a checked exception since there is nothing intelligent one can do about it that's specific to this exception class. Rewrapping as RuntimeEx is just as much weaseling out but using more code and messing up stack trace for no good reason. Also, thanks for answering my request for a fight. Winter is boring.
- int_19h 3y agoThe language designers, because they wanted to have checked exceptions without the complexity of genericizing them. Exceptions that aren't meant to be handled really shouldn't be exceptions in the first place, but that's a separate design issue.