image of screen and gears
September 17, 2024

What's New With Java 23

Java Updates

Java 23 is a short-term JDK release that will receive premier support for six months. It was released from Oracle on September 17, 2024.  Java 23 includes three permanent features and eight preview features.  

Read on to learn more about what’s included in these JEPs and what’s next on Oracle’s roadmap after Java 23.  

 

Back to top

What is Java 23?

Java 23 is a short-term JDK release that was released September 17, 2024. Java 24 will replace Java 23 in March 2025.  

Java 23 is not a Java LTS version, which means that it will only have premier support for six months. It includes one incubator feature and eight preview features, or JEPs. While these JEPs span the gamut of features, they all largely support the goal of making Java a more appealing development language for beginners.  

🔎 Looking for info on Java LTS versions? Read this blog on Java 21.

While the permanent features don’t include anything excited or unexpected, there are numerous preview features that collectively make Java more approachable to new developers. Of note, string templates did not make the cut for Java 23 after being introduced as a preview feature in Java 21 and Java 22.   

Back to top

Permanent Features in Java 23 

Permanent features have been introduced in previous JDKs and after iterations and refinements are ready for permanent release. There are three permanent features in Java 23, which are detailed below.  

JEP 467: Markdown Documentation Comments 

This permanent feature enables JavaDoc documentation comments to be written in Markdown rather than solely in a mixture of HTML and JavaDoc @-tags. Markdown is a popular markup language for simple documents that is easy to read, easy to write, and easily transformed into HTML. A stated goal of this feature is to make API documentation comments easier to write and easier to read in source form. 

JEP 471: Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal 

The stated goals of this permanent feature are to prepare the ecosystem for the removal of the memory-access methods in sun.misc.Unsafe in a future JDK release, and to help developers realize when their applications rely, directly or indirectly, on the memory-access methods in sun.misc.Unsafe. 

JEP 474: ZGC: Generational Mode by Default 

This permanent feature switches the default mode of the Z Garbage Collector (ZGC) to the generational mode. It also deprecates the non-generational mode, with the intent to remove it in a future release. 

Back to top

Preview Features in Java 23 

Preview features are features that are fully developed, but that still may change before they are introduced into the JDK as a permanent feature. Java 23 includes eight preview features, which are detailed below.  

JEP 455: Primitive Types in Patterns, instanceof, and switch 

This preview language feature enhances pattern matching by allowing primitive types of patterns in all pattern contexts. This JEP also extends instanceof and switch to work with all primitive types. 

While a stated goal is to enable uniform data exploration by allowing type patterns for all types, whether primitive or reference, it is not a stated goal to add new kinds of conversions to the Java language. 

JEP 466: Class-File API 

This second preview provides a standard API for parsing, generating, and transforming Java class files. 

JEP 473: Stream Gatherers 

This second preview feature will allow stream pipelines to transform data in ways that are not easily achievable with the existing built-in intermediate operations. 

JEP 476: Module Import Declarations 

This preview feature simplifies the use of modular libraries by enabling users to succinctly import all of the packages exported by a module. 

JEP 477: Implicitly Declared Classes and Instance Main Methods 

This third preview feature is designed to offer a smooth on-ramp to Java programming, so that instructors can introduce concepts in a gradual manner. Implicitly declared classes and instance main methods were first proposed as a preview feature in Java 21 and as a second preview in Java 22. 

JEP 480: Structured Concurrency 

This preview feature treats groups of related tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. 

JEP 481: Scoped Values 

This third preview feature enables a method to share immutable data both with its callees within a thread, and with child threads. Scoped values also have lower space and time costs.  

JEP 482: Flexible Constructor Bodies 

This preview feature gives developers greater freedom to express the behavior of constructors, enabling the more natural placement of logic that currently must be factored into auxiliary static methods, auxiliary intermediate constructors, or constructor arguments. 

Back to top

What’s Not Included in Java 23? 

Notably, string templates are not included in Java 23. String templates were first introduced as a preview feature in Java 21 and again as a second preview feature in Java 22. Except for a technical change in the types of template expressions, there were no additional changes between Java 21 and Java 22.  

This omission caught Java developers by surprise, but was due to fundamental flaws in the design structure of string templates that was discovered during extensive testing during a real-world project.  

Back to top

What Comes After Java 23? 

Oracle will release Java 24 in March 2025, which will succeed Java 21 as the latest Java LTS version two years after that version’s release. This is an increase in cadence in Java LTS versions from every three years. 

⚙️ Want to learn more about Java LTS? Read this blog post about updating Java versions. 

No matter what JDK version you use, JRebel can help you save Java development time by eliminating redeploys. See how much time you can save on cloud development during your 14-day free trial of JRebel 

Back to top