Fundamentals 6 min read

JDK 24 Preview: JNI Warnings, G1 Barrier Extensions, and Class File API Explained

JDK 24, slated for a March 2025 release as a non‑LTS version, introduces JNI usage warnings, a G1 garbage‑collector post‑barrier extension, a finalized Class File API, and several potential enhancements, while offering six months of premium support following the recent JDK 23 launch.

21CTO
21CTO
21CTO
JDK 24 Preview: JNI Warnings, G1 Barrier Extensions, and Class File API Explained

Release Overview

JDK 24 is slated for release on March 18 2025 as a non‑LTS version, following JDK 23 released on 17 September. Oracle will provide six months of premium support, similar to the previous release.

Feature 1: JNI Usage Warning

Oracle proposes a warning mechanism that alerts developers when using the Java Native Interface (JNI) and restricts unsafe usage. The warning aligns the external function and memory (FFM) API introduced in JDK 22, aiming to standardise JNI usage and prepare future versions where native interop may be disabled by default.

Feature 2: G1 Garbage‑Collector Barrier Extension

The G1 GC receives a post‑barrier extension that moves barrier recording from the early C2 compilation pipeline to a later stage, reducing the impact on C2‑compiled code and helping developers understand G1 barriers without deep C2 knowledge. The goal is to preserve ordering invariants of memory accesses, safepoints and barriers.

Feature 3: Class File API

The previously previewed Class File API, introduced in JDK 22/23, becomes final in JDK 24 with minor changes. It offers a standard way to parse, generate and transform Java class files, tracking the class‑file format defined by the JVM specification and allowing migration away from the internal ASM copy.

Other Potential Features

Future additions may include stream collectors for custom intermediate operations, module‑import declarations, structured concurrency, value types for immutable data sharing, flexible constructor bodies, and enhancements to pattern matching (primitive type patterns, instanceof, switch) as well as a possible Vector API and accelerated class loading.

Support Timeline

JDK 21, the latest LTS release, was launched in September 2023 and will receive at least five years of Premier support. JDK 25 is planned as the next LTS in September 2025, meaning adoption of JDK 23 and JDK 24 may be limited until the next LTS arrives.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaJava developmentJNIJDK 24Class File APIG1 Garbage Collector
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.