Java Development Kit (JDK) 23 is now available as a release candidate, with the full release expected on September 17. This version introduces several new features, including previews for module import declarations, stream gatherers, structured concurrency, and scoped values. However, the anticipated string templates feature has been removed from the release.
JDK 23 will include a dozen finalized features, many of which have undergone previous previews. Among the highlights are third previews of scoped values, structured concurrency, and implicitly declared classes, as well as second previews of flexible constructor bodies, stream gatherers, and a class-file API. In addition, this release debuts features like module import declarations, Markdown documentation comments, and the eighth iteration of the vector API. It also introduces a preview for primitive types in patterns, instanceof, and switch, while deprecating certain memory access methods and shifting the Z Garbage Collector (ZGC) to its generational mode by default.
Unlike JDK 21, which is a Long Term Support (LTS) release, JDK 23 is a non-LTS version and will only receive six months of official support from Oracle. Early access builds can be downloaded from jdk.java.net.
Key Features and Changes in JDK 23
Scoped Values (Third Preview): Scoped values provide a method for sharing immutable data within a thread and with child threads, offering a more straightforward alternative to thread-local values. This update refines the ScopedValue.callWhere method, allowing the Java compiler to infer checked exceptions. The previous ScopeValue.getWhere method has been removed as a result.
Memory Access Deprecation in sun.misc.Unsafe: The memory-access methods in sun.misc.Unsafe are set for deprecation in JDK 23, preparing them for removal in future versions. Developers are encouraged to transition to the VarHandle API and the foreign function and memory API to ensure smoother migration to upcoming Java versions.
Structured Concurrency (Third Preview): This feature continues to evolve with the goal of simplifying concurrent programming. It introduces an API that treats groups of related tasks as a single unit, enhancing error handling, cancellation, and overall observability.
Flexible Constructor Bodies (Second Preview): Originally called “statements before super(…),” this feature allows constructors to initialize fields before explicitly invoking a superclass constructor. This gives developers more flexibility when structuring their code, enabling more natural placement of logic.
Implicitly Declared Classes and Instance Methods (Third Preview): This feature is designed for beginners, allowing them to create simple single-class programs without needing to understand complex Java concepts. In JDK 23, enhancements include automatic imports of static methods for console I/O and broader imports of public classes from the java.base module.
Module Import Declarations (Preview): This feature simplifies the reuse of modular libraries by allowing entire modules to be imported at once, making it easier to use third-party libraries and core Java classes without navigating complex package hierarchies.
Markdown Documentation Comments: JavaDoc comments can now be written in Markdown, offering a cleaner, more readable way to document APIs while still supporting traditional HTML elements and JavaDoc tags.
Z Garbage Collector’s Generational Mode: JDK 23 makes the generational mode of ZGC the default setting, aiming to improve performance by frequently collecting young objects. The non-generational mode is deprecated and will likely be removed in a future release.
Vector API (Eighth Incubation): The vector API continues to evolve, providing a platform-agnostic way to express vector computations, with reliable runtime compilation across x64 and AArch64 architectures.
Stream Gatherers (Second Preview): This enhancement to the stream API enables more flexible and expressive stream pipelines by allowing custom intermediate operations that can handle streams of infinite size.
Class-File API: This API is designed for processing Java class files according to the JVM specification. It introduces refinements like improved methods for bytecode instructions and better modeling of generic signatures.
Primitive Types in Patterns, instanceof, and switch: This feature allows the use of primitive type patterns in all contexts, making it easier to work with both primitive and reference types across pattern matching, instanceof, and switch statements.
Dropped Feature: String Templates
The string templates feature, previewed in JDK 21 and JDK 22, has been removed from JDK 23. The OpenJDK community determined that the feature needed more evaluation and potential redesign, delaying its inclusion.
Looking Ahead: Java’s Future in 2024
Oracle has also outlined upcoming plans for Java, focusing on key OpenJDK projects. These include Project Amber, which targets smaller productivity features, and Project Valhalla, aimed at introducing value objects to improve performance. Java’s evolution continues as the platform expands to support new programming models and technologies.
Java 23: A Breakdown of the Latest Features in JDK 23
Java Development Kit (JDK) 23 is now available as a release candidate, with the full release expected on September 17. This version introduces several new features, including previews for module import declarations, stream gatherers, structured concurrency, and scoped values. However, the anticipated string templates feature has been removed from the release.
JDK 23 will include a dozen finalized features, many of which have undergone previous previews. Among the highlights are third previews of scoped values, structured concurrency, and implicitly declared classes, as well as second previews of flexible constructor bodies, stream gatherers, and a class-file API. In addition, this release debuts features like module import declarations, Markdown documentation comments, and the eighth iteration of the vector API. It also introduces a preview for primitive types in patterns, instanceof, and switch, while deprecating certain memory access methods and shifting the Z Garbage Collector (ZGC) to its generational mode by default.
Unlike JDK 21, which is a Long Term Support (LTS) release, JDK 23 is a non-LTS version and will only receive six months of official support from Oracle. Early access builds can be downloaded from jdk.java.net.
Key Features and Changes in JDK 23
ScopedValue.callWhere
method, allowing the Java compiler to infer checked exceptions. The previousScopeValue.getWhere
method has been removed as a result.sun.misc.Unsafe
: The memory-access methods insun.misc.Unsafe
are set for deprecation in JDK 23, preparing them for removal in future versions. Developers are encouraged to transition to the VarHandle API and the foreign function and memory API to ensure smoother migration to upcoming Java versions.java.base
module.instanceof
, andswitch
: This feature allows the use of primitive type patterns in all contexts, making it easier to work with both primitive and reference types across pattern matching,instanceof
, andswitch
statements.Dropped Feature: String Templates
The string templates feature, previewed in JDK 21 and JDK 22, has been removed from JDK 23. The OpenJDK community determined that the feature needed more evaluation and potential redesign, delaying its inclusion.
Looking Ahead: Java’s Future in 2024
Oracle has also outlined upcoming plans for Java, focusing on key OpenJDK projects. These include Project Amber, which targets smaller productivity features, and Project Valhalla, aimed at introducing value objects to improve performance. Java’s evolution continues as the platform expands to support new programming models and technologies.
Archives
Categories
Archives
OpenSilver Expands Support to Mobile Platforms with .NET MAUI Hybrid
March 28, 2025JDK 25: What’s New in the Latest Java Release
March 18, 2025Categories
Meta