Home > News content

Java 12/JDK 12 officially released

via:博客园     time:2019/3/20 13:04:23     readed:147

Java/JDK 12 has entered the RC phase since February 7. According to the release cycle, Java 12 was officially released today, March 19, local time in the United States.


Delivery of JDK 12 GA

Java 12 brings a series of new features:

One hundred and eighty-nine Shenandoah: A Low-Pause-Time Garbage Collector (Experiment)Low pause time GC
Two hundred and thirty Microbenchmark SuiteMicrobenchmarking Suite
Three hundred and twenty-five Switch Expressions (Preview)Switch expression
Three hundred and thirty-four JVM Constants APIJVM Constant API
Three hundred and forty One AArch64 Port, Not TwoKeep only one AArch64 implementation
Three hundred and forty-one Default CDS ArchivesDefault class data sharing archive file
Three hundred and forty-four Abortable Mixed Collections for G1Discontinuable G1 Mixed GC
Three hundred and forty-six Promptly Return Unused Committed Memory from G1G1 returns unused allocated memory in time

Let's look at the following:

Shenandoah: A Low-Pause-Time Garbage Collector (Experiment)

Shenandoah: Low pause time GC (experimental function)

A new GC algorithm named Shenandoah is added to reduce GC pause time by performing evacuation work simultaneously with running Java threads. The pause time for using Shenandoah is independent of heap size, which means that the same pause time will exist regardless of whether the heap is 200 MB or 200 GB.

Microbenchmark Suite

Microbenchmarking Suite

A new set of micro-benchmarking suites has been added to the JDK source code, enabling developers to easily run existing micro-benchmarking and create new benchmarking.

Switch Expressions (Preview)

Switch expression (preview function)

Pattern Matching (JEP 305)Make preparation.

JVM Constants API

JVM Constant API

API is introduced to model key class files and runtime artifacts, especially constants that can be loaded from the constant pool. In the new java.lang.invoke.constant package, a series of value-based symbol reference (JVMS 5.1) types are defined, which can describe each loadable constant. Symbol references describe loadable constants in pure nominal form, distinguishing them from class loading or accessibility contexts. Some classes can be used as their own symbolic references (such as String), while for linkable constants, a series of symbolic reference types (ClassDesc, MethodTypeDesc, MethodHandleDesc and DynamicConstant Desc) are defined, which contain nominal information describing these constants.

One AArch64 Port, Not Two

Keep only one AArch64 implementation

All sources related to arm64 are deleted, while 32-bit ARM implementations and 64-bit aarch64 are retained.

There are two sets of 64-bit ARM implementations in JDK, mainly in src/hotspot/cpu/arm and open/src/hotspot/cpu/aarch64 directories. Both implements aarch64, which will now be retained and the arm64 provided by Oracle will be deleted. This will enable contributors to focus their efforts on a single 64-bit ARM implementation and eliminate the duplication of effort required to maintain two sets of implementations.

Default CDS Archives

Default class data sharing archive file

For 64-bit platforms, the default class list is used to enhance the JDK construction process to generate class data-sharing (CDS) files.

Abortable Mixed Collections for G1

Discontinuable G1 Mixed GC

If G1 Mixed GC has the possibility of exceeding the pause target, it can be aborted.

Promptly Return Unused Committed Memory from G1

G1 returns unused allocated memory in time

Enhance G1 GC to automatically return Java heap memory to the operating system in idle time. To achieve the goal of returning maximum memory to the operating system, G1 will periodically execute or trigger concurrency cycles during application inactivity to determine overall Java heap usage. This will cause it to automatically return unused parts of the Java heap to the operating system. Under user control, complete GC can be optionally executed to maximize the amount of memory returned.

Each of these new features has a detailed description document, you can click on the corresponding link to view.

Watch JDK 13

AccessibleHttp://openjdk.java.net/projects/jdk/13/Check out the information about JDK 13.


Notice that many developers are interested in the Raw String Literals feature, which is similar to Template Strings in JavaScript ES6 grammar and can basically say goodbye to ugly string stitching. For detailsHttp://openjdk.java.net/jeps/326

This feature was originally planned to be released on JDK 12, but it was cancelled in the end. See:


Maybe it's because the industry is so vocal that the committee recently re-discussed this feature:


What JDK features do you want most? Share it in the message area. ~

China IT News APP

Download China IT News APP

Please rate this news

The average score will be displayed after you score.

Post comment

Do not see clearly? Click for a new code.

User comments