Java 24: Key Updates and Enhancements

developPPP

The upcoming release of Java Development Kit (JDK) 24 has reached the release candidate phase, bringing a wealth of new features and improvements. Scheduled for general availability on March 18, JDK 24 introduces significant advancements, including a refined class-file API, enhanced concurrency management, and strengthened security measures against quantum computing threats.

Milestones and Release Timeline

The first release candidate of JDK 24 was made available on February 6, following a structured rollout process. A second release candidate is expected on February 20, preceding the official launch in March. With 24 feature updates, this version significantly surpasses its predecessor, JDK 23, which introduced only 12 new features.

New and Noteworthy Features

JDK 24 brings a diverse range of improvements spanning various aspects of the Java ecosystem:

Concurrency and Performance Enhancements

  • Structured Concurrency (Fourth Preview): Aims to simplify multithreading by treating groups of related tasks as a single unit, enhancing error handling, reliability, and observability.
  • Ahead-of-Time Class Loading and Linking: Designed to improve application startup times by preloading and linking classes based on prior execution.
  • Synchronizing Virtual Threads Without Pinning: Increases scalability by allowing virtual threads to release platform threads during synchronization.

Security and Cryptography Improvements

  • Quantum-Resistant Cryptography: Implements module-lattice-based key encapsulation (ML-KEM) and digital signature (ML-DSA) algorithms to safeguard against future quantum computing threats.
  • Key Derivation Function (KDF) API: Introduces an API for cryptographic key derivation, supporting widely used methods like HMAC and Argon2.
  • Deprecation of 32-bit x86 Support: Phasing out 32-bit x86 architecture support, with the last remaining Linux 32-bit x86 port marked for removal.

Garbage Collection and Memory Management

  • Generational Shenandoah Garbage Collector: Enhances memory management efficiency by introducing a generational approach to garbage collection.
  • ZGC Non-Generational Mode Removal: Streamlines garbage collection by eliminating non-generational mode, allowing future improvements to focus solely on generational strategies.

Language and Runtime Enhancements

  • Flexible Constructor Bodies (Third Preview): Refines object instantiation by allowing pre- and post-superclass initialization logic.
  • Primitive Types in Patterns and Switch Statements: Expands pattern matching to include primitive types, enhancing uniformity and eliminating unsafe casting risks.
  • Module Import Declarations (Second Preview): Simplifies the reuse of modular libraries without requiring a module-based structure.

Developer-Focused Improvements

  • Stream Gatherers: Provides a new API to enable more flexible intermediate operations within stream pipelines.
  • Class-File API (Finalized): Introduces a standardized API for parsing, generating, and modifying Java class files, replacing reliance on third-party libraries.
  • Permanent Security Manager Removal: Concludes the deprecation process by fully disabling the Java Security Manager, which has seen limited usage in recent years.

Implications for the Java Ecosystem

JDK 24 is designated as a non-long-term support (non-LTS) release, mirroring JDK 23’s lifecycle. Oracle will provide premier support for six months, with JDK 25, an LTS release, set to follow in September 2024.

For developers eager to explore JDK 24, early access builds are available at jdk.java.net. With a focus on performance, security, and developer ergonomics, JDK 24 is set to further solidify Java’s position as a leading programming language in modern software development.