Sun's Java SE team recently released the JDK 7 Milestone 5 build. M5 includes roughly half of the Project Coin features, updates to the java.util.concurrent package from Doug Lea et al, and a number of other enhancements.
The new language features from Project Coin are:
- Improved type inference for generic instance creation (diamond) which provides limited type inference for class instance creation, so that where parameter types need to be explicitly declared for a constructor, but could be ascertained from the context, they can be replaced with an empty set of type parameters. Thus instead of writing:
Map<String, List<String>> anagrams = new HashMap<String, List<String>>();
You could write:
Map<String, List<String>> anagrams = new HashMap<>(); - Support for binary literals and underscore separators in numbers to aid readability - for example long creditCardNumber = 1234_5678_9012_3456L.
- Support for Strings in Switch statements.
The updates to the java.util.concurrent package include support for Phasers, TransferQueues, and the fork/join framework. Alex Miller provides an excellent summary of the included features, and those such as the Fences API and ParallelArray which haven't yet made the cut, here.
In addition to these changes Swing gets a new component, JLayer, for decorating compound components and intercepting subcomponent events, and Sun have also extended the implementation of elliptic curve cryptography to cover all the platforms for which they provide a JRE (it was previously available on Solaris only). Milestone 5 also includes a number of performance related enhancements such as a new faster merge sort algorithm which Josh Bloch adapted from Python’s "TimSort". At the VM level, both escape analysis and compressing 64-bit pointers to fit into 32 bits are now enabled by default for the HotSpot virtual machine, helping to both reduce memory consumption and improve performance.
There are a large number of other changes, a complete list of which can be found here.
Milestone 5 was expected to be the first feature complete release of Java 7 but it is some way short of that. The following table shows the major features which are included in the Milestone 5 release.
vm | Compressed 64-bit object pointers Garbage-First GC (G1) JSR 292: VM support for non-Java languages (InvokeDynamic) |
lang | JSR 308: Annotations on Java types |
core | Upgrade class-loader architecture Method to close a URLClassLoader Unicode 5.1 JSR 166y: Concurrency and collections updates JSR 203: More new I/O APIs for the Java platform (NIO.2) SCTP (Stream Control Transmission Protocol) SDP (Sockets Direct Protocol) Elliptic-curve cryptography (ECC) |
client | Forward-port 6u10 deployment features New platform APIs for 6u10 graphics features Nimbus look-and-feel for Swing |
Major features yet to be completed include:
- Modularisation (Project Jigsaw) and the related Language and VM support for modular programming (JSR 294).
- A number from Project Coin including Automatic Resource Management, collection literals, language level support for JSR-292, and simplified varargs method invocation.
- Updates to the XML stack originally slated for the M4 release.
- The XRender pipeline for Java 2D.
- The dual-pivot quicksort implementation.
Some of these are really quite close. The dual-pivot quicksort code for example is likely to be in the first build of Milestone 6, build 77, on the 3rd December 2009. Others however are some way off. Project Jigsaw is making progress but currently only has alpha quality Linux-only binaries of M5 available to download. Similarly JSR 294 appears to be some way from completion, and on the expert group mailing list Alex Buckley suggests that the simple module proposal should not be pursued:
Since both Jigsaw and OSGi are defined in the first instance outside the JCP, it does not appear that JSR 294 is well-positioned to define a module system that unifies them. It would be a lowest-common-denominator design with well-intentioned but irksome compromises. There has been no clear support in the EG for the Simple Module System proposal, and I would like to take it no further.
Given that there is still a long way to go on JDK 7, Sun has decided to add three more milestone releases to the schedule and move the feature complete build to milestone 8 (3rd June 2010). This may allow them to include some other features such as multi-catch and, as previously covered, closures to the JDK 7 release, but puts the final release date back by around six months to September 2010.