This article was originally published on IBM Developer by Alex Soto Bueno.
Java 25 was released on September 16, 2025. This version is important because it is an LTS (Long Term Support) version, the next one after Java 21. As an LTS release, it will receive a minimum of five years of support and updates/bug fixes.
This new version contains multiple enhancements, both for devs and for the runtime execution.
In this article, we'll focus on stable and preview features for developers. We won't cover incubator features as they will likely change in future releases. (The Vector API remains in the incubator stage for the tenth time, waiting for the release of Project Valhalla.)
Major features and enhancements
These are some of the most significant additions, changes, and previews in Java 25:
Feature | What it does |
---|---|
JEP 507: Primitive Types in Patterns, instanceof , and switch (Third Preview) |
You can use primitive types in pattern matching, instanceof , and switch constructs. |
JEP 511: Module Import Declarations | A module import lets you access every class from the packages that the module exports. |
JEP 512: Compact Source Files and Instance Main Methods | You can write a main method without needing to create a class. |
JEP 513: Flexible Constructor Bodies |
super and this statements do not have to be the first statement in a constructor. This is better, for example, for the argument validation. |
Scoped Values (JEP 506) | A simpler way to share immutable variables across a thread and its child threads. |
Key Derivation Function API (JEP 510) | Provides standard APIs in the JDK for deriving cryptographic keys (PBKDF2, Argon2, etc.). |
JEP 519: Compact Object Headers | Reduces the size of object headers (metadata per object) to make objects use less memory. |
JEP 521: Generational Shenandoah Garbage Collector | Makes the Shenandoah GC use a generational model (young/old generations), improving GC performance especially in startup or mixed-allocation programs. |
JFR Enhancements | Improvements to JDK Flight Recorder, like CPU-time profiling, cooperative sampling, method timing, and tracing. |
Stable Values (JEP 502, Preview) | Provides a mechanism to define values that are set once and then treated as constants by the JVM, allowing optimizations beyond what final fields offer. |
PEM Encodings for Cryptographic Objects (JEP 470, Preview) | Supports encoding and decoding cryptographic keys, certificates in PEM format. |
New stable features for developers
These include:
- Module import declarations
- Flexible constructor bodies
- Scoped values
- Key derivation function (KDF) API
Continue reading on IBM Developer to learn about the stable and preview features in this new LTS release of Java...
Top comments (0)