JDK 24 Explained In 5 Minutes
JDK 24 has been released, bringing a host of significant changes. This article breaks down the major updates from this landmark six-month release, which includes over 20+ Java Enhancement Proposals (JEPs).
Finalized Features
Two major additions have been finalized in JDK 24.
- JEP 484: Class-File API: This feature finalizes the Class-File API. While most developers won't interact with it directly, this API is designed to simplify the process of upgrading to future JDK versions beyond 24.
- JEP 485: Stream Gatherers: This finalized feature is one that developers will find immediately useful. Gatherers introduce a new intermediate operation for Streams, offering considerable freedom in transforming data as it flows through the gatherer.
Runtime Updates
There are also five important runtime updates that enhance performance and functionality.
- JEP 475: Late Barrier Expansion for G1: This technical enhancement changes how the C2 compiler handles G1's write barriers. The result is an expected 10-20% reduction in overhead for C2 compilation, improving performance.
- JEP 483: Ahead-of-Time Class Loading & Linking: As the first feature from Project Leyden, this JEP introduces capabilities for ahead-of-time class loading and linking, which can improve startup performance.
- JEP 491: Synchronize Virtual Threads without Pinning: This addresses a key issue where virtual threads would not unmount when performing a blocking operation inside a synchronized block. This problem was notably highlighted in a Netflix blog article in June 2024.
- JEP 493: Linking Run-Time Images without JMODs: This change helps reduce the size of the JDK by allowing distributions to be shipped without the
jmod
files. However, not all JDK distributions will adopt this, so you'll need to verify with your specific provider. - JEPs 496 & 497: Quantum-Resistant Cryptography: These JEPs introduce a Quantum-Resistant Module-Lattice-Based Key Encapsulation Mechanism (ML-KEM) and a Digital Signature Algorithm, preparing Java for the era of quantum computing.
Deprecations and Removals
Several features are being deprecated or removed in JDK 24 to modernize the platform.
- JEP 472: Prepare to Restrict the Use of JNI: The title is slightly misleading, as this also applies to the new FFM API. The goal is to prevent risky behaviors when interfacing with native code, aligning with the "Integrity by Default" principle.
- JEP 479: Remove the Windows 32-bit x86 Port: As the name implies, the port for Windows 32-bit x86 systems has been removed.
- JEP 501: Deprecate the 32-bit x86 Port for Removal: Following the removal of the Windows port, this JEP deprecates the 32-bit x86 port for Linux, which is the last remaining 32-bit x86 version.
- JEP 486: Permanently Disable the Security Manager: This JEP does exactly what it says—the Security Manager is now permanently disabled. For more details, it is recommended to read the JEP itself.
- JEP 490: Remove the non-generational ZGC Mode: After Generational ZGC was introduced in JDK 21 and made the default in JDK 23, this JEP completes the migration by removing the old non-generational mode.
- JEP 498: Warn upon Use of Memory-Access Methods in
sun.misc.Unsafe
: A warning will now be issued the first time a memory-access method insun.misc.Unsafe
is used. Developers should migrate to the existing alternatives.
Preview & Incubator Features
There are numerous JEPs previewing or incubating a feature.
- JEP 478: Key Derivation Function API (Preview): This preview feature can be used to create shared cryptographic keys between two parties.
- JEP 487: Scoped Values (Fourth Preview): This feature is in its fourth preview, hopefully for the final time.
- JEP 488: Primitive Types in Patterns (Second Preview): This allows primitive types (
int
,boolean
,byte
,long
, etc.) to be used in pattern matching without being wrapped in a reference type. No changes were made in this preview round. - JEP 492: Flexible Constructor Bodies (Third Preview): This feature allows statements to appear before a call to
super()
orthis()
in a constructor. No significant changes were included in this preview. - JEP 494: Module Import Declarations (Second Preview): This feature allows for importing all of a module's exported packages with a single line. Some minor changes were made in this preview. For example:
java import module java.sql;
- JEP 495: Simple Source Files and Instance Main Methods (Fourth Preview): Part of the "paving the on-ramp" initiative to make Java more approachable, this feature is intended to be finalized in JDK 25.
- JEP 499: Structured Concurrency API (Re-preview): This API is re-previewed, with a major update expected in JDK 25.
- JEP 489: Vector API (Ninth Incubator): The Vector API enters its ninth incubator phase, where it will remain pending the promotion of features from Project Valhalla.
Experimental Features
Finally, there are a couple of experimental features introduced in JDK 24.
- JEP 404: Generational Shenandoah GC: This introduces a generational mode for the Shenandoah garbage collector, which will be included in the Red Hat OpenJDK distribution.
- JEP 450: Compact Object Headers: As part of Project Lilliput, this experimental feature aims to reduce the memory footprint of Java objects.
That covers all the major changes in the JDK 24 release.
Join the 10xdev Community
Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.