BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Java 23 Delivers Markdown Documentation, ZGC Generational Mode, Deprecate sun.misc.Unsafe

Java 23 Delivers Markdown Documentation, ZGC Generational Mode, Deprecate sun.misc.Unsafe

Oracle has released version 23 of the Java programming language and virtual machine. As the second non-LTS release since JDK 21, the 12 JEPs in this final feature set are:

Three of these - Markdown Documentation Comments, ZGC: Generational Mode by Default and Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal - are final features without having gone through the preview and/or incubation process.

As shown in the graph below, as presented in this blog post, the feature cadence for JDK 23 is similar to that of the previous releases dating back four years to JDK 14 with the exception of JDK 18, JDK 19 and JDK 20.

We examine some of these JEPs, discuss the JDK 23 Launch Event, and update our predictions for features that may be included in JDK 24.

Markdown Documentation Comments

JEP 467, Markdown Documentation Comments, proposes to enable JavaDoc documentation comments to be written in Markdown, a popular markup language often found in open-source projects, rather than a mix of HTML and JavaDoc @ tags. The intent is to provide improved documentation that is easier to read and write.

ZGC: Generational Mode by Default

JEP 474, ZGC: Generational Mode by Default, proposes to use the Z Garbage Collector (ZGC) from non-generational to generational mode by default. The non-generational mode will be deprecated and removed in a future JDK release. This will ultimately reduce the cost of maintaining the two modes such that future development can primarily focus on JEP 439, Generational ZGC. More details may be found in this InfoQ news story.

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

JEP 471, Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal proposes deprecating the memory-access methods in the Unsafe class for removal in a future JDK release. These methods have already been replaced by JDK features such as: JEP 193, Variable Handles, delivered in JDK 9; and JEP 454, Foreign Function & Memory API, delivered in JDK 22.

Stream Gatherers (Second Preview)

JEP 473, Stream Gatherers (Second Preview), proposes a second round of preview from the previous round, namely JEP 461, Stream Gatherers (Preview), delivered in JDK 22. This will allow additional time for feedback and more experience with this feature, with no user-facing changes over JEP 461. This feature was designed to enhance the Stream API to support custom intermediate operations that will "allow stream pipelines to transform data in ways that are not easily achievable with the existing built-in intermediate operations." More details on this JEP may be found in the original design document and this InfoQ news story.

Class-File API (Second Preview)

JEP 466, Class-File API (Second Preview), proposes a second round of preview to obtain feedback from the previous round of preview: JEP 457, Class-File API (Preview), delivered in JDK 22. This feature provides an API for parsing and generating Java class files to improve the transformation process. This will initially serve as an internal replacement for ASM, the Java bytecode manipulation and analysis framework, in the JDK with plans to have it opened as a public API. Brian Goetz, Java language architect at Oracle, has characterized ASM as "an old codebase with plenty of legacy baggage" and provided background information on how this draft will evolve and ultimately replace ASM.

JDK 23 Launch Event

The JDK 23 Launch Event, live-streamed on September 17, 2024 from 13:00-16:30 UTC, was hosted by Ana-Maria Mihalceanu, Billy Korando and Nicolai Parlog, Java developer advocates at Oracle, featuring the following topics: Deep Dive into the Features of Java 23; Java Outreach in 2024; and Java Preview Features and Future Work. Special guests included:

  • Gavin Bierman, consulting member of technical staff at Oracle, discussed Project Amber and the four JEPs represented in JDK 23, namely: Flexible Constructor Bodies (Second Preview); Implicitly Declared Classes and Instance Main Methods (Third Preview); Module Import Declarations (Preview); and Primitive Types in Patterns, instanceof, and switch (Preview). He also provided the reasons for removing, at least for now, the String Templates API that was originally planned to be finalized with the release of JDK 24.
  • Ron Pressler, architect and technical lead for Project Loom at Oracle, introduced JEP Draft 8305968, Integrity by Default, a new feature that proposes to "restrict the unsafe APIs in the Java Platform so that, by default, libraries, frameworks, and tools cannot use them. Application authors will have the ability to override this default."
  • Maurizio Cimadamore, software engineer at Oracle, discussed improvements in the Foreign Function & Memory (FFM) API, a feature that was finalized in JDK 22. These included: limitations using the ByteBuffer class in FFM; the MemorySegment interface; and JStruct, a simple jextract plugin that generates all structure layouts in a given header file.
  • Jonathan Gibbons, principal member of technical staff at Oracle, discussed the motivation behind the new Markdown Documentation Comments API, how to use it and what developers can expect in future updates.
  • Stefan Karlson, senior manager at Oracle, discussed the new features in the ZGC: Generational Mode by Default API and why developers should migrate to this feature over single-generation garbage collectors.
  • Denys Makogon, principal software development engineer at Oracle, provided updates to the Java Playground, a GUI based on the JShell utility to write and execute Java code.
  • Heather Stephens, senior director, head of Java in education at Oracle, discussed the importance of the Java in Education initiative, launched in June 2020, to provide better resources to educational institutions so that they can move beyond teaching JDK 8. More details on this initiative may be found in this InfoQ news story.
  • Sharat Chander, senior director, Product Management & Developer Engagement at Oracle, and Jim Grisanzio, software program management at Oracle, provided a Java community report that included: a recognition of Java User Groups; popular conferences; and an overview of the Sip of Java, JEP Cafe and Inside Java Newscast series. Chander also reminded attendees that JavaOne will return in 2025 to celebrate Java’s 30th birthday. The call for papers is open until October 10, 2024 at 17:00 PDT.
  • Alina Yurenko, principal developer advocate at Oracle Labs, and Fabio Niephaus, research manager on the GraalVM team at Oracle Labs, provided a sneak peek at GraalVM for JDK 23, released concurrently with JDK 23. Along with new features, it was announced that GraalPy is no longer experimental. Niephaus demonstrated applications using GraalPy and GraalWasm.
  • Brian Goetz discussed the Class-File API and why Oracle should be in the business of providing an API for processing Java class files. Changes have been implemented based on feedback from users, and Goetz hopes this feature can be finalized in JDK 24. More details on the Class-File API can be found on this YouTube video.
  • John Rose, JVM Architect at Oracle, provided updates to Project Leyden, a project designed to improve the "startup time, time-to-peak performance, and footprint of Java programs."

JDK 23 may now be downloaded from Oracle, and binaries from other vendors are expected to become available in the coming days.

JDK 24

Scheduled for a GA release in March 2025, only one JEP has been targeted for JDK 24 at this time. However, based on a number of JEP candidates and drafts, especially those that have been submitted, we can surmise which additional JEPs have the potential to be included in JDK 24.

JEP 472, Prepare to Restrict the Use of JNI, has been targeted for JDK 24. The JEP proposes to restrict the use of the inherently unsafe Java Native Interface (JNI) in conjunction with the use of restricted methods in the Foreign Function & Memory (FFM) API. The alignment strategy, starting in the release of JDK 23, will have the Java runtime display warnings about the use of JNI unless an FFM user enables unsafe native access on the command line. It is anticipated that in the release after JDK 23, using JNI will throw exceptions instead of warnings. More details may be found in this InfoQ news story.

JEP 484, Class-File API, currently in Candidate status, proposes to finalize this feature in JDK 24 after two rounds of preview, namely: JEP 466, Class-File API (Second Preview), delivered in JDK 23; and JEP 457, Class-File API (Preview), delivered in JDK 22. Changes since the second preview include: a new method, resolvedValue(), defined in the AnnotationValue.OfConstant interface; and a number of methods that have either been renamed, moved from one interface to another, or removed.

JEP Draft 8338456, Scoped Values (Fourth Preview), proposes a fourth preview, with one change, in order to gain additional experience and feedback from one round of incubation and three rounds of preview, namely: JEP 481, Scoped Values (Third Preview), delivered in JDK 23; JEP 464, Scoped Values (Second Preview), delivered in JDK 22; JEP 446, Scoped Values (Preview), delivered in JDK 21; and JEP 429, Scoped Values (Incubator), delivered in JDK 20. Formerly known as Extent-Local Variables (Incubator), this feature enables the sharing of immutable data within and across threads. This is preferred to thread-local variables, especially when using large numbers of virtual threads.

JEP Draft 8300911, PEM API (Preview), introduces an easy and intuitive API for encoding and decoding the Privacy-Enhanced Mail (PEM) format to describe value holders that can change, at most, once. This PEM format will be used for storing and sending cryptographic keys and certificates.

JEP Draft 8291976, Support HTTP/3 in the HttpClient, proposes to update JEP 321, HTTP Client, delivered in JDK 11, to support the HTTP/3 protocol. This will allow applications and libraries to interact with HTTP/3 servers and get the benefits of HTTP/3 with minimal code changes.

The formal release date for JDK 24 is expected to be March 2025, soon to be proposed by Mark Reinhold, chief architect, Java Platform Group at Oracle. Developers can anticipate a feature freeze in early-December 2024. More details on additional JEP drafts and candidates may be found in this more detailed InfoQ news story.

About the Author

Rate this Article

Adoption
Style

BT