JDK 12 Released

Oracle today announced the general availability of JDK 12, the latest update of the reference implementation of the Java SE Platform. The third release under Oracle's relatively new six-month release schedule, JDK 12 comes with a number of new features, including a preview of Switch Expressions and abortable mixed collections for the Garbage-First (G1) collector.

The accelerated release cadence, announced in 2017, calls for a feature release every six months, update releases every quarter and a Long-Term Support (LTS) update release every three years (or once every six versions). The next LTS release will be Java 17, which is scheduled for release in September 2021.

"The faster release schedule is about getting new functionality into the hands of developers quickly," Georges Saab, VP of Java Platform Group at Oracle, told ADTmag. "It's about providing incremental changes that are less disruptive for developers, that continue to evolve and improve the platform and that keep Java relevant."

JDK 12 will receive a minimum of two updates within the Oracle Critical Patch Update (CPU) schedule before being superseded by Oracle JDK 13, which is due out in September 2019.

JDK 12 comes with eight enhancements focused on productivity, including:

  • A Low-Pause-Time Garbage Collector (JEP 189)
    Code-named "Shenandoah," this experimental feature adds a new algorithm designed to reduce GC pause times by dealing with evacuation work concurrently with the running Java threads.
  • Microbenchmark Suite (JEP 230)
    This update adds a basic suite of microbenchmarks to the JDK source code and makes it easy for developers to run existing microbenchmarks and create new ones.
  • Switch Expressions (JEP 325)
    Offered as a preview in this release, this feature extends the switch statement so it can be used as either a statement or an expression. It allows both forms to use either a "traditional" or "simplified" scoping and control flow behavior. "These changes will simplify everyday coding, and also prepare the way for the use of pattern matching (JEP 305) in switch, the company said.
  • JVM Constants API (JEP 334)
    This API is designed to model nominal descriptions of key class-file and run-time artifacts, particularly constants that are loadable from the constant pool, which stores the operands for bytecode instructions in the class.
  • One AArch64 Port, Not Two (JEP 340)
    This feature removes all sources related to the arm64 port, while retaining the 32-bit ARM port and the 64-bit aarch64 port. This feature allows all contributors to focus their efforts on a single 64-bit ARM implementation, and eliminates the duplicate work required to maintain two ports.
  • Default CDS Archives (JEP 341)
    This feature is designed to enhance the JDK build process to generate a class data-sharing (CDS) archive, using the default class list, on 64-bit platforms.
  • Abortable Mixed Collections for G1 (JEP 344)
    This enhancement makes G1 mixed collections abortable if they might exceed the pause target.
  • Promptly Return Unused Committed Memory from G1 (JEP 346)
    This feature is designed to allow the G1 garbage collector to automatically return Java heap memory to the operating system when idle.

Oracle also promoted its Java SE Subscription service in this update announcement with news that Spotify, the world's largest music streaming service, has signed on to the service in a multi-year agreement. The monthly subscription provides Java SE Licensing and Support for use on Desktops, Servers, or Cloud deployments. It covers commercial features and tools, and it includes Oracle Premier Support for current and previous Java SE versions.

"The Java SE Subscription model provides customers with the best flexibility and support from the world's leading contributors to Java SE," Saab said in a statement. "Spotify's decision to engage with the Java SE Subscription model is a testimony to our success engaging with the Java community and to our position as a leader providing both open source and commercially supported Java SE innovation, stability, performance and security updates for the Java Platform."

Missing from this update is the Raw String Literals (JEP 326) feature, which had been expected as a preview, but was pulled back from this release. Oracle's Java language architect, Brian Goetz, explained the decision in a note to the OpenJDK mailing list:

While we can expect that for any language feature, there will be a nontrivial volume of 'I would have preferred it differently' feedback, in reviewing the feedback we have received, I am no longer convinced that we've yet got to the right set of tradeoffs between complexity and expressiveness, or that we've explored enough of the design space to be confident that the current design is the best we can do. By withdrawing, we can continue to refine the design, explore more options, and aim for a preview that actually meets the requirements of the Preview Feature process (JEP 12).

(Georges Saab talks about the impact of the faster Java release cadence on the developer community and his own team at Oracle in an upcoming interview.)

About the Author

John K. Waters is the editor in chief of a number of sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].