JDK 22 新特性概览
JEP 423: Region Pinning for G1
Reduce latency by implementing region pinning in G1, so that garbage collection need not be disabled during Java Native Interface (JNI) critical regions.
JEP 423: G1的区域固定
通过在G1中实现区域固定来减少延迟,从而在Java本地接口(JNI)关键区域期间不需要禁用垃圾收集。
JEP 447: Statements before super(...) (Preview)
In constructors in the Java programming language, allow statements that do not reference the instance being created to appear before an explicit constructor invocation. This is a preview language feature.
JEP 447: super(...) 前的语句 (预览)
在Java编程语言的构造函数中,允许不引用正在创建的实例的语句出现在显式构造函数调用之前。这是一个预览语言特性。
JEP 454: Foreign Function & Memory API
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.
JEP 454: 外部函数与内存API
引入一个API,使Java程序能够与Java运行时之外的代码和数据进行交互。通过高效地调用外部函数(即JVM外的代码)和安全地访问外部内存(即JVM未管理的内存),该API使Java程序能够调用本地库并处理本地数据,而无需JNI的脆弱性和危险性。
JEP 456: Unnamed Variables & Patterns
Enhance the Java programming language with unnamed variables and unnamed patterns, which can be used when variable declarations or nested patterns are required but never used. Both are denoted by the underscore character, _
.
JEP 456: 无名变量与模式
增强Java编程语言,支持无名变量和无名模式,这些在需要变量声明或嵌套模式但从未使用时可以使用。两者均用下划线字符_
表示。
JEP 457: Class-File API (Preview)
Provide a standard API for parsing, generating, and transforming Java class files. This is a preview API.
JEP 457: 类文件API(预览)
提供一个标准API,用于解析、生成和转换Java类文件。这是一个预览API。
JEP 458: Launch Multi-File Source-Code Programs
Enhance the java
application launcher to be able to run a program supplied as multiple files of Java source code. This will make the transition from small programs to larger ones more gradual, enabling developers to choose whether and when to go to the trouble of configuring a build tool.
JEP 458: 启动多文件源代码程序
增强 java
应用程序启动器,使其能够运行作为多个 Java 源代码文件提供的程序。这将使从小程序到大程序的过渡更加渐进,使开发人员能够选择何时以及是否去配置构建工具。
JEP 459: String Templates (Second 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 459: 字符串模板(第二次预览)
通过引入 字符串模板 来增强 Java 编程语言。字符串模板通过将文字文本与嵌入的表达式和 模板处理器 结合,补充了 Java 现有的字符串字面量和文本块,以生成专业化的结果。这是一个 预览语言特性和 API。
JEP 460: Vector API (Seventh 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 460: 向量API(第七次孵化)
引入一个API,用于表达向量计算,该计算在运行时可靠地编译为支持的CPU架构上的最佳向量指令,从而实现比等效标量计算更优越的性能。
JEP 461: Stream Gatherers (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 461: 流收集器 (预览)
增强 Stream API 以支持自定义中间操作。这将允许流管道以现有内置中间操作难以实现的方式转换数据。这是一个 预览 API。
JEP 462: Structured Concurrency (Second 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 462: 结构化并发(第二次预览)
通过引入一个用于_结构化并发_的API来简化并发编程。结构化并发将不同线程中运行的相关任务组视为一个单一的工作单元,从而简化错误处理和取消操作,提高可靠性,并增强可观察性。这是一个预览API。
JEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview)
Evolve the Java programming 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 the language, 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 463: 隐式声明类和实例主方法(第二次预览)
发展Java编程语言,使学生能够编写他们的第一个程序,而无需理解为大型程序设计的语言特性。学生可以编写简化的单类程序声明,然后随着技能的提高,顺利扩展他们的程序以使用更高级的特性,而不必使用语言的单独方言。这是一个预览语言特性。
JEP 464: Scoped Values (Second Preview)
Introduce scoped values, which enable managed sharing of immutable data both with child frames in the same thread, and with child threads. Scoped values are easier to reason about than thread-local variables and have lower space and time costs, especially when used in combination with Virtual Threads and Structured Concurrency. This is a preview API.