Part 1 of 12

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)

JEPFeaturePrevious Status
506Scoped ValuesPreview since Java 20
510Key Derivation Function APIPreview in Java 24
511Module Import DeclarationsPreview since Java 23
512Compact Source Files & Instance Main MethodsPreview since Java 21
513Flexible Constructor BodiesPreview since Java 22
516Generational ShenandoahExperimental
519Compact Object HeadersExperimental

Preview Features (still evolving)

JEPFeaturePreview Round
502Stable Values1st Preview
505Structured Concurrency5th Preview
507Primitive Types in Patterns3rd Preview
470PEM Encodings of Cryptographic Objects1st Preview

Performance & Runtime

JEPFeature
509JFR CPU-Time Profiling
514Ahead-of-Time Command-Line Ergonomics
515Ahead-of-Time Method Profiling
520JFR 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:

FeatureAdopt Now?Notes
Flexible Constructor Bodies✅ YesFinal, pure upside
Module Import Declarations✅ YesFinal, saves boilerplate
Compact Source Files✅ YesGreat for scripts/demos
Scoped Values✅ YesFinal, replace ThreadLocal
Compact Object Headers✅ YesJVM flag, zero code change
Generational Shenandoah✅ YesJVM flag, zero code change
Primitive Patterns (JEP 507)⚠️ PreviewNeeds --enable-preview
Structured Concurrency⚠️ PreviewStill evolving API
Stable Values⚠️ PreviewBrand new, incubating
AOT Compilation🧪 EvaluateTooling 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
1Java 25 Overview ← you are here
2Setting Up Java 25
3Flexible Constructor Bodies
4Module Import Declarations
5Compact Source Files & Instance Main Methods
6Primitive Types in Patterns
7Scoped Values
8Structured Concurrency
9Compact Object Headers
10Generational Shenandoah
11AOT Compilation
12Security: KDF API & PEM Encodings

Next up: Setting Up Java 25 →