9 Proposed Java 9 Features Devs Will Love

Modularity, JSON, smart compilation -- Java's future offers compelling features to look forward to

Cool Java 9 proposals developers will love

Cool Java 9 proposals developers will love

Java 8 arrived earlier this year to much fanfare, including high marks for lambda expressions and JavaScript on the JVM via Nashorn. But not everything about Java 8 was a love fest, and core developers at Oracle are already chalking up plans for the next version to improve Java. 

Expected in early 2016, Java Development Kit 9, based on the Java Standard Edition 9 specification, is expected to include performance tweaks, new capabilities, and, most notably, modularity. While some proposed features could miss the final cut or be postponed to a later release, there's already a lot to like about Java's proposed future. Here is a preview of some of the most intriguing proposals for JDK 9 so far.

Modular source code

Modular source code

The most highly anticipated change to Java 9 will be modularity. Inspired by Project Jigsaw, which was deferred from Java 8 until Java 9, the effort to modularize Java's source code will be accompanied by a build system enhanced for this capability.

"Project Jigsaw aims to design and implement a standard module system for the Java SE Platform and to apply that system to the platform itself and to the JDK," according to JDK Enhancement Proposal (JEP) documentation. "Its primary goals are to make implementations of the platform more easily scalable down to small devices, improve the security and maintainability, enable improved application performance and provide developers with better tools for programming."

Multiple JEPs are planned as part of the modularization process.

Lightweight JSON API

Lightweight JSON API

Java 9 is expected to include a lightweight JSON API to facilitate the inclusion of JSON documents and data streams in Java programming.

"JSON has become the lingua franca for Web services and it is time for Java SE to adopt functionality for interacting with and utilizing JSON documents and data streams," a JEP document says. "This proposal is designed [to] provide the most commonly needed functionality and take advantage of Java 8/9 language and library features."

The JSON effort aims to enable Java developers to parse and generate JSON data. A generator style API for JSON data stream output and JSON literals is also a goal.

Process API updates
Wikipedia

Process API updates

Java 9 is also expected to improve the API for controlling and managing operating system processes.

"The limitations of the current API often force developers to resort to native code," according to the process API JEP. Java SE presently offers limited support for native OS processes, allowing Java developers to simply set up an environment and start a process. Changes will require new unit and functional tests, according to the JEP.

OS differences mark the main risk facing this API, in particular Windows. "The design of this API needs to accommodate possible deployment on smaller devices with different operating system models. It should also take into account environments where multiple Java virtual machines are running in the same operating system process," the JEP states.

Segmented code cache
TeXample.net

Segmented code cache

Java 9 aims to divide code cache into segments to improve performance and facilitate extensions.

"Instead of having a single code heap, the code cache is segmented into distinct code heaps, each of which contains compiled code of a particular type. Such a design enables us to separate code with different properties," the JEP states.

Top-level types of compiled code include JVM internal code, profiled and nonprofiled code, which would be separated. The organization and maintenance of compiled code has a big impact on performance, according to the JEP. Better control of the JVM memory footprint is a goal of this initiative, as is improved execution time for some compilation-intensive benchmarks.

Smart Java compilation, Phase 2

Smart Java compilation, Phase 2

Java 9 proposes to improve the sjavac compiler tool, so it can be used by default in the JDK build. The tool is also expected to be generalized for use in other large projects.

"Due to various issues relating to stability and portability, sjavac is not used by default in the JDK build scripts," the JEP document states. "The first goal of this JEP is to resolve these issues. This involves making sure the tool produces reliable results on all software/hardware configurations at all times."

Currently, core developers have improved sjavac's build speed and allowed for incremental builds. "The quality of the code and stability of the tool as a whole, however, is not satisfactory and it is certainly not ready for public release."

Improve contended locking
violetkaipa

Improve contended locking

Core Java developers aim to boost the performance of contended Java object monitors in the next iteration of Java, as measured by benchmarks and tests, including CallTimerGrid, among others.

"Improving contended locking will significantly benefit real-world applications, in addition to industry benchmarks such as Volano and DaCapo," JEP documentation states.

Performance improvements will be explored in a number of areas pertaining to contended Java monitors, such as field reordering and cache line alignment, as well as fast Java monitor enter and exit operations.

HTTP 2
FotoMak

HTTP 2

Under development by the IETF, HTTP 2 aims to improve Web page loading times and API capabilities and is based on Google's SPDY networking protocol. "The focus of the protocol is on performance; specifically, end-user perceived latency, network and server resource usage," according to HTTP 2 documentation on GitHub. "One major goal is to allow the use of a single connection from browsers to a website."

Core Java developers are keeping an eye on HTTP 2 developments. "[This proposal is] basically looking at HTTP 2 and what is needed to support that," says Georges Saab, vice president of the Java platform group at Oracle and head of the Java Standard Edition group.

Cloud-optimized JVM
Nicolas Raymond

Cloud-optimized JVM

Core Java developers hope to enable users to better leverage existing cloud infrastructures with Java 9 by cloud-optimizing the JVM.

This proposal is all about helping with deployments of Java in the cloud, Oracle's Saab says.

Oracle already has been working on better enablement of cloud computing in Java EE (Enterprise Edition) 7. Plans call for building on that with Java EE 8, due in two years.

Ahead-of-time compilation
iStockphoto

Ahead-of-time compilation

One common knock against Java is its relatively slower startup times. Java 9 proposes to fix this, by enabling ahead-of-time compilation to improve startup, among other benefits.

"The primary reason for adding ahead-of-time compilation to Java is improved startup time, but it may also bring other benefits such as smaller install footprint for self-contained Java applications that are bundled with a JRE [Java Runtime Environment]," says Henrik Stahl, vice president of java product management at Oracle.