After six months of development, Oracle has released Java SE 23 (Java Platform, Standard Edition 23), with the OpenJDK open-source project serving as its reference implementation. Except for the removal of some deprecated features, Java SE 23 maintains backward compatibility with previous versions of the Java platform — most previously written Java projects will run without modifications on the new version. Installable builds of Java SE 22 (JDK, JRE, and Server JRE) are prepared for Linux (x86_64, AArch64), Windows (x86_64), and macOS (x86_64, AArch64). The reference implementation of Java 23 developed under the OpenJDK project is fully open under the GPLv2 license with exceptions from GNU ClassPath, allowing dynamic linking with commercial products.
Java SE 23 is classified as a regular support release, with updates being provided until the next release. For a long-term support (LTS) branch, Java SE 21 or Java SE 17 should be used, with updates available until 2031 and 2029 respectively (general availability until 2028 and 2026). The extended support for the LTS branch of Java SE 8 will last until 2030, while Java SE 11 will be supported until 2032.
Among the features introduced in Java SE 23:
- The generational mode of the ZGC (Generational Z Garbage Collector) is enabled by default, which uses separate handling for "old" and "young" objects, increasing the efficiency of cleaning up recently created objects with short lifespans. The use of Generational ZGC reduces the risks of pauses during resource allocation, lowers CPU load, and memory consumption during garbage collection. Testing Generational ZGC with Apache Cassandra 4 showed a fourfold increase in throughput with a fixed heap size and a reduction in heap size by a quarter while maintaining the same throughput.
- JavaDoc now supports the use of Markdown for documenting code in comments, which can be used instead of a mix of HTML and JavaDoc @-tags.

- Pattern matching mechanisms have been expanded with preliminary support for using primitive types (int, byte, char, and other non-object basic types) in all types of patterns, 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 … }
- Preliminary support has been added for using a single expression 'import module M' to import all packages exported by the specified module at once. This change significantly simplifies the reuse of modular libraries, allowing you to import libraries and classes without specifying their location in the package hierarchy. For example, using 'import module java.base' will import all 54 packages included in the java.base module, which previously would have needed to be mentioned separately ('import java.io.*', 'import java.util.*', etc.).
A second preliminary implementation of the Class-File API has been proposed for parsing, generating, and transforming Java class files. ClassFile cf = ClassFile.of(); ClassModel classModel = cf.parse(bytes); byte[] newBytes = cf.build(classModel.thisClass().asSymbol(), classBuilder -> { for (ClassElement ce : classModel) { if (!(ce instanceof MethodModel mm && mm.methodName().stringValue().startsWith("debug"))) { classBuilder.with(ce); } } });
- An eighth preliminary implementation of the Vector API has been proposed, providing functions for vector computations performed using vector instructions on x86_64 and AArch64 processors, allowing simultaneous operations to be applied to multiple values (SIMD). Unlike the auto-vectorization capabilities of the HotSpot JIT compiler for scalar operations, the new API offers explicit control over vectorization for parallel data processing.
- The java.io.Console class has been enhanced with format, printf, readPassword, and readLine methods for formatting, outputting, and reading text with respect to the selected locale. System.console().printf(Locale.FRANCE, "%1$tY-%1$tB-%1$te %1$tA", new Date()) 2024-mai-16 jeudi
- A second preliminary implementation of the extended Stream API has been added, supporting the definition of custom intermediary operations that may be useful in cases where existing built-in intermediary operations do not suffice for the desired data transformation. Custom handlers are connected using the new intermediary operation Stream::gather(Gatherer), which processes stream elements by applying a user-defined handler to them. jshell> Stream.of(1,2,3,4,5,6,7,8,9).gather(new WindowFixed(3)).toList() $1 ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- A third preliminary implementation of implicitly declared classes and unnamed instances of the main method has been added, allowing the omission of public/static declarations, argument array passing, and other entities related to class declaration. // was public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world!"); } } // now you can void main() { System.out.println("Hello, World!"); }
- A second preliminary option allowing the specification of expressions in constructors before calling super(...), which is used to explicitly call the parent class constructor from the subclass constructor, has been added, provided these expressions do not reference the instance created by the constructor. class Outer { void hello() { System.out.println("Hello"); } class Inner { Inner() { hello(); super(); } } }
- A third preliminary implementation of Scoped Values has been added, allowing immutable data to be shared among threads and efficiently exchanged between child threads (values are inherited). Scoped Values are being developed to replace the mechanism of thread-local variables and are more efficient when using a very high number of virtual threads (thousands and millions of threads). The main difference between Scoped Values and thread-local variables is that the former are written once, cannot be changed thereafter, and remain accessible only during the thread's execution.
- The third 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.
- The methods for accessing external memory (outside the JVM) provided by the class sun.misc.Unsafe have been deprecated and are scheduled for removal. It is recommended to use the VarHandle API and the FFM (Foreign Function & Memory) API for accessing off-heap memory and interacting with external code.
Additionally, the release of the platform update for building applications with the JavaFX graphical user interface 23 has been noted, along with the inclusion of the GraalVM JIT compiler in the main distribution of Oracle JDK 23.
A new release of the universal virtual machine GraalVM has also been introduced, supporting the execution of applications in JavaScript (Node.js), Python, Ruby, R, any JVM languages (Java, Scala, Clojure, Kotlin), and languages that can generate LLVM bitcode (C, C++, Rust). In addition to supporting JDK 23, the new version features optimizations for memory consumption and executable code size, and has implemented full support for embedding Python and WebAssembly within Java code using JIT compilation.
Source: opennet.ru

