JSR 292 formal Public Review
By John.Rose-Oracle on Feb 08, 2011
For almost two years, I have been keeping an updated preview of the specification here. This is simply a spin of the Javadoc derived from the current patch set in the Da Vinci Machine Project. I have also frozen a copy of this preview, as of the Public Review, here.
This has has been a long time coming. In some ways, it is sad that it has taken so long. (Four years, yikes!) On the other hand, some very exciting improvements have place in recent months, since last year's JVM Language Summit. JSR 292 has not slowed the JDK 7 process, but where JDK 7 has been slowed for other reasons (such as the Oracle acquisition) I have aspired to use the extra time to make JSR 292 even more mature. In that light, I am very glad that the specification has benefited from those extra months of development. The first working implementation of August, 2008 was pretty good (as an API design), but what we have today is far better.
Here are some recent major changes leading up to Public Review:
- The package for JSR 292 is no longer
java.dyn. It is
- There is a much simpler variable-arity hook. The
withTypeHandlermethod is gone; now we have
asVarargsCollector. Varargs method handles are fully integrated with Java's "varargs" feature.
- There is clear documentation about how compilers are to recognize that the
invokeGenericmethods require special processing.
- The process for decoding a SAM object into a method handle is based on static methods instead of an interface.
MethodTypeis serializable, like
- There is a documented
SecurityManagerAPI for checking reflective method handle lookups.
- Exceptions produced by method handle lookups are documented and standardized.
And here are a few of the many changes in presentation:
- There are
@throwsspecifications for all the corner cases of bad arguments.
- CallSite and its key methods (
dynamicInvoker) are all abstract.
- The introductory texts for the major classes have been reworked and the examples rechecked.
- Obsolete, deprecated, and provisional features have been removed. There are some "historic notes" to acknowledge their previous presence.
- The term "signature" has been replaced by the term "type descriptor" in most places, for compatibility with the JLS. (Exception: The special term "signature polymorphic" is retained.)
A complete (verbose) account of the differences since my last announcement may be found here. As noted in a recent announcement, this specification is not fully implemented yet. Specifically, the package renaming will take a few weeks of maneuvering; this process has already begun with a modification to javac.