Chapter 5. The Future of Java

Finally, let’s turn to the future of the language, platform, and developer ecosystem. Increasingly, these have become interwoven, so it makes sense to treat them as a whole as we look into our crystal ball.

Java 9

The next major release of the platform is Java 9, scheduled for September 2016. As releases go, it’s expected to be a fairly major one, as it contains a number of large features (although how their impact will compare to the arrival of lambdas in Java 8 remains to be seen).

Modules

If lambda expressions were the “headline” feature for Java 8, in Java 9 it is anticipated to be modules. Up until now, the largest grouping construct for Java code was a package, but the release of Java 9 will see a new concept—the module. Modules are collections of code that are larger than packages, and are no longer delivered as JAR files (which are really just .zip files). Instead, modules have a new file format that has been designed to be more efficient.

Modules also add a major new feature to the language, which is the ability to enforce access control across modules. That is, modules are able to fully specify their public API, and prevent access to packages that are only for internal use.

The ability for modules to allow internals access only to trusted client code will have major repercussions for Java applications. This is most apparent in the removal of access to a class called sun.misc.Unsafe. This class is an internal class (as can be seen by the ...

Get Java: The Legend now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.