Dev

JDK 25 kicks off with a stable values API



While Java Development Kit 25 is not set to arrive until September, the first feature already has been proposed for it — a preview of a stable values API that promises to improve startup of Java applications.

Stable values are objects that hold immutable data. Because stable values are treated as constants by the JVM, they allow for the same performance optimizations that are enabled by declaring a field final. At the same time, they offer greater flexibility as to the timing of initialization. Thus they could be used to improve the startup of Java applications by breaking up the monolithic initialization of application state.

In addition to boosting application startup, the API would offer the following: decoupling creation of stable values from their initialization without big performance penalties, guaranteeing that stable values are initialized at most once, and enabling user code to enjoy constant-folding optimizations previously available only to JDK-internal code.



READ SOURCE

This website uses cookies. By continuing to use this site, you accept our use of cookies.