JVM | Tuesday, February 8, 2011

JSR 292 formal Public Review

By: John Rose | Architect
If all goes well, there will be a sixty-day formal Public Review of the specification of JSR 292. I expect this to start in about ten days.
(Update: The Public Review period is 2/16/2011 through 4/18/2011. The JDK7 implementation appeared in b136.)

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 java.lang.invoke.
  • There is a much simpler variable-arity hook. The withTypeHandler method 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 invokeExact and invokeGeneric methods require special processing.
  • The process for decoding a SAM object into a method handle is based on static methods instead of an interface.
  • MethodType is serializable, like Class.
  • There is a documented SecurityManager API 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 @throws specifications for all the corner cases of bad arguments.
  • CallSite and its key methods (getTarget, setTarget, 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.

Join the discussion

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
 

Visit the Oracle Blog

 

Contact Us

Oracle

Integrated Cloud Applications & Platform Services