Jigsaw Finally Arrives in JDK 9
In an e-mail to the jdk9-dev list, Alan Bateman announced that a snapshot version of the Jigsaw module system would finally be incorporated into the mainline JDK9 development branch. The state of the module system document has recently been updated to indicate progress, but this is the first time that the changes will be brought back together since the Jigsaw project started.
Historically Java development has been done in separate branches, or since they are Mercurial, different trees. The Hotspot compiler (and underlying VM contents) is developed in the Hotspot tree, while mainline Java development is done in the jdk tree. There are also different trees for nashorn and even corba in the Open JDK set. As a result, each of these groupings is referred to as a forest as they are related trees. (The structure is largely because Mercurial didn't have lightweight branching when the project was created; and since it doesn't manage inter-branch pushing well they were separated as different repositories. This is also why there are jdk8 and jdk8u forests; jdk8 is effectively the head development branch while jdk8u contains forks of those repositories pinned at specific tags, such as 8u40 and 8u60. Fortunately all of these can be collapsed down to a single Git repository which makes a lot more sense in general.)
The changes introduced by Jigsaw are fairly significant; the underlying packages have been split into different modules, each containing one or more packages. The
java.base module contains the majority of the standard Java libraries (
java.time etc.) This split has had some casualties; the java.beans package, due to its tight coupling with AWT and Applets, has been migrated into the
java.desktop module; which means classes in the java.base package that implemented listener registration methods for
PropertyChangeListener have been removed.
However, to keep developing the JDK 9 classes and Jigsaw, without causing difficulties, the Jigsaw implementation has been in its own forest. As a result, the mainlnie OpenJDK Java builds available from Oracle and Azul's Zulu haven't had Jigsaw for developers to try out. Instead, a special 'early access' build has been made available, which provides the Jigsaw content but not some other changes from the JDK 9 branches.
As a result, this mail confirms that Oracle will try to merge the changes that have been developed in parallel from the Jigsaw forest into the JDK9 forest. Some of the advanced changes (such as the removal of the PropertyChangeListeners) have already been done; the automated diffs show no removals and a few hundred additions/changes to the APIs. To try and minimise any additional problems that arise, the JDK9 forest will effectively become locked for two weeks in order to attempt to merge the Jigsaw related changes into the mainline JDK9 forest. It's expected that it will only take one build -- March 21's JDK9+111 build is targetted -- but the Jigsaw team are requesting that March 27's JDK9+112 build is also reserved for potential Jigsaw changes.
Further changes to the Jigsaw modules will happen on the Jigsaw forest, so that developers working against mainline JDK9 won't have to deal with any flux that it may cause. However, the build will for the first time split out the changes to Java's base libraries into different modules, and compile with a module aware system, which will hopefully avoid problems with adding any extra leakage between modules in future. At some point in the future, the Jigsaw forest may be merged completely with JDK9 and then removed, though probably much closer to the end of this year.
Reviews are ongoing ahead of the merge; InfoQ will keep you updated with the state of the module system and Jigsaw's arrival into JDK9.