Java 9 is here and it’s time to check out what it has in store for us
After a long wait, it’s here: Java 9. For the grand finale of our countdown (and yes, we counted the days), it’s time to see the highlights that are about to improve our code. Make some popcorn, and let’s explore the features that are about to change the way we code.
— OverOps (@overopshq) September 20, 2017
The crown jewel: Project Jigsaw
The star of Java 9 is Project Jigsaw. It has been a long and bumpy road for this project, originally scheduled for Java 7, pushed back to Java 8 and now emerging in Java 9. There were a number of reasons to why Jigsaw delayed the release date of Java 9, when the most recent one was caused due to disagreements within the Java Community Process (JCP) Executive Committee. The committee raised concerns over Project Jigsaw’s viability in non-trivial issues, such as implementation and compatibility with existing developer code.
As stated out in the specifications of JSR 376 (commonly known as Project Jigsaw), this project aims to make Java modular, and break the JRE to interoperable components. This means that you’ll be able to use a scaled down runtime Jar (rt.jar) customised to the components a project actually needs.
This is a big step for Java, and an even bigger step for developers. If you’re worried about making the switch to the Java 9 platform, don’t be. We’ve gathered a list of the top Jigsaw misconceptions that have been officially debunked by Mark Reinhold, Chief Architect for the Java Platform Group himself.
Changing the way we code
Java 9 will introduce some interesting features that are bound to change the way we code. We’ve covered some of the top features, including the combination of Java and REPL (JShell), an update of Concurrency and Stack Walking API, HTTP 2.0, process API and of course, debugging in production.
Java 9 will also include some interesting updates to CompletableFuture, Concurrency updates and support for Reactive Streams, that caught our attention. G1 will be the default garbage collector, server-style garbage collector, designed for multi-processor machines with large memories.
And of course, we can’t forget about the bug in Java 6 that has turned into a feature in Java 9 – Unsafe. The library itself is a collection of methods for performing low-level, unsafe operations, and one of the main uses in it is allocating instance methods. It allows to skip the object initialization phase or to bypass security checks in a constructor.
There are also a few features that didn’t make the cut to Java 9, such as a standardized lightweight JSON API and Money and Currency API, but it only means that we have something to look forward to in Java 10.
Java 9 is also expected to revolutionize the way we think of and build large scale applications. If you’re interested in the implications for building highly scalable applications, join our Java 9 First Impressions webinar.
Letting the community in
Another big update that’s about to be a part of Java 9 is a new JDK Enhancement Proposal (aka JEP 11) that introduces playground incubator modules. It aims to enable enhancement of proposals with the input of a wider audience as part of new JDK Release Projects.
This will allow features who are not yet standardized to get some attention, and be proven (or disproven) by the Java community. This could lead to a feature groomed by the community enter the next Java release, or be removed from the platform.
It’s a similar concept to Project Amber, that has been pushed back to the future Java version. This project meant to explore and incubate smaller, productivity-oriented Java language features. The main difference here is that this project will focus on existing JEPs, while the former will focus on features who are still not JEP ready.
Moving to a 6 month release cycle
One of the biggest changes that will occur with Java 9, is turning Java time-driven, instead of feature-driven. Oracle is moving to a strict release cycle for new Java versions, with a new release every six months, and update releases every quarter.
In the official proposal for this change, made by Mark Reinhold, he points out that “with JDK 9, the company will ship OpenJDK builds under the GPL (GNU General Public License), to make it easier for developers to deploy Java applications to cloud environments.”
Oracle confirmed that this proposal has been accepted. The company adds that the current build, release, licensing and distribution model is, well, old, and it’s time to offer a better and easier use and redistribution of Java SE.
It will take a few releases to get everything and everyone on board, but it won’t be long before there should be no technical differences between OpenJDK builds and Oracle JDK binaries.
There are a lot of new features in Java 9 that we’re excited about. However, the transition to the new version isn’t going to be an easy task. After the hype has settled, it’s best if you go over the specifications, requirements and features in the new version, and understand how and when you should make the move on your side. Goodluck!