跳到主要内容

JDK 25 新特性概览

JEP 470: PEM Encodings of Cryptographic Objects (Preview)​

Introduce an API for encoding objects that represent cryptographic keys, certificates, and certificate revocation lists into the widely-used Privacy-Enhanced Mail (PEM) transport format, and for decoding from that format back into objects. This is a preview API.

译

JEP 470: 密码学对象的 PEM 编码(预览)

引入一个 API,用于将表示密码学密钥、证书和证书吊销列表的对象编码为广泛使用的 Privacy-Enhanced Mail (PEM) 传输格式,并用于从该格式解码回对象。这是一个 预览 API。

JEP 502: Stable Values (Preview)​

Introduce an API for stable values, which are objects that hold immutable data. Stable values are treated as constants by the JVM, enabling the same performance optimizations that are enabled by declaring a field final. Compared to final fields, however, stable values offer greater flexibility as to the timing of their initialization. This is a preview API.

译

JEP 502: 稳定值(预览)

引入一个用于 稳定值 的 API,稳定值是保存不可变数据的对象。稳定值被 JVM 视为常量,从而能够实现与将字段声明为 final 相同的性能优化。然而,与 final 字段相比,稳定值在初始化时机方面提供了更大的灵活性。这是一个 预览 API。

JEP 503: Remove the 32-bit x86 Port​

Remove the source code and build support for the 32-bit x86 port. This port was deprecated for removal in JDK 24 (JEP 501) with the express intent to remove it in a future release.

译

JEP 503: 移除 32 位 x86 移植

移除 32-bit x86 移植版的源代码和构建支持。该移植版在 JDK 24 中已被弃用并计划移除(JEP 501),明确意图是在未来版本中移除它。

JEP 505: Structured Concurrency (Fifth Preview)​

Simplify concurrent programming by introducing an API for structured concurrency. Structured concurrency treats groups of related tasks running in different threads as single units of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. This is a preview API.

译

JEP 505: Structured Concurrency (第五次预览)

通过引入结构化并发的 API,简化并发编程。结构化并发将在不同线程中运行的相关任务组视为单一工作单元,从而简化错误处理和取消操作,提高可靠性,并增强可观测性。这是一个预览 API。

JEP 506: Scoped Values​

Introduce scoped values, which enable a method to share immutable data both with its callees within a thread, and with child threads. Scoped values are easier to reason about than thread-local variables. They also have lower space and time costs, especially when used together with virtual threads (JEP 444) and structured concurrency (JEP 505).

译

JEP 506: Scoped Values

引入 scoped values,它使方法能够在线程内与其被调用者共享不可变数据,也能与子线程共享。Scoped values 比线程局部变量更易于推理。它们还具有更低的空间和时间开销,尤其是与虚拟线程(JEP 444)和结构化并发(JEP 505)一起使用时。

JEP 507: Primitive Types in Patterns, instanceof, and switch (Third Preview)​

Enhance pattern matching by allowing primitive types in all pattern contexts, and extend instanceof and switch to work with all primitive types. This is a preview language feature.

译

JEP 507: 模式、instanceof 和 switch 中的原始类型(第三次预览)

通过允许在所有模式上下文中使用基本类型来增强模式匹配,并扩展 instanceof 和 switch 以支持所有基本类型。这是一个 预览语言特性。

JEP 508: Vector API (Tenth Incubator)​

Introduce an API to express vector computations that reliably compile at runtime to optimal vector instructions on supported CPUs, thus achieving performance superior to equivalent scalar computations.

译

JEP 508: Vector API (第十次孵化器)

介绍一个 API,用于表达向量计算,使其能在支持的 CPU 上于运行时可靠地编译为最优向量指令,从而实现优于等效标量计算的性能。

JEP 509: JFR CPU-Time Profiling (Experimental)​

Enhance the JDK Flight Recorder (JFR) to capture more accurate CPU-time profiling information on Linux. This is an experimental feature.

译

JEP 509: JFR CPU 时间性能分析(实验性)

增强 JDK Flight Recorder(JFR),以在 Linux 上捕获更准确的 CPU 时间分析信息。这是一个实验性功能。

JEP 510: Key Derivation Function API​

Introduce an API for Key Derivation Functions (KDFs), which are cryptographic algorithms for deriving additional keys from a secret key and other data.

译

JEP 510: 密钥派生函数 API

