Cloud

JDK 24 preps for restrictions on JNI use



With Java Development Kit (JDK) 23 due to arrive September 17, work already has begun on JDK 24, with the first feature, restricting the use of JNI (Java Native Interface), targeted for the release. A multitude of other features, including many already in preview in JDK 23, also are possible for inclusion.

Likely to arrive in March 2025, JDK 24 has been designated as non-long-term support (LTS) release, meaning that like JDK 23, it will only get six months of Premier-level support from Oracle.

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.

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 the class-file API, for parsing, generating, and transforming Java class files; 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. Another possible JDK 24 feature is the vector API, now in an eighth incubation stage in JDK 23. The vector API is geared to expressing vector computations that reliably express at runtime to optimal vector instructions on supported CPU architectures. 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.



READ SOURCE

This website uses cookies. By continuing to use this site, you accept our use of cookies.