laitimes

JDK 18 updates and JDK 19 new feature predictions

Author | Michael Redlich

Translated by | Hirakawa

Planning | Ding Xiaoyun

JDK 18 is the first non-LTS release since JDK 17. According to Mark Reinhold, chief architect of Oracle's Java platform group, JDK 18 has entered the initial release candidate phase. The JDK stable library branch was created from the backbone source library (Rampdown Phase One) in early December 2021. This branch defines the set of attributes for JDK 18. Critical defects, such as regressions or serious functional issues, can also be resolved, but must be approved through the Fix-Request process.

The final feature set contains nine new features. These features in the form of JEP can be divided into three categories: core Java libraries, Java tools, and Java specifications. We studied these features, some of which fall under the umbrella of the four major Java projects—Amber, Loom, Panama, and Valhalla. These projects aim to incubate a range of components that will eventually be incorporated into the JDK through planning mergers.

The following 7 new features can be grouped into the core Java libraries:

Two of them, JEP 417 and JEP 419, provide a continuous contribution to the realization of the Panama project. The project aims to improve and refine interoperability between the JVM and the well-defined "external" (i.e., non-Java APIs that most likely contain interfaces commonly used in C libraries). The Panama project was launched in 2014 and is led by Oracle software architect Maurizio Cimadamore. Its early access build is an incomplete version based on JDK 19, most recently updated on January 18, 2022.

JEP 418 provides a continuous contribution to the realization of the Loom project. The project aims to explore, incubate, and deliver Java VM features and APIs to support a new, lightweight concurrent programming model that is easy to use and high in throughput. This will be done through virtual threads, delimited continuations, and tail calls. The Loom project was launched in 2018 and is led by Oracle's technical consultant Ron Pressler. Its early access build build build 9 is based on JDK 19's early access build, most recently updated on February 13, 2022.

The remaining two JEPs:

JEP 413: Code Snippets in Java API Documentation

This JEP belongs to the second category of Java tools, introducing @snippet tags for Oracle's Standard Doclet (the famous Java API documentation tool that generates output in HTML format by default). The purpose is to simplify the inclusion of sample source code in the API documentation.

JEP 420: Switch Pattern Matching (Second Preview)

This JEP belongs to the Java specification class and has made an ongoing contribution to the completion of the Amber project. The project aims to explore and incubate small features of the Java language that can increase productivity. The Amber project was launched in 2017 and is led by Brian Goetz, Java language architect at Oracle.

According to the release schedule, the official release date for JDK 18 is March 22, 2022.

JDK 19

As planned, JDK 19 will be generally released in September 2022, and there is currently no JEP anchored in this version. However, based on recent draft JEPs, JEP candidates, and Oracle Java Development Ambassador Nicolai Parlog's Internal Java News Feed (Issue 18) (Java's 2022 plan), we can speculate which JEPs are likely to be included in JDK 19.

The Valhalla project aims to explore and incubate high-level candidate features for the JVM and Java language. This includes value types, generic specializations, and keyword volatile enhancements. The Valhalla project was launched in 2014 and is also led by Brian Goetz. The last update to the early access build was on August 30, 2019 and is currently very limited. However, activities within the project have increased over the past year.

In 2022, the Valhalla project plan includes: value classes (JEP Draft 8277163: Value Objects (Preview)); Primitive Classes (JEP 401: Primitive Classes (Preview) and JEP 402: Basic Primitive Classes (Preview)); Generic Generics (JeP Draft 8261529: Generic Generics (Preview)). To learn more about the Valhalla project, developers are advised to read Goetz's three series of articles published in December 2021:

The status of the Valhalla Project Part I: The Road to Valhalla

Valhalla Project Status Part II: Language Models

Valhalla Project Status Part III: The JVM Model

In 2022, the Amber project's plans include: finalizing the patterns in the switch (possibly the third preview after JEP 420 and JEP 406:switch pattern matching (preview) (delivered with JDK 17);introducing more modes such as deconstruction of records/arrays (JEP 405: Recording mode (preview)), and possibly regular classes. JEP 405 was originally named Record Mode & Array Mode (Preview) and is closely related to JEP 406.

In 2022, the Panama project's plans include: migrating the external APIs that are currently being incubated into preview; improving the implementation of the external API; deciding on the future of jextract, i.e. whether it should be a standalone project with a corresponding repository; and suspending the Vector API until the Valhalla project implements the value type and the original type. Draft JEP 8280173: Vector API (four-phase incubation), which proposes to introduce enhancements based on feedback from the Java community on the previous three JEPs. The three JEPs are: JEP 338: Vector API (incubation), delivered with JDK 16; JEP 414, Vector API (two-stage incubation), delivered with JDK 17; and JEP 417: Vecotr API (three-stage incubation), which will be delivered immediately after the release of JDK 18 GA.

In 2022, loom project plans include: completion of draft JEP 8277131: virtual threads (preview) and draft JEP 8277129: structured concurrency (incubation); incorporation of these features into the main JDK library; and further exploration of how to simplify debugging highly concurrency applications and further refine structured concurrency. Draft JEP 8263012: Scope Locals (Incubator), which recommends enhancing the Java API with scope-local variables, which are the final local values of dynamically changing scopes. They allow a lightweight form of thread inheritance.

We expect Oracle to work on these and other JEPs around JDK 19 soon.

About the Author:

Michael Redlich is a Senior Fellow in the Engineering Research Division of ExxonMobil in Clinton, New Jersey (his views and opinions in this article are his own and have nothing to do with his employer). He is an IT professional with a bachelor's degree in computer science from Rutgers University. Since 2001, he has been the moderator of the Garden State Java Users Group (formerly the ACGNJ Java User Group) and an experienced conference speaker who co-authored several articles with Barry Burd prior to joining InfoQ. As a longtime employee of Exxon & Company and ExxonMobil Corporation since December 1989, Mike has undertaken many tasks at the company, including automotive testing, analytical scientific research using infrared spectroscopy and stoichiometry, developing IT applications in science, and his current assignment is to conduct polymer science research using rheology and polymer physics. Over the course of his career, Mike has developed his leadership skills as Chairman of the New Jersey Amateur Computer Group, a nonprofit 501(c)(3) computer education organization, and currently as director of the Garden State Java Users Group, which is also a nonprofit 501(c)(3) organization. Mike is a member of the International Speech Association and recently earned a Silver Certificate in Advanced Communicator. He loves running and cycling and has completed many marathons. Mike and his wife Rowena live in Flemington, New Jersey, where they spend quality time together, cycling or running, mainly to New Orleans, Los Angeles, and Newport in Rio de Janeiro.

https://www.infoq.com/news/2022/03/java-18-so-far/?

Read on