JDK 24: The new features in Java 24
The primary JDK 24-targeted characteristic, formally known as “Put together to Limit the Use of JNI,” requires issuing warnings about makes use of of JNI and adjusting the international perform and reminiscence (FFM) API, featured in JDK 22, to difficulty warnings in a constant method. These warnings are meant to organize for a future launch that ensures integrity by default by uniformly limiting JNI and the FFM API. Targets of the plan embrace preserving JNI as an ordinary strategy to interoperate with native code, making ready the Java ecosystem for future releases that disallow interoperation with native code by default, and aligning the usage of JNI and the FFM API so library maintainers can migrate from one to the opposite with out requiring builders to vary command-line choices.
The second characteristic, late barrier growth for the G1 rubbish collector, is meant to simplify the implementation of G1’s boundaries. The G1 rubbish collector’s boundaries report details about software reminiscence accesses, by shifting their growth from early within the C2 compilation pipeline to later. Targets embrace decreasing the execution time of C2 compilation when utilizing the G1 collector, making G1 boundaries understandable to HotSpot builders who lack a deep understanding of C2, and guaranteeing that C2 preserves invariants in regards to the relative ordering of reminiscence accesses, safepoints, and boundaries. A fourth characteristic is preserving the standard of C2-generated JIT (just-in-time)-compiled code, when it comes to velocity and measurement.
A 3rd characteristic, the class-file API, beforehand previewed in JDK 22 and JDK 23, can be finalized in JDK 24, with minor modifications. This API gives an ordinary API for parsing, producing, and reworking Java class information. It goals to offer an API for processing class information that tracks the category file format outlined by the Java Digital Machine specification. A second purpose is to allow JDK parts emigrate to the usual API, and ultimately take away the JDK’s inside copy of the third-party ASM library. Adjustments for the reason that second preview embrace a renaming of enum values, removing of some fields, the addition of strategies and methodology overloads, strategies renamed, and removing of interfaces and strategies deemed pointless.