MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
jdk
Recherche

JDK 24: The new features in Java 24

mardi 1 octobre 2024, 17:54 , par InfoWorld
Java Development Kit (JDK) 23 having arrived September 17, work already has begun on JDK 24, with four features so far proposed for the release: a vector API, a class-file API, warnings to prepare developers for future restrictions on the use of JNI (Java Native Interface), and a late barrier expansion for the G1 garbage collector. A multitude of other features, including many already in preview in JDK 23, also are possible for inclusion.

Due March 18, 2025, JDK 24 has been designated a non-long-term support (LTS) release. Like just-released JDK 23, JDK 24 will receive only six months of Premier-level support from Oracle.

The latest feature proposed JDK 24 is the vector API. In what would be its ninth incubation, the vector API is designed to express vector communications that reliably compile at runtime to optimal vector instructions on supported CPU architectures, thus achieving performance superior to equivalent scalar computations.

This API previously was incubated in JDK 16 through JDK 23. It would be re-incubated in JDK 24 with no API changes and no substantial implementations relative to JDK 23. Goals of the proposal include clearly and concisely expressing a wide range of vector computations in an API that is platform-agnostic, that offers reliable runtime compilation and performance on x64 and AArch54 architectures, that degrades gracefully and still functions when a vector computation cannot be expressed at runtime, and that aligns with Project Valhalla, leveraging enhancements to the Java object model.

The first JDK 24-targeted feature, officially called “Prepare to Restrict the Use of JNI,” calls for issuing warnings about uses of JNI and adjusting the foreign function and memory (FFM) API, featured in JDK 22, to issue warnings in a consistent manner. These warnings are intended to prepare for a future release that ensures integrity by default by uniformly restricting JNI and the FFM API. Goals of the plan include preserving JNI as a standard way to interoperate with native code, preparing the Java ecosystem for future releases that disallow interoperation with native code by default, and aligning the use of JNI and the FFM API so library maintainers can migrate from one to the other without requiring developers to change command-line options.

The second feature, late barrier expansion for the G1 garbage collector, is intended to simplify the implementation of G1’s barriers. The G1 garbage collector’s barriers record information about application memory accesses, by shifting their expansion from early in the C2 compilation pipeline to later. Goals include reducing the execution time of C2 compilation when using the G1 collector, making G1 barriers comprehensible to HotSpot developers who lack a deep understanding of C2, and guaranteeing that C2 preserves invariants about the relative ordering of memory accesses, safepoints, and barriers. A fourth feature is preserving the quality of C2-generated JIT (just-in-time)-compiled code, in terms of speed and size.

A third feature, the class-file API, previously previewed in JDK 22 and JDK 23, would be finalized in JDK 24, with minor changes. This API provides a standard API for parsing, generating, and transforming Java class files. It aims to provide an API for processing class files that tracks the class file format defined by the Java Virtual Machine specification. A second goal is to enable JDK components to migrate to the standard API, and eventually remove the JDK’s internal copy of the third-party ASM library. Changes since the second preview include a renaming of enum values, removal of some fields, the addition of methods and method overloads, methods renamed, and removal of interfaces and methods deemed unnecessary.

Additional features targeting JDK 24 will be determined during the next several months. Potential Java 24 features include further previews or final releases of features being previewed in JDK 23. These include stream gatherers, to enhance the stream API for custom intermediate operations; module import declarations, for succinctly importing all packages exported by a module and simplifying reuse of modular libraries; structured concurrency, to simplify concurrent programming; scoped values, for sharing immutable data; and flexible constructor bodies, giving developers greater freedom to express behavior of constructors.

Another feature in preview in JDK 23 and a contender for JDK 24 is primitive types in patterns, instanceof, and switch, which aims to enhance pattern matching by allowing primitive type patterns in all pattern contexts, and to extend instanceof and switch to work with all primitive types. Ahead-of-time class loading, a feature designed to speed Java startups, and string templates, a feature previewed in JDK 21 and JDK 22 but dropped from JDK 23, could also be targeted to JDK 24.

The most-recent LTS release, JDK 21, arrived in September 2023 and is due to get at least five years of Premier support from Oracle. The next LTS version, JDK 25, is due in September 2025. LTS releases have dominated Java adoption, which means adoption of JDK 23 and JDK 24 could be on the low end as users await JDK 25.
https://www.infoworld.com/article/3491404/jdk-24-the-new-features-in-java-24.html

Voir aussi

News copyright owned by their original publishers | Copyright © 2004 - 2024 Zicos / 440Network
Date Actuelle
mer. 16 oct. - 16:20 CEST