Java 25: the next LTS era begins

Java 25: the next LTS era begins

The release of Java 25 (JDK 25) on September 16, 2025, marks a massive milestone for the ecosystem. As the newest Long-Term Support (LTS) version—succeeding Java 21—it is the version that most enterprises will call home for the next several years.

This release isn't just about maintenance; it's the culmination of several multi-year projects like Loom, Amber, and Leyden, bringing stabilized features that fundamentally change how we write and deploy Java.


1. Developer productivity: finalized language features

Several features that have been in "preview" for multiple versions are now officially part of the Java standard.

Flexible constructor bodies (JEP 513)

Java has finally relaxed the "super() must be first" rule. You can now perform validation or logic before calling the super constructor, as long as you don't access the instance (this) yet.

public class User extends Person {
    public User(String email) {
        // Now allowed! Validate before calling super
        if (!email.contains("@")) throw new IllegalArgumentException();
        super(email); 
    }
}

Module import declarations (JEP 511)

Instead of a wall of 20 import statements, you can now import an entire module's exported packages with a single line. This significantly cleans up the header of your files.

  • Example: import module java.base;

Compact source files (JEP 512)

Designed to make Java more "script-friendly" and beginner-accessible, you can now write and run code without an explicit class wrapper or public static void main boilerplate.


2. Performance: Project Leyden & Memory Optimization

Performance in Java 25 moves from "runtime tuning" to "build-time intelligence."

Compact Object Headers (JEP 519)

One of the most impactful changes under the hood is the reduction of object header sizes from 96–128 bits down to just 64 bits.

  • The Impact: Early benchmarks show up to 20% reduction in heap usage and roughly 10% faster execution for memory-intensive applications. It’s essentially a free performance upgrade just by switching versions.

Ahead-of-Time (AOT) improvements

Java 25 integrates more of Project Leyden, specifically in application warmup.

  • AOT method profiling: The JVM can now save profiling data from one run and use it to instantly optimize the next run. This eliminates the "warmup period" where applications are slow immediately after a restart—a huge win for serverless and Kubernetes deployments.

3. Concurrency: the finalization of Scoped Values

While Virtual Threads (Project Loom) arrived in Java 21, Java 25 brings the tools needed to manage them safely at scale.

Scoped Values (JEP 506)

ThreadLocal has long been the standard for sharing data (like security contexts) across a thread, but it is heavy and risky with millions of virtual threads. Scoped Values are the modern replacement:

  • Immutable: Once set, the value cannot be changed within that scope.
  • Bounded: The data is automatically cleared once the execution leaves the defined scope, preventing memory leaks.
  • Efficient: Specifically designed to be lightweight enough for use with virtual threads.

4. Modern Garbage Collection: generational Shenandoah

The Shenandoah GC has been upgraded with a Generational mode (JEP 521). By separating objects into "young" and "old" generations, Shenandoah can now collect short-lived objects more frequently without scanning the entire heap. This provides the low-latency benefits of Shenandoah with the throughput efficiency traditionally seen in G1.


Summary of Major Features

FeatureJEPStatusCategory
Compact Object Headers519FinalPerformance / Memory
Flexible Constructor Bodies513FinalLanguage Syntax
Scoped Values506FinalConcurrency
Module Import Declarations511FinalProductivity
Generational Shenandoah521FinalGarbage Collection
Stable Values502PreviewOptimization

Next steps

Since Java 25 is an LTS release, it is the ideal target for anyone currently on Java 11 or 17. The memory savings from Compact Object Headers alone often justify the migration cost for high-scale cloud environments.