The release of Java SE 25 LTS and OpenJDK 25

After six months of development, Oracle has released the Java SE 25 platform (Java Platform, Standard Edition 24), with the open project OpenJDK serving as its reference implementation. With the exception of removing some deprecated features, Java SE 25 maintains backward compatibility with previous versions of the Java platform — most previously written Java projects will run without changes under the new version. Installable builds of Java SE 25 (JDK, JRE, and Server JRE) have been prepared for Linux (x86_64, AArch64), Windows (x86_64), and macOS (x86_64, AArch64). The reference implementation of Java SE 25 developed within the OpenJDK project is fully open under the GPLv2 license with exceptions for GNU ClassPath, allowing dynamic linking with commercial products.

Java SE 25 is classified as a release with an extended support period, with updates being released until 2033 (public updates will be available until September 2030). The Java SE 17 and 21 branches also continue to be supported as long-term support (LTS) releases, with updates until 2029 and 2031, respectively (public updates until 2026 and 2028). Extended support for the LTS branches Java SE 8 and 11 will last until 2030 and 2032.

Among the innovations introduced in Java SE 25 (1, 2, 3, 4):

  • An experimental StableValue API has been added for working with objects that contain immutable data and are processed in the JVM as constants. Such objects benefit from performance optimizations similar to fields marked with the "final" keyword. The StableValue API separates the creation of constant values from their initialization, ensures that a value can only be initialized once, reduces application startup time, and allows for constant-folding optimizations in user code that were previously only used in internal JDK code. class Application { // Previously: // static final UserService USERS = new UserService(); // Now: static final StableValue USERS = StableValue.of(); public static UserService users() { return USERS.orElseSet(UserService::new); } }
  • An experimental API has been added for encoding and decoding objects with cryptographic keys, certificates, and certificate revocation lists, using the PEM (Privacy-Enhanced Mail) format.
  • Support for Scoped Values has been added, allowing immutable data to be shared across threads and enabling efficient data exchange between child threads (values are inherited). Scoped Values are evolving to replace the mechanism of thread-local variables and are more efficient when using a very large number of virtual threads (thousands or millions of threads). The main difference between Scoped Values and thread-local variables is that the former are written once, cannot be changed afterward, and remain available only during the thread's execution.
  • An API has been added for using key derivation functions (KDF), which allow the generation of additional keys of the required length based on a secret key (e.g., a password) and an arbitrary set of data.
  • Code and build scripts for supporting 32-bit x86 systems have been removed. The discontinuation of support for 32-bit x86 systems has simplified the infrastructure for building and testing the JDK, and it has enabled the implementation of platform-dependent features without creating fallback handlers for 32-bit x86 systems.
  • The ability to use a single expression 'import module M' for importing all packages exported by the specified module has been added. This change significantly simplifies the reuse of module libraries, allowing libraries and classes to be imported without specifying their locations in the package hierarchy. For example, specifying 'import module java.base' will import all 54 packages included in the java.base module, which would previously have required separate mentions ('import java.io.*', 'import java.util.*', etc.).
  • A compact variant of program structure has been proposed, which can be useful for teaching and when developing small applications. In the compact form, no extra classes need to be defined, typical APIs are automatically imported, and simplified input/output methods are available. For example, the 'Hello, World!' application can be reduced to: void main() { IO.println('Hello, World!'); }
  • It is allowed to specify expressions in builders before calling super(...), used for explicitly invoking the parent class constructor from the inherited class constructor, provided that these expressions do not reference the instance being created by the constructor. class Outer { void hello() { System.out.println("Hello"); } class Inner { Inner() { hello(); super(); } } }
  • A generational mode has been added to the Shenandoah garbage collector, where old and recently created objects are processed separately to enhance the efficiency of cleaning up objects with short lifetimes. This new mode provides more predictable throughput, resilience to changing loads, and reduced memory consumption during garbage collection. The Shenandoah scheduler aims to reduce pause times during garbage collection by performing a larger volume of work in parallel with the execution of Java applications.
  • The creation of a cache for Ahead-of-Time loading and linking of classes has been simplified, allowing for faster startup of the HotSpot JVM by utilizing classes in an already loaded and linked state. At startup, no separate operations are required for writing activity and creating the cache; a single command suffices: java -XX:AOTCacheOutput=app.aot -cp app.jar com.example.App …
  • On startup, the HotSpot Java VM has implemented the ability to use method execution profiles obtained during the previous application run. This change allows the JIT compiler to operate without accumulating statistics and to begin generating native code immediately without waiting for the profile to be formed.
  • The HotSpot JVM has implemented support for compact object headers, the size of which has been reduced from 96 to 64 bits (from 12 to 8 bytes) on 64-bit systems. The reduction in header size allows for a decrease in heap size and improves cache efficiency.
  • The proposed test implementation of the Vector API provides functions for vector computations that utilize the vector instructions of x86_64 and AArch64 processors, allowing operations to be applied simultaneously to multiple values (SIMD). Unlike the auto-vectorization capabilities of scalar operations provided by the HotSpot JIT compiler, the new API enables explicit control over vectorization for parallel data processing.
  • A fifth preliminary version of the API for Structured Concurrency has been proposed for testing, simplifying the development of multithreaded applications by handling multiple tasks executed in different threads as a single block.
  • In the pattern matching mechanism, a third preliminary version of using primitive types (int, byte, char, and other basic types that are not objects) has been proposed in all types of templates, in the 'instanceof' operator, and in 'switch' blocks. switch (x.getStatus()) { case 0 -> "okay"; case 1 -> "warning"; case 2 -> "error"; case int i -> "unknown status: " + i; } if (i instanceof byte b) { … b … }
  • Experimental support for profiling with more precise CPU resource consumption tracking has been added to JDK Flight Recorder (JFR) on the Linux platform. Information on the runtime of various constructs can be visually represented using colorful 'FlameGraph' diagrams.
  • The stability of JDK Flight Recorder (JFR) during asynchronous sampling of Java thread stacks has been improved by traversing call stacks only at 'safepoints'.
  • JDK Flight Recorder (JFR) now includes tools for tracing and measuring the execution time of methods. It supports call stack tracing of specific methods and the recording of precise statistics about method calls, covering metrics such as execution time and call counts.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster