JDK 23 新特性概览
JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview)
Enhance pattern matching by allowing primitive type patterns in all pattern contexts, and extend instanceof
and switch
to work with all primitive types. This is a preview language feature.
JEP 455: 模式中的原始类型,instanceof 和 switch (预览)
通过允许在所有模式上下文中使用原始类型模式来增强模式匹配,并扩展 instanceof
和 switch
以支持所有原始类型。这是一个 预览语言特性。
JEP 466: Class-File API (Second Preview)
Provide a standard API for parsing, generating, and transforming Java class files. This is a preview API.
JEP 466: 类文件 API (第二次预览)
提供一个标准 API,用于解析、生成和转换 Java 类文件。这是一个 预览 API。
JEP 467: Markdown Documentation Comments
Enable JavaDoc documentation comments to be written in Markdown rather than solely in a mixture of HTML and JavaDoc @
-tags.
JEP 467: Markdown 文档注释
允许使用 Markdown 编写 JavaDoc 文档注释,而不仅仅是使用 HTML 和 JavaDoc @
标签的混合。
JEP 469: Vector API (Eighth Incubator)
Introduce an API to express vector computations that reliably compile at runtime to optimal vector instructions on supported CPU architectures, thus achieving performance superior to equivalent scalar computations.
JEP 469: 向量API(第八次孵化)
引入一个API,用于表达向量计算,该API能够在运行时可靠地编译为支持的CPU架构上的最佳向量指令,从而实现优于等效标量计算的性能。
JEP 471: Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal
Deprecate the memory-access methods in sun.misc.Unsafe
for removal in a future release. These unsupported methods have been superseded by standard APIs, namely the VarHandle API (JEP 193, JDK 9) and the Foreign Function & Memory API (JEP 454, JDK 22). We strongly encourage library developers to migrate from sun.misc.Unsafe
to supported replacements, so that applications can migrate smoothly to modern JDK releases.
JEP 473: Stream Gatherers (Second Preview)
Enhance the Stream API to support custom intermediate operations. This will allow stream pipelines to transform data in ways that are not easily achievable with the existing built-in intermediate operations. This is a preview API.
JEP 473: 流收集器(第二次预览)
增强 Stream API 以支持自定义中间操作。这将允许流管道以现有内置中间操作不易实现的方式转换数据。这是一个 预览 API。
JEP 474: ZGC: Generational Mode by Default
Switch the default mode of the Z Garbage Collector (ZGC) to the generational mode. Deprecate the non-generational mode, with the intent to remove it in a future release.
JEP 474: ZGC: 默认启用代际模式
将Z垃圾收集器(ZGC)的默认模式切换为代际模式。弃用非代际模式,计划在未来的版本中移除它。
JEP 476: Module Import Declarations (Preview)
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. This is a preview language feature.
JEP 476: 模块导入声明(预览)
增强Java编程语言,使其能够简洁地导入模块导出的所有包。这简化了模块化库的重用,但不要求导入代码本身在一个模块中。这是一个预览语言特性。
JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview)
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. This is a preview language feature.
JEP 477: 隐式声明类和实例主方法(第三次预览)
发展Java编程语言,使初学者能够编写他们的第一个程序,而无需理解为大型程序设计的语言特性。初学者可以编写简化的单类程序声明,并在技能提升时无缝扩展他们的程序以使用更高级的特性,而不是使用语言的单独方言。经验丰富的开发者同样可以享受简洁地编写小程序,而无需使用为大型编程设计的构造。这是一个预览语言特性。
JEP 480: Structured Concurrency (Third Preview)
Simplify concurrent programming by introducing an API for structured concurrency. Structured concurrency treats groups of related tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. This is a preview API.
JEP 480: 结构化并发(第三次预览)
通过引入一个用于 结构化并发 的 API 来简化并发编程。结构化并发将不同线程中运行的相关任务组视为一个单一的工作单元,从而简化错误处理和取消,提高可靠性,并增强可观察性。这是一个 预览 API。
JEP 481: Scoped Values (Third Preview)
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 480). This is a preview API.
JEP 482: Flexible Constructor Bodies (Second Preview)
In constructors in the Java programming language, allow statements to appear before an explicit constructor invocation, i.e., super(..)
or this(..)
. The statements cannot reference the instance under construction, but they can initialize its fields. Initializing fields before invoking another constructor makes a class more reliable when methods are overridden. This is a preview language feature.
JEP 482: 灵活的构造函数主体(第二次预览)
在Java编程语言的构造函数中,允许在显式构造函数调用之前出现语句,即 super(..)
或 this(..)
。这些语句不能引用正在构造的实例,但可以初始化其字段。在调用另一个构造函数之前初始化字段使得类在方法被重写时更可靠。这是一个预览语言特性。