Java 25: The LTS That Graduates Four Years of Previews
Why Java 25 Matters
Java 25 was released on September 16, 2025 — exactly two years after Java 21, following the cadence Oracle committed to when it moved to a two-year LTS cycle.
But Java 25 is not just “Java 21 with more stuff”. It is the release where four years of preview work finally becomes production API. Features that Java developers have been testing since Java 21 — Scoped Values, Flexible Constructor Bodies, Module Import Declarations, Compact Source Files — all graduate to final status. Alongside them, the performance story gets dramatically better: Compact Object Headers, Generational Shenandoah, and a completely revamped AOT compilation pipeline.
If your team is on Java 21, Java 25 is the natural next migration. If you are still on Java 17, Java 11, or Java 8, Java 25 LTS is now the strongest reason yet to modernize.
The Java Release Timeline
Java 8 (Mar 2014) — LTS [8+ years mainstream use]
Java 11 (Sep 2018) — LTS [still widely deployed]
Java 17 (Sep 2021) — LTS [current minimum for Spring Boot 3]
Java 21 (Sep 2023) — LTS [Virtual Threads, Pattern Matching]
Java 25 (Sep 2025) — LTS ← You are here
Starting with Java 17, Oracle moved to a 2-year LTS cadence (every 4th release). Java 25 is the 4th LTS since Java 17.
Java 25 at a Glance: All 18 JEPs
Finalized Features (graduating from preview/incubator)
| JEP | Feature | Previous Status |
|---|---|---|
| 506 | Scoped Values | Preview since Java 20 |
| 510 | Key Derivation Function API | Preview in Java 24 |
| 511 | Module Import Declarations | Preview since Java 23 |
| 512 | Compact Source Files & Instance Main Methods | Preview since Java 21 |
| 513 | Flexible Constructor Bodies | Preview since Java 22 |
| 516 | Generational Shenandoah | Experimental |
| 519 | Compact Object Headers | Experimental |
Preview Features (still evolving)
| JEP | Feature | Preview Round |
|---|---|---|
| 502 | Stable Values | 1st Preview |
| 505 | Structured Concurrency | 5th Preview |
| 507 | Primitive Types in Patterns | 3rd Preview |
| 470 | PEM Encodings of Cryptographic Objects | 1st Preview |
Performance & Runtime
| JEP | Feature |
|---|---|
| 509 | JFR CPU-Time Profiling |
| 514 | Ahead-of-Time Command-Line Ergonomics |
| 515 | Ahead-of-Time Method Profiling |
| 520 | JFR Method Timing & Tracing |
What Changed Since Java 21?
Language
The biggest language graduation is Flexible Constructor Bodies (JEP 513) — you can now write validation logic before calling super(). This sounds minor but eliminates a painful class of constructor anti-patterns.
Module Import Declarations (JEP 511) kills the wall of import statements. Instead of 15 individual imports, you write import module java.base; and get everything exported by that module.
Compact Source Files (JEP 512) means a Hello.java no longer needs a class declaration, a public static void main, or anything other than the code itself. This is not just for teaching — it unlocks Java as a scripting language.
Concurrency
Scoped Values (JEP 506) is now final. If you adopted ThreadLocal to pass context through call chains (logging correlation IDs, user sessions, tenant IDs), Scoped Values is the modern replacement: immutable, thread-safe, and designed for virtual threads. This works seamlessly with the Virtual Threads that graduated in Java 21.
Performance
Compact Object Headers (JEP 519) reduces every Java object’s header from 96–128 bits to 64 bits. On workloads with millions of small objects (microservices, data pipelines), this alone can cut heap usage by 10–20%.
Generational Shenandoah (JEP 516) brings the generational GC strategy (track young vs. old objects separately) to the Shenandoah collector — the same strategy that already improved ZGC in Java 21.
AOT Compilation (JEP 514 + 515) is the most ambitious addition: profile application startup once, store the profile, and use it on subsequent runs to skip JIT warm-up. Startup latency drops dramatically — especially relevant for serverless and containerized deployments.
Feature Readiness Guide
Use this table to decide what to adopt on day one vs. what to wait on:
| Feature | Adopt Now? | Notes |
|---|---|---|
| Flexible Constructor Bodies | ✅ Yes | Final, pure upside |
| Module Import Declarations | ✅ Yes | Final, saves boilerplate |
| Compact Source Files | ✅ Yes | Great for scripts/demos |
| Scoped Values | ✅ Yes | Final, replace ThreadLocal |
| Compact Object Headers | ✅ Yes | JVM flag, zero code change |
| Generational Shenandoah | ✅ Yes | JVM flag, zero code change |
| Primitive Patterns (JEP 507) | ⚠️ Preview | Needs --enable-preview |
| Structured Concurrency | ⚠️ Preview | Still evolving API |
| Stable Values | ⚠️ Preview | Brand new, incubating |
| AOT Compilation | 🧪 Evaluate | Tooling still maturing |
What This Series Covers
This 12-part series walks through every major Java 25 feature with runnable code, before/after comparisons, and real-world use cases. Here is the full roadmap:
| # | Article |
|---|---|
| 1 | Java 25 Overview ← you are here |
| 2 | Setting Up Java 25 |
| 3 | Flexible Constructor Bodies |
| 4 | Module Import Declarations |
| 5 | Compact Source Files & Instance Main Methods |
| 6 | Primitive Types in Patterns |
| 7 | Scoped Values |
| 8 | Structured Concurrency |
| 9 | Compact Object Headers |
| 10 | Generational Shenandoah |
| 11 | AOT Compilation |
| 12 | Security: KDF API & PEM Encodings |
Next up: Setting Up Java 25 →