S E L L C O R P

Java Development Kit 24: Key Updates and Anticipated Features -

Java Development Kit 24: Key Updates and Anticipated Features

October 7, 2024 Garnet Comments Off

Following the release of Java Development Kit (JDK) 23 in September, work has rapidly begun on JDK 24, which is set to be released on March 18, 2025. This upcoming release is not considered a long-term support (LTS) version, and will, like JDK 23, receive only six months of premier support from Oracle. While only a few features have been confirmed so far, several others, including those currently in preview in JDK 23, are expected to be considered for inclusion.

Initial Features Targeted for JDK 24

The first confirmed feature for JDK 24 is a new warning system aimed at developers using the Java Native Interface (JNI). This feature, titled Prepare to Restrict the Use of JNI, will generate warnings whenever unsafe uses of JNI are detected, aligning with future plans to restrict its usage by default. This change is designed to help the Java community transition away from using JNI for interoperation with native code and towards the Foreign Function and Memory (FFM) API, which was introduced in JDK 22. One of the main goals of this initiative is to maintain JNI as a standard for working with native code, while ensuring that future versions of Java limit native code interaction by default unless explicitly authorized.

Another significant addition involves an improvement to the G1 garbage collector. This enhancement, called Late Barrier Expansion, is focused on improving the G1 garbage collector’s performance by optimizing how memory barriers are handled during compilation. By shifting the expansion of these barriers to a later stage in the C2 compiler pipeline, the feature aims to reduce the compilation time and simplify barrier code for developers who may not have in-depth knowledge of the C2 compiler’s internals.

Finally, the Class-File API, which was introduced in preview stages in both JDK 22 and JDK 23, will be finalized in JDK 24 with several adjustments. This API provides a standardized way for parsing, creating, and transforming Java class files. It is designed to conform to the class file format defined by the Java Virtual Machine (JVM) specification, enabling JDK components to transition to this new standard and gradually phase out the internal use of the third-party ASM library. Minor updates include renaming enums, adding new methods, and removing interfaces and methods that are no longer necessary.

Potential Features for JDK 24

In addition to the confirmed updates, a number of features currently in preview in JDK 23 may be finalized in JDK 24. These include enhancements to the Stream API, which would allow developers to implement custom intermediate stream operations through the use of stream gatherers. Another potential feature is the introduction of Module Import Declarations, designed to simplify the import process by enabling all packages exported by a module to be imported with a single declaration, making reuse of modular libraries easier.

Structured Concurrency is another highly anticipated feature that could make its debut in JDK 24. This feature aims to streamline concurrent programming by introducing new tools for managing multiple threads of execution in a structured manner. The concept of Scoped Values, which would allow for the sharing of immutable data across threads in a safe and efficient way, is also under consideration.

A notable improvement could come in the form of Primitive Type Patterns for pattern matching, extending the capabilities of the instanceof operator and switch statements to handle all primitive types. Additionally, the Vector API, which has been through several stages of incubation, could be further refined in JDK 24 to allow developers to execute vectorized computations more efficiently across various CPU architectures.

Another possible inclusion is Ahead-of-Time Class Loading, which is aimed at speeding up Java application startup times by loading classes before runtime. Lastly, String Templates, which were previewed in earlier versions but dropped from JDK 23, may return in JDK 24 to provide developers with a more flexible and efficient way of constructing strings.

The Road Ahead for Java

While JDK 24 is expected to bring a range of new features and improvements, it is not a long-term support release. This means that its adoption may be limited, as many developers and organizations prefer to wait for LTS versions due to their extended support periods. JDK 21, the most recent LTS version, was released in September 2023 and will be supported for at least five years. JDK 25, the next LTS release, is expected in September 2025, and many users may choose to hold off on upgrading until that version becomes available.

In conclusion, while JDK 24 may not have the same widespread adoption as an LTS release, it promises several important updates that will improve performance, security, and ease of development. Developers are encouraged to begin testing the preview features in JDK 23 in preparation for what’s to come in JDK 24.