Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News JavaOne 2015 Keynotes (Part 1)

JavaOne 2015 Keynotes (Part 1)

In celebration of Java’s 20th anniversary this year, the JavaOne 2015 central theme was ’20 years of Java’. Oracle vice president of software development in the Java Platform Group Georges Saab’s keynote focused on the journey of Java, its major milestones, and a deep focus on Java 8 and updates. Oracle Java Platform chief architect Mark Reinhold’s keynote laid out the Java roadmap showcasing Java 9, scheduled for release in 2016 Q3.

Reinhold mentioned that the key to Java’s success is in identifying the pain points; figuring out the missing abstraction and adding that abstraction in such a way as to fit existing solutions.

Reinhold said "The goal is to keep improving developer productivity over time while retaining Java’s key values of readability, simplicity, universality and compatibility."

He reasoned that missing abstractions have led to big innovations in the way of generics in Java 5 and lambdas in Java 8. In 2008, Project Jigsaw introduced modules to address two different pain points: classpath hell and the big monolithic JDK.

Classpath Hell

According to Reinhold, the fundamental problem with classpaths is that they are only about classes. He said "Classpath is a way to look up classes regardless of the component, package or even their intended use."

With classpaths there is no way to ensure that the class you are looking for is even present in the jars; neither do we know if there are any conflicts with respect to the APIs. Also, internal APIs may pose safety issues when developers that don’t know or understand their purpose make changes to them.

According to Reinhold, modules provide a stronger abstraction to jar files and are a program component that is implemented not only in the Java programming language but also in the JVM. As he said "Modules are the key to escaping from classpath hell."

A module can be thought of as a container of packages that also describes how it relates to other modules. A module:

  • Is a container of packages
  • Names the modules upon which it depends
  • Does not interfere with other modules
  • Exports specific packages for use only by the modules that depend upon it.

In-order to employ modules for Java 9, the module for the desired JAR must be declared in a file called module-info.javaThe file name is not a class name; it is a convention just like; but it can still be compiled with javac. A modular JAR file contains the module-info.class. This modular JAR can be shipped as a single artifact; for pre-Java 9 releases, the modular JAR will work just like a regular JAR.

Reinhold mentioned that the adoption has been simplified by allowing the end users to modularize existing systems from either the bottom up or top down.

The Monolithic JDK

Project Jigsaw accommodates many new use cases that were traditionally not suitable with the massive and monolithic Java SE JDK. Some of these use cases include:

According to Reinhold "modules provide reliable config with strong encapsulation."

With modularization, one may use just what is needed, with improved security. Hence, in JDK 9, all non-critical internal APIs will be encapsulated. Some critical internal APIs such as sun.misc.Unsafe will still remain accessible. The proposal for encapsulation of (most) internal APIs notes that "Critical internal APIs for which replacements are introduced in JDK 9 will be deprecated in JDK 9 and either encapsulated or removed in JDK 10."

Reinhold noted that encapsulated internal APIs may still be accessed via a command line flag at both compile time and run time.

Additional Resources:

For more information on Project Jigsaw, please check out:

JEP 200: The Modular JDK

JEP 201: Modular Source Code

JEP 220: Modular Run-Time Images

JEP 260: Encapsulate Most Internal APIs

JEP 261: Module System

Project Jigsaw Quick Start

Rate this Article