On Aug 18, 5:27 am, phil swenson <[email protected]> wrote:
> > Someone should short-circuit javac, since
> > checked exceptions really is just a figment of its imagination.

Done, sort of, if you use eclipse, at any rate. Install project lombok
and stick:

@SneakyThrows

on every method that you have. You could also dive into the lombok
source code and change the SneakyThrows handler to just apply to every
method, even if it does not have that annotation. It would at least be
an interesting experiment to spend some time coding in plain java
except with checked exceptions just disabled wholesale. There's one
fairly major problem though: javac will not let you catch exceptions
unless a statement in the try block is known to throw that exception,
and with @SneakyThrows, that just doesn't happen anymore. I fervently
hope that this restriction is removed in java 7. It's somewhat likely;
Neal Gafter's idea of letting 'catch ( final Throwable t ) ' actually
have t only be all types that can legally be thrown by the statements
in the try block, so that you can do a general catch all and rethrow
without enumerating all types, has a rare condition in which old code
no longer compiles, which would be fixed if you indeed remove the
restriction that you can't catch exceptions that are never thrown in
the try block*. So, here's hopin' coin delivers.

*) Well, you can always catch a superclass or subclass of
RuntimeException and Error, but all the other ones, not so much.

NB: I discovered a bug in the sneaky throws code generator for
eclipse; every so often it'll make eclipse's parser get very confused
and you lose your syntax highlighting. It happens somewhat rarely, and
I don't have time today to figure out exactly what's causing it, but I
will get around to it at some point.

>
> I made this request on the Project Coin list and was very promptly
> shot down.  I really do wish someone would hack it into javac and have
> and IDE switch to turn them off.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to