介绍一个用于密钥派生函数 (KDFs) 的 API,KDFs 是一种密码学算法,用于从秘密密钥和其他数据中派生额外的密钥。

JEP 511: Module Import Declarations​

Enhance the Java programming language with the ability to succinctly import all of the packages exported by a module. This simplifies the reuse of modular libraries, but does not require the importing code to be in a module itself.

译

JEP 511:模块导入声明

增强 Java 编程语言,使其能够简洁地导入由模块导出的所有包。这简化了模块化库的复用,但不要求导入代码本身位于模块中。

JEP 512: Compact Source Files and Instance Main Methods​

Evolve the Java programming language so that beginners can write their first programs without needing to understand language features designed for large programs. Far from using a separate dialect of the language, beginners can write streamlined declarations for single-class programs and then seamlessly expand their programs to use more advanced features as their skills grow. Experienced developers can likewise enjoy writing small programs succinctly, without the need for constructs intended for programming in the large.

译

JEP 512: 紧凑源文件与实例主方法

发展 Java 编程语言,使初学者无需理解专为大型程序设计的语言特性,即可编写他们的第一批程序。初学者不必使用该语言的一种单独方言,而是可以为单类程序编写精简的声明,然后随着技能的提升无缝扩展自己的程序,以使用更高级的特性。有经验的开发者同样可以享受简洁地编写小程序,而无需使用面向大规模编程的构造。

JEP 513: Flexible Constructor Bodies​

In the body of a constructor, allow statements to appear before an explicit constructor invocation, i.e., super(...) or this(...). Such statements cannot reference the object under construction, but they can initialize its fields and perform other safe computations. This change allows many constructors to be expressed more naturally. It also allows fields to be initialized before they become visible to other code in the class, such as methods called from a superclass constructor, thereby improving safety.

译

JEP 513: 灵活构造函数体

在构造器的主体中,允许语句出现在显式构造器调用之前,即 super(...) 或 this(...)。此类语句不能引用正在构造的对象,但它们可以初始化其字段并执行其他安全计算。这一变更使许多构造器可以更自然地表达。它还允许字段在对其类中的其他代码可见之前被初始化,例如从超类构造器调用的方法,从而提高安全性。

JEP 514: Ahead-of-Time Command-Line Ergonomics​

Make it easier to create ahead-of-time caches, which accelerate the startup of Java applications, by simplifying the commands required for common use cases.

译

JEP 514: 提前编译命令行人体工程学

通过简化常见用例所需的命令,使创建 AOT 缓存 更加容易,这些缓存可加速 Java 应用程序的启动。

JEP 515: Ahead-of-Time Method Profiling​

Improve warmup time by making method-execution profiles from a previous run of an application instantly available, when the HotSpot Java Virtual Machine starts. This will enable the JIT compiler to generate native code immediately upon application startup, rather than having to wait for profiles to be collected.

译

JEP 515: 提前方法分析

通过使应用程序上一次运行生成的方法执行剖析数据在 HotSpot Java Virtual Machine 启动时立即可用,来缩短预热时间。这将使 JIT 编译器能够在应用程序启动时立即生成本机代码,而不必等待收集剖析数据。

JEP 518: JFR Cooperative Sampling​

Improve the stability of the JDK Flight Recorder (JFR) when it asynchronously samples Java thread stacks. Achieve this by walking call stacks only at safepoints, while minimizing safepoint bias.

译

JEP 518: JFR 协作采样

提高 JDK Flight Recorder (JFR) 在异步采样 Java 线程栈时的稳定性。通过仅在安全点遍历调用栈来实现这一点,同时尽量减少安全点偏差。

JEP 519: Compact Object Headers​

Change compact object headers from an experimental feature to a product feature.

译

JEP 519: 紧凑对象头

将 compact object headers 从实验性特性改为产品特性。

JEP 520: JFR Method Timing & Tracing​

Extend the JDK Flight Recorder (JFR) with facilities for method timing and tracing via bytecode instrumentation.

译

JEP 520: JFR 方法计时与跟踪

通过字节码插桩扩展 JDK Flight Recorder (JFR),为其提供方法计时和跟踪功能。

JEP 521: Generational Shenandoah​

Change the generational mode of the Shenandoah garbage collector from an experimental feature to a product feature.

译

JEP 521: 分代 Shenandoah

将 Shenandoah 垃圾收集器的分代模式从实验性功能改为产品功能。