sneaky throwing

Christian Thalinger christian.thalinger at
Thu Jan 9 21:03:08 PST 2014

On Jan 9, 2014, at 8:39 PM, Andy Nuss <andrew_nuss at> wrote:

> Hi,
> I had a lot of reasons to sneaky throw exceptions just as they are but without having the function that throws them declare the exception.  This saves me alot of trouble, especially with reflective errors that I know shouldn't ever happen.
> To do this, I declared an interface that throws Throwable and the throwing function taking a single argument, the Throwable, and just providing a simple implementation for it.  Compiled to a .class and saved the byte code file as a small hex string.  Meanwhile, I declared another version of the interface that is identical in every way except that it does not declare that its throwing function throws Throwable.  I then use the saved bytecodes as the implementation for this interface, and use a singleton to provide the public static function.  Apparently, at the bytecode level, this is ok.
> This has worked nicely all the way from JDK4 to JDK7.  Will it work with JDK8?  For example, lets say I have a tomcat servlet which throws 2 kinds of declared exceptions.  But I in fact sneaky throw many others during development.  This is ok right now.

(I think) this is the wrong mailing list.  I’m not exactly sure which list to suggest because I’m having a hard time to parse the message for the question.  Can you rephrase the question and be more precise?

> Andy

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-compiler-dev mailing list