Java 20 is here: Strengthening Java’s foundation for the future

March 21, 2023 | 4 minute read
Alan Zeichick
Editor in Chief, Java Magazine
Text Size 100%:

The JEPs in Java 20 advance the long-term Amber, Loom, and Panama initiatives, and they also boost vector math.

Java 20 illustration

Java 20 is officially here, as of its general availability launch on March 21, 2023. This release represents the 11th feature release of the platform using the now-standard semiannual cadence. (You should expect to see Java 21 in September.)

There’s a tremendous wealth of information in the Java 20 release notes, and this article will hit some of the highlights. You may also want to review Mohamed Taman’s “Java 20 sneak peek.”

As described in the official Java 20 release blog, six of the JEPs delivered with Java 20 are grouped into three categories corresponding to Project Amber (improving developer productivity), Project Loom (reimagining threading), and Project Panama (bridging Java and other platforms). There’s also another JEP focused on vector mathematics.

Oracle’s Georges Saab, senior vice president of development, Java Platform Group, and chair of the OpenJDK Governing Board
Oracle’s Georges Saab

Oracle’s Georges Saab, senior vice president of development, Java Platform Group, and chair of the OpenJDK Governing Board, said, “For more than 25 years, Java has empowered developers to design and build the next generation of robust, scalable, and secure applications.”

Saab added, “The innovative new enhancements in Java 20 reflect the vision and invaluable efforts the global Java community has contributed throughout Java’s existence. With the support provided by Oracle’s ongoing Java technology leadership and community stewardship, Java has never been more relevant as a contemporary language and platform that helps developers improve productivity.”

The following are the seven JEPs included in the Java 20 release.

Project Amber

JEP 432: Record patterns (second preview). Improves developer productivity by extending pattern matching to express more-sophisticated, composable data queries. This is done by enhancing the Java programming language with record patterns to deconstruct record values. Record patterns and type patterns can be nested to enable a powerful, declarative, and composable form of data navigation and processing.

JEP 433: Pattern matching for switch (fourth preview). Improves developer productivity by improving Java’s code semantics. This is done by enhancing the Java programming language with pattern matching for switch expressions and statements. Extending pattern matching to switch allows an expression to be tested against several patterns, each with a specific action, so complex data-oriented queries can be expressed concisely and safely.

Project Loom

JEP 429: Scoped values (incubator). Enables the sharing of immutable data within and across threads through scoped values. Scoped values are preferable to thread-local variables, especially when large numbers of virtual threads are used, and they provide improvements in many areas including ease of use, comprehensibility, robustness, and performance.

JEP 436: Virtual threads (second preview). Provides lightweight virtual threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications. Virtual threads are decoupled within Java from the number of natural physical threads or cores in the processor.

JEP 437: Structured concurrency (second incubator). Simplifies multithreaded programming by introducing an API for structured concurrency. This API treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability.

Project Panama

JEP 434: Foreign function and memory API (second preview). Introduces an API by which Java programs can interoperate with code and data outside of the Java runtime. By efficiently invoking foreign functions (that is, code outside the JVM) and by safely accessing foreign memory (that is, memory not managed by the JVM), the API enables Java programs to call native libraries and process native data without the brittleness and danger of the older Java Native Interface (JNI).

One more JEP

JEP 438: Vector API (fifth incubator). Achieves performance superior to equivalent scalar computations by introducing an API to express vector computations that reliably compile at runtime to optimal vector instructions on supported CPU architectures. Vector APIs were incubated in JDK 16, 17, 18, and 19. JDK 20 incorporates feedback from users of those releases as well as performance improvements and implementation enhancements. It uses some of the features of JEP 434 that are now mature enough to enable this dependency.

Fixes and updates

While most attention is naturally focused on the JEPs in Java 20 (and in all Java releases), there are also thousands of other performance, stability, and security updates. These include

  • Datagram Transport Layer Security (DTLS) key exchange named groups
  • The addition of a new GarbageCollectorMXBean to report the occurrence and duration of remark and cleanup pause times for the G1 garbage collector
  • ChaCha20 intrinsics on x86_64 and aarch64 platforms
  • Support for Unicode 15.0
  • Improved control of G1’s concurrent refinement threads
  • Support for Unicode CLDR version 42
  • New JDK Flight Recorder events: jdk.InitialSecurityProperty and jdk.SecurityProviderService
  • Improvements to the Preview API page in the documentation generated by Javadoc
  • New jmod –compress command-line option
  • Grapheme support in BreakIterator
  • Updated time zone data that complies with the 2022c standard
  • Autogenerated IDs in Javadoc headings

Download Java 20 and start working

You can download load Java 20 here: https://www.oracle.com/java/technologies/downloads/

Dig deeper

Alan Zeichick

Editor in Chief, Java Magazine

Alan Zeichick is editor in chief of Java Magazine and editor at large of Oracle’s Content Central group. A former mainframe software developer and technology analyst, Alan has previously been the editor of AI Expert, Network Magazine, Software Development Times, Eclipse Review, and Software Test & Performance. Follow him on Twitter @zeichick.

Show more

Previous Post

Book review: DevOps Tools for Java Developers

Andrew Binstock | 4 min read

Next Post


Quiz yourself: Java’s date and time TemporalAccessor generation interface

Mikalai Zaikin | 4 min read
Oracle Chatbot
Disconnected