Although Java Development Kit (JDK) 25 is still a few months away, slated for release in September, the first exciting feature proposal has already emerged. A preview of a stable values API is on the horizon, aiming to improve the startup performance of Java applications. This new API introduces the concept of “stable values,” which are immutable objects treated by the JVM as constants. The benefit of this is that stable values can leverage the same performance optimizations typically available for final fields, offering significant improvements in the initialization process.
The stable values API promises several advantages beyond just faster application startup. It allows for the decoupling of stable value creation from their initialization, all without incurring major performance penalties. This gives developers greater flexibility, as stable values will be initialized only once, helping optimize resource usage and application state management. Additionally, these stable values will be able to benefit from constant-folding optimizations, which were previously reserved for JDK-internal code, ensuring that user code can also reap the performance rewards.
While JDK 25 is expected to bring the stable values API, it’s important to note that JDK 24 will be released first, on March 18, featuring 24 new enhancements. JDK 25, however, will be a major milestone as it will be the first long-term support (LTS) release of standard Java since JDK 21, which arrived in September 2023. LTS releases, like JDK 25, receive extended support, making them a crucial choice for enterprises seeking stability and longevity in their Java applications.
In addition to the stable values API, JDK 25 might also include other exciting features currently being previewed in JDK 24, such as key derivation functions, scoped values, structured concurrency, and flexible constructor bodies. These features promise to continue the evolution of Java, enhancing both its flexibility and performance for modern application needs.