• Tue. Oct 1st, 2024

JDK 24: The new features in Java 24

Byadmin

Oct 1, 2024



The second feature, late barrier expansion, is intended to simplify the implementation of G1’s barriers. The 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.

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.



Source link