Sunday 7 April 2019

WHAT IS NEW IN JAVA 12 ?

Yes, you read right. JDK 12 was released on March 19, 2019.

This post of what's going to become Java 12, and, obviously, this post can expand and alter over time, till the event of Java twelve is frozen probably at the end of 2018.
I am about to update this post once a brand new feature (JEP) is targeted for JDK twelve, or once there's a very important update on the already targeted JEP.

 Among others, Java 12 includes a number of new features, such as:
  • JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
  • JEP 230: Microbenchmark Suite
  • JEP 325: Switch Expressions 
  • 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


JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
It is enforced and supported by RedHat for aarch64 and amd64, Shenandoah dustman, represented during this paper, provides foreseeable and short Gc pauses freelance of the heap size.

JEP 230: Microbenchmark Suite:
Away, and a collection of microbenchmarks, to simply take a look at the performance of JDK, supported Java Microbenchmark Harness (JMH) are additional to JDK ASCII text file.

JEP 325: Switch Expressions 

There are two main changes to switch in Java 12:


  1. Introduction of case L -> syntax that removes the need for break statements, because only the statements next to -> is executed.
  2. The switch can be an expression, so it can have a value, or it can return a value.


JEP 334: JVM Constants API

Define a family of value-based symbolic reference (JVMS 5.1) types, in the new package java.lang.invoke.constant, capable of describing each kind of loadable constant. A symbolic reference describes a loadable constant in purely nominal form, separate from class loading or accessibility context. Some classes can act as their own symbolic references (e.g., String); for linkable constants, we define a family of symbolic reference types (ClassDesc, MethodTypeDesc, MethodHandleDesc, and DynamicConstantDesc) that contain the nominal information to describe these constants.



JEP 340: One AArch64 Port, Not Two

There are two different set of sources, thus ports, targeting ARM 64-bit in the JDK. One is contributed by Oracle, arm64 (hotspot/cpu/arm), and the other is aarch64 (hotspot/cpu/aarch64). This JEP removes arm64, thus all source code used with #ifdefs under hotspot/cpu/arm will be removed and 64-bit ARM build will default to aarch64. hotspot/cpu/arm will still provide the 32-bit ARM port

JEP 341: Default CDS Archives
Class Data-Sharing (CDS) is a feature to reduce startup time and benefit from memory sharing. However, if you do not install the JRE with the installer, the CDS archive is not generated by default and java  -Xshare:dump has to be run manually.
This can be observed in JDK 11. If you install the JDK 11 GA Release from http://jdk.java.net/11/ ,  lib/server folder does not contain the CDS archive, classes.jsa file. If you run java -Xshare:dump, it will be generated.
With this JEP, CDS archive will be generated by default.

JEP 344: Abortable Mixed Collections for G1
In order to satisfy user equipped pause time target, this JEP makes the G1 garbage collector abort the garbage collection method, by splitting the set of to-be garbage collected regions (mixed collection set) into obligatory and optional elements, and abort the garbage assortment of optional half if pause time target won't be reached otherwise.

JEP 346: Promptly Return Unused Committed Memory from G1
This JEP makes the G1 Garbage Collector return the garbage collected memory areas to the operating system after a period of low application activity. Currently G1 was returning the memory to operating system only after a full GC (or a concurrent cycle) which it avoids, so in effect it was probably not returning the garbage collected memory to operating system at all.

No comments:

Post a Comment