incompatible change coming in javac: invokedynamic calls will declare "throws Throwable"
John Rose
John.Rose at Sun.COM
Fri Jun 12 23:50:31 PDT 2009
In response to comments on coin-dev at openjdk.java.net about our
proposed Java language changes, I am changing the implicit methods of
InvokeDynamic.foo and MethodHandle.invoke to include a static
declaration of "throws Throwable". This aligns with the reality that
there is no framework of static checking for throws and catches that
applies to those calls; they are essentially dynamic and can throw
anything. It allows the Java language to incorporate those new
constructs much more accurately (with respect to the conventions of
the Java language).
I have retrofitted the code internal to the Sun JDK (from meth.patch,
etc.), and the exercise consisted of pasting in a bunch of "throws
Throwable" declarations in places where they did no harm (other than
to look a little ugly). The bytecodes are essentially unchanged;
there are no new catches or throws. For more information on the
language issues (and subsequent discussion, if any) please see coin-dev:
http://mail.openjdk.java.net/pipermail/coin-dev/2009-June/001954.html
Please let me know if there are any other problems with this change,
for users of JSR 292.
-- John
More information about the mlvm-dev
mailing list