JDK 21 新特性概览
JEP 430: String Templates (Preview)
Enhance the Java programming language with string templates. String templates complement Java's existing string literals and text blocks by coupling literal text with embedded expressions and template processors to produce specialized results. This is a preview language feature and API.
JEP 430: 字符串模板 (预览)
增强Java编程语言,加入_字符串模板_。字符串模板通过结合字面文本、嵌入表达式和_模板处理器_来生成特定结果,从而补充了Java现有的字符串字面量和文本块。这是一个预览语言特性和API。
JEP 431: Sequenced Collections
Introduce new interfaces to represent collections with a defined encounter order. Each such collection has a well-defined first element, second element, and so forth, up to the last element. It also provides uniform APIs for accessing its first and last elements, and for processing its elements in reverse order.
JEP 431: 序列化集合
引入新的接口来表示具有定义的遇见顺序的集合。每个这样的集合都有一个明确定义的第一个元素、第二个元素,依此类推,直到最后一个元素。它还提供了统一的API来访问其第一个和最后一个元素,并以相反的顺序处理其元素。
JEP 439: Generational ZGC
Improve application performance by extending the Z Garbage Collector (ZGC) to maintain separate generations for young and old objects. This will allow ZGC to collect young objects — which tend to die young — more frequently.
JEP 440: Record Patterns
Enhance the Java programming language with record patterns to deconstruct record values. Record patterns and type patterns can be nested to enable a powerful, declarative, and composable form of data navigation and processing.
JEP 440: 记录模式
增强Java编程语言,使用_记录模式_来解构记录值。记录模式和类型模式可以嵌套,以实现一种强大、声明式和可组合的数据导航和处理形式。
JEP 441: Pattern Matching for switch
Enhance the Java programming language with pattern matching for switch
expressions and statements. Extending pattern matching to switch
allows an expression to be tested against a number of patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely.
JEP 441: switch的模式匹配
通过为switch
表达式和语句增加模式匹配功能来增强Java编程语言。将模式匹配扩展到switch
允许表达式针对多个模式进行测试,每个模式都有特定的操作,从而可以简洁而安全地表达复杂的数据导向查询。
JEP 442: Foreign Function & Memory API (Third Preview)
Introduce an API by which Java programs can interoperate with code and data outside of the Java runtime. By efficiently invoking foreign functions (i.e., code outside the JVM), and by safely accessing foreign memory (i.e., memory not managed by the JVM), the API enables Java programs to call native libraries and process native data without the brittleness and danger of JNI. This is a preview API.
JEP 442: Foreign Function & Memory API(第三次预览)
引入一个API,使Java程序能够与Java运行时之外的代码和数据进行互操作。通过高效调用外部函数(即JVM之外的代码)以及安全访问外部内存(即不由JVM管理的内存),该API使Java程序能够调用本地库并处理本地数据,而无需JNI的脆弱性和危险性。这是一个预览API。
JEP 443: Unnamed Patterns and Variables (Preview)
Enhance the Java language with unnamed patterns, which match a record component without stating the component's name or type, and unnamed variables, which can be initialized but not used. Both are denoted by an underscore character, _
. This is a preview language feature.
JEP 443: 未命名模式和变量(预览)
通过未命名模式增强Java语言,这些模式可以匹配记录组件而无需声明组件的名称或类型;以及未命名变量,这些变量可以被初始化但不能被使用。两者都用下划线字符_
表示。这是一个预览语言特性。
JEP 444: Virtual Threads
Introduce virtual threads to the Java Platform. Virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications.
JEP 444: 虚拟线程
引入虚拟线程到Java平台。虚拟线程是轻量级线程,大大减少了编写、维护和观察高吞吐量并发应用程序的工作量。
JEP 445: Unnamed Classes and Instance Main Methods (Preview)
Evolve the Java language so that students can write their first programs without needing to understand language features designed for large programs. Far from using a separate dialect of Java, students can write streamlined declarations for single-class programs and then seamlessly expand their programs to use more advanced features as their skills grow. This is a preview language feature.
JEP 445: 未命名类和实例主方法(预览)
发展Java语言,使学生能够在不需要理解为大型程序设计的语言特性情况下编写他们的第一个程序。学生可以编写单类程序的简化声明,然后随着技能的提高,无缝地扩展他们的程序以使用更高级的特性。这是一个预览语言特性。
JEP 446: Scoped Values (Preview)
Introduce scoped values, values that may be safely and efficiently shared to methods without using method parameters. They are preferred to thread-local variables, especially when using large numbers of virtual threads. This is a preview API.
JEP 446: 作用域值(预览)
引入_作用域值_,这些值可以在不使用方法参数的情况下安全且高效地共享给方法。尤其是在使用大量虚拟线程时,作用域值优于线程局部变量。这是一个预览API。
JEP 448: Vector API (Sixth 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 448: 向量API(第六次孵化)
引入一个API,用于表达向量计算,该API在运行时能够可靠地编译为支持的CPU架构上的最佳向量指令,从而实现优于等效标量计算的性能。
JEP 449: Deprecate the Windows 32-bit x86 Port for Removal
Deprecate the Windows 32-bit x86 port, with the intent to remove it in a future release.
JEP 449: 弃用Windows 32位x86端口以便移除
弃用Windows 32位x86端口,计划在未来的版本中将其移除。
JEP 451: Prepare to Disallow the Dynamic Loading of Agents
Issue warnings when agents are loaded dynamically into a running JVM. These warnings aim to prepare users for a future release which disallows the dynamic loading of agents by default in order to improve integrity by default. Serviceability tools that load agents at startup will not cause warnings to be issued in any release.
JEP 451: 准备禁止动态加载代理
当代理动态加载到正在运行的JVM中时,发出警告。这些警告旨在为未来的版本做准备,该版本默认禁止动态加载代理,以便默认提高完整性。在启动时加载代理的可服务性工具不会在任何版本中导致警告。
JEP 452: Key Encapsulation Mechanism API
Introduce an API for key encapsulation mechanisms (KEMs), an encryption technique for securing symmetric keys using public key cryptography.
JEP 452: 密钥封装机制API
引入密钥封装机制(KEMs)的API,这是一种使用公钥加密技术来保护对称密钥的加密技术。
JEP 453: Structured Concurrency (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 453: 结构化并发(预览)
通过引入_结构化并发_的API来简化并发编程。结构化并发将运行在不同线程中的相关任务组视为一个单一的工作单元,从而简化错误处理和取消操作,提高可靠性,并增强可观察性。这是一个预览API。