Project Jigsaw: JDK modularization

The JDK is big and deeply interconnected with many undesirable dependencies between APIs and different areas of the implementation. We started the JDK modularization effort in mid 2009 during the development of JDK 7.

Here is the module graph for JDK 7 b65 rt.jar (tools.jar and the JAR files in the extension directory not included in this graph):

before

(Click on the image to see the full-size version.)

Before the modularization effort, the base module depends on Logging, Preferences, deployment (Java Kernel), AWTPermission, JNDI, and Kerberos. Logging depends on JMX which in turn depends on JavaBeans, JNDI, RMI and CORBA (the JMX remote RMI connector supports both JRMP and IIOP). JNDI requires java.applet.Applet and JavaBeans requires AWT, Swing, and other desktop classes. Use of the Logging API results in transitive dependencies on almost the entire platform.

Lots of work was put into eliminating the undesirable dependencies to get us a more modular JDK. The jigsaw module system can be started with just the base module. Furthermore, it allows applications to be installed with just those components of the JDK that they actually require. Here is the module graph for JDK 8 b48 with 44 modules and 134 edges:

after

26 out of the 44 modules contains the Java SE APIs and other 18 modules are JDK tools, JNDI providers, security providers, and locale data.

Here is the module graph for JDK 8 b48 with edges from all modules to the base module taken out to help see the dependencies clearer:

after, without base module

The base module is essentially the core libraries including java.lang, java.io, java.net, java.nio, and security. The dependencies that used to be required by the base module such as logging, AWT, JNDI, etc are removed. The base module still optionally requires XML and SSL/TLS that needs to be addressed. Logging no longer requires JMX, JNDI no longer requires java.applet.Applet, JavaBeans no longer requires JDBC, AWT no longer requires RMI, and many more.

AWT, Swing, 2D and other client components are grouped into a desktop module. Headless applications can run without the desktop module being present. Since the APIs in this module are deeply interconnected, dividing them into smaller modules would mean that they would require other pieces to be present and would not help the footprint.

java.lang.management and JMX are grouped into the management module. We have separated out the RMI-IIOP transport so that doing remote management does not require CORBA being present. In addition, JMX does its own introspection to rather than depending on JavaBeans Introspector support.

As SSL/TLS can negotiate to use Kerberos based authentication, it was tied to Kerberos/JGSS. Such dependency is now optional. If Kerberos is installed, SSL/TLS will include the Kerberos cipher suites when negotiating the security context. When not installed, it won't negotiate to use Kerberos.

For more further details on the remaining work required to modularize the JDK see the modularization dashboard.

Note