跳到主要内容

JDK 12 新特性概览

JEP 189: 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.

JEP 189: Shenandoah: 一种低暂停时间的垃圾收集器(实验性)

添加了一种新的垃圾收集(GC)算法,名为Shenandoah,它通过与正在运行的Java线程并发进行清理工作来减少GC暂停时间。使用Shenandoah的暂停时间与堆大小无关,这意味着无论您的堆是200 MB还是200 GB,您都会有相同的一致暂停时间。

JEP 230: 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.

JEP 230: 微基准测试套件

向JDK源代码添加一套基本的微基准测试,并使开发者能够轻松运行现有的微基准测试并创建新的测试。

JEP 325: 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 behavior. These changes will simplify everyday coding, and also prepare the way for the use of pattern matching (JEP 305) in switch. This is a preview language feature in JDK 12.

JEP 325: Switch 表达式(预览)

扩展 switch 语句,使其可以作为语句或表达式使用,并且两种形式都可以使用“传统”或“简化”的作用域和控制流行为。这些变化将简化日常编码,并为在 switch 中使用 模式匹配(JEP 305) 做好准备。这是 JDK 12 中的一个 预览语言特性

JEP 334: JVM Constants API

Introduce an API to model nominal descriptions of key class-file and run-time artifacts, in particular constants that are loadable from the constant pool.

JEP 334: JVM 常量 API

引入一个 API 来建模关键类文件和运行时工件的名义描述,特别是可以从常量池加载的常量。

JEP 340: One AArch64 Port, Not Two

Remove all of the sources related to the arm64 port while retaining the 32-bit ARM port and the 64-bit aarch64 port.

JEP 340: 一个AArch64端口,而不是两个

移除与arm64端口相关的所有源代码,同时保留32位ARM端口和64位aarch64端口。

JEP 341: 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.

JEP 341: 默认CDS归档

增强JDK构建过程,在64位平台上使用默认类列表生成类数据共享(CDS)归档。

JEP 344: Abortable Mixed Collections for G1

Make G1 mixed collections abortable if they might exceed the pause target.

JEP 344: 可中止的G1混合收集

如果混合收集可能超过暂停目标,则使G1混合收集可中止。

JEP 346: Promptly Return Unused Committed Memory from G1

Enhance the G1 garbage collector to automatically return Java heap memory to the operating system when idle.

JEP 346: 及时归还G1未使用的已提交内存

增强G1垃圾收集器,在空闲时自动将Java堆内存归还给操作系统。