Congrats, very cool, I had my doubts whether this was possible but am
happy to see it is. For mass consumption in an existing tool-chain, it
beats my hacking of javac. Was working on a blog entry to cover source
code javac short-circuiting, but I think I'll suspend it and dive into
this approach instead.

Question, are you currently rewriting the isUnchecked(...) calls in
com.sun.tools.javac.comp.Check.class? If you want to convert the
unchecked exception from an error into a warning, you should be able
to do that by rewriting the com.sun.tools.javac.comp.Flow.class, in
the errorUncaught() method simply have it dispatch calls to log.warning
(...) rather than the current log.err(...).

Note that if you try this, you will get warning from javac as it is
unable to now find the correct resource keys in
com.sun.tools.javac.resources.compiler.properties and a few more
elements to the ListResourceBundle in
com.sun.tools.javac.resources.compiler.class (although I suppose, at
the bytecode level, the former has been merged into the
compiler.class?).

/Casper

> After some coordinating with Perry Nguyen and Casper Bang, I now have
> created this thing:
>
> http://projectlombok.org/disableCheckedExceptions.html
>
> It simply disables checked exceptions, completely, in your javac. All
> you have to do is add it to the classpath as you compile, like so:
>
> ~> javac -cp disableCheckedExceptions-alpha.jar *.java
>
> That's a vanilla javac. The notion of checked exceptions is eliminated
> completely; you may throw any exception without declaring it, and you
> may catch any exception even if it is not thrown in the try body that
> goes with the catch block. You'll need a javac v1.6 for this to work,
> I doubt it'll fly under javac 1.5 (you'd at least have to add the jar
> as an annotation processor on 1.5, and even then I doubt it'll work).
>
> A good idea? Well, who knows. Experiment to your hearts content and
> find out!
>
> Unlike project lombok, this little side project won't work in eclipse
> or any other IDE. It's more a proof of concept that javac can be
> completely modified at will by an annotation processor if you try hard
> enough. This does mean that adding e.g. closures or anything else that
> requires grammar changes is technically doable as annotation
> processor. I already knew that was possible with eclipse and other
> IDEs.
--~--~---------~--~----~------------~-------~--~----~
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