Sergey Nivens - Fotolia
The latest Java release delivers improved memory management and code refactoring through the Java virtual machine API and opens the door for bigger things to come.
Oracle's latest release of the Java platform, Java Standard Edition 12 (Java SE 12) offers better performance, functionality, security and programmer productivity. This version, also known as Java Development Kit 12, or JDK 12, continues the six-month release pace Oracle started in September 2017.
"What Java 12 does really well is prove that the Java team can ship a relatively nondisruptive Java release on a six-month cadence," said Cameron Purdy, CEO of Xqiz.it, a Lexington, Mass., cloud software startup, and former senior vice president of development at Oracle. "The truth is that there's nothing earth-shattering in Java 12 -- which is actually a really good thing when you value stability."
Java SE 12 delivers eight enhancements, in the form of JDK Enhancement Proposals (JEPs), to improve developer productivity:
- JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector
- JEP 230: Microbenchmark Suite
- JEP 325: Switch Expressions (Preview)
- JEP 334: JVM Constants API
- JEP 340: One AArch64 Port, Not Two
- JEP 341: Default CDS Archives
- JEP 344: Abortable Mixed Collections for G1
- JEP 346: Promptly Return Unused Committed Memory from G1
Among these features are syntax to make a switch statement into a switch expression and garbage collection related work on both the Garbage First or G1 garbage collector and the Z Garbage Collector. Garbage collection is a form of automatic memory management that frees up memory that is no longer in use or needed by the application.
Java 12's Shenandoah reduces garbage collection pause times because it does the bulk of that work, including compaction, concurrently with the running Java program, according to the OpenJDK website. That means pause times are no longer directly proportional to the size of the heap -- garbage collection for a 200 GB heap and a 2 GB heap should have the same predictable pause behavior, according to the website.
"[JEPs] 341, 344 and 346 all represent solid performance gains for running Java out of the box from a memory management/garbage collection point of view," said Martijn Verburg, CEO of London-based JClarity and co-lead of the London Java Users Group.
The improved and new garbage collectors are a perennial Java weak spot, and releasing memory faster is key to better performance, agreed Holger Mueller, an analyst at Constellation Research in San Francisco.
Cameron PurdyCEO, Xqiz.it
Another big improvement in JDK 12 is something that few people have heard of -- the JVM Constants API, which refactors old Java code to create a single way to map constant data, including fairly complex objects that the Java compiler produces inside each Java class file, Xqiz.it's Purdy said. This allows the JVM to know all of the details about the values of those constants, which paves the way for future Java improvements. Java records, for example, rely on the JVM Constants API. Java records are a feature coming in one of the next Java releases that will allow a developer to succinctly create read-only JavaBeans.
"If the Java team got that project into Java 12 without breaking anything, then they have opened up a bunch of opportunities to do some neat stuff down the road that otherwise would have been impossible," Purdy said.
The previous version, Oracle JDK 11, was the first Long-Term Support (LTS) feature release. Java SE LTS releases will be updated every three years, with new feature releases every six months. JDK 12 will receive a minimum of two updates before being superseded by Oracle JDK 13, slated for September 2019.