It’s not all about garbage. Java 12 is released.
Java 12 went live this week. It is not a major release; it is a short-term support release, receiving commercial support from Oracle only until the release of Java 13.
The biggest noise being made is about changes to Garbage collection. However it does bring with it 8 new features which have got some Java professionals excited. We share the reviews below:
Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) – Add a new garbage collection (GC) algorithm named Shenandoah which reduces GC pause times by doing evacuation work concurrently with the running Java threads. Pause times with Shenandoah are independent of heap size, meaning you will have the same consistent pause times whether your heap is 200 MB or 200 GB.
Microbenchmark Suite – Add a basic suite of microbenchmarks to the JDK source code and make it easy for developers to run existing microbenchmarks and create new ones.
Switch Expressions (Preview) – Extend the switch statement so that it can be used as either a statement or an expression, and that both forms can use either a “traditional” or “simplified” scoping and control flow behaviour. These changes will simplify everyday coding and prepare the way for the use of pattern matching (JEP 305) in switch. This will be a preview language feature.
JVM Constants API – Introduce an API to model nominal descriptions of key class-file and run-time artefacts, constants that are loadable from the constant pool.
One AArch64 Port, Not Two – Remove all the sources related to the arm64 port while retaining the 32-bit ARM port and the 64-bit aarch64 port.
Default CDS Archives – 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 – Make G1 mixed collections abortable if they might exceed the pause target.
Promptly Return Unused Committed Memory from G1 – Enhance the G1 garbage collector to automatically return Java heap memory to the operating system when idle.
Although not a Long-Term Support release, there are more features to Java 12 than would normally be expected. It raises the question about whether Java 13 will be substantially different. This is due out in 6 months’ time, assuming the twice-yearly release schedule is maintained.