Java 9's Jigsaw Module Framework

Categories: Java

One of the big features for the upcoming Java version 9 is supposed to be the Jigsaw module framework. However it has been controversial over its whole development cycle - and now that the release is coming up, some non-Oracle groups on the advisory board are intending to vote against the release of Java 9 due to flaws in Jigsaw.

From the available info, it appears that Jigsaw has two different aims:

  • To allow Oracle to easily release subsets of the Java standard libraries for various purposes (a full JRE for desktops, a “headless” one for servers, a “minimal” one for phones and embedded purposes, etc).

  • To allow third-party library developers to use the same features to minimise conflicts between their code and other libraries in the classpath.

As I understand it, the criticism is primarily that Oracle have succeeded on the first goal, but badly failed to handle the second. It appears that Jigsaw introduces a number of changes that potentially break existing software; a runtime param has been included so a JVM can be run with Jigsaw disabled so that existing code can be used but library authors are expected to release new jigsaw-compatible versions of absolutely everything so that eventually at some future time applications can be run with Jigsaw enabled. This rather reminds me of the Python2-to-Python3 migration - which just about everyone now agrees was a bad idea.

In addition, there are serious questions about whether Jigsaw will actually work in the real world, even if every library author buys in to the new concept. After all, there is no production experience with Jigsaw - it is purely an invented-by-committee framework.

In particular, the authors of frameworks such as JEE and OSGi are rather unhappy. The concerns of a combined group of experts are presented here (as seen on slashdot).

The view of the Jigsaw team appears to be that as a new module system is being introduced, it is a good chance to deliberately not support “poor design practices”; users of Jigsaw must follow proper design principles as they are seen by the Jigsaw team. That view didn’t convince.

It will be interesting to see how this argument turns out…