News/Tech News

Projects Amber, Loom, and Panama will benefit from Java 20

Published on march 22, 2023

The Java programming language and virtual machine have been updated to version 20 by Oracle.

There are seven (7) new features in Java 20 that are similar to those in JDK 19 and nine (9) new features in JDK 18. However, this is less than some of the more recent releases prior to JDK 18: 14 features in JDK 17, 17 features in JDK 16, 14 features in JDK 15, and 16 features in JDK 14.

This release includes JEPs that provide continued contributions to Project Amber, Project Loom, and Project Panama, as well as new rounds of preview and incubation. Here we examine a few of these new features. In JDK 20, there were no JEPs representing Project Valhalla.

Project Panama
Project Panama is developing JEP 434 and JEP 438 to improve and enhance interoperability between the JVM and well-defined “foreign” APIs, usually C APIs.

A second preview of JEP 434, Foreign Function & Memory API (Second Preview), incorporates refinements based on feedback. The relevant incubating JEPs 419, Foreign Function & Memory API (Second Incubator), delivered in JDK 18, and 412, Foreign Function & Memory API (Incubator), delivered in JDK 17. With this feature, Java applications can efficiently invoke foreign functions and safely access foreign memory that is not managed by the Java runtime. The MemorySegment and MemoryAddress interfaces have been unified, i.e., memory addresses are now modeled as zero-length memory segments; the sealed MemoryLayout interface has been enhanced to facilitate usage with JEP 427 (Third Preview), Pattern Matching for switches.

In response to feedback from the previous four rounds of incubation, JEP 438 (Fifth Incubator) incorporates enhancements: Vector API 426, delivered in JDK 19, Vector API 417, delivered in JDK 18, Vector API 414 (Second Incubator), delivered in JDK 17, and Vector API 338, delivered as a module in JDK 16. JEP 424, Foreign Function & Memory API (Preview), defines how vectors can be loaded and stored to and from a MemorySegment.

Carl Dea, Azul’s senior developer advocate, has created a working application for the Foreign Function & Memory API on GitHub.

Project Loom
This project is designed to explore, incubate, and deliver Java VM features and APIs to support lightweight concurrency and new programming models using JEP 429, JEP 436, and JEP 437. A virtual thread, delimited continuations, and tail calls would accomplish this.

The Scoped Values (Incubator) JEP, formerly named Extent-Local Variables (Incubator), proposes to share immutable data within and across threads. When using many virtual threads, this is preferred to thread-local variables.

To allow additional feedback and experience for this feature to progress, JEP 436 proposes a second preview from JEP 425, Virtual Threads (Preview) in JDK 19. With this feature, Java platform users can write, maintain, and observe high-throughput concurrent applications using lightweight virtual threads. Except for a small number of APIs from JEP 425 that were made permanent in JDK 19, no changes are within this preview. LSET Tech News story on JEP 425 and José Paumard’s screencast at JEP Café provide more details.

In JDK 19, Structured Concurrency (Incubator) was delivered as JEP 428. Introducing a library that treats multiple tasks as a single unit of work simplifies multithreaded programming. Improve reliability, observability, and error handling. Inheritance of scoped values is supported by a new StructuredTaskScope class. This allows threads to share immutable data. More details on JEP 428 at LSET Tech News.

The following GitHub repositories have implemented the Virtual Threads and Structured Concurrency APIs: Nicolai Parlog’s; Bazlur Rahman’s; and Bazlur Rahman’s.

Project Amber
JEP 432 and JEP 433 are part of Project Amber, which explores and incubates smaller Java language features.

Record Patterns (Second Preview) incorporates improvements from JEP 405 (Preview). We can deconstruct record values using record patterns. With JEP 427, Pattern Matching for switch (Third Preview), JEP 420, Pattern Matching for switch (Second Preview), and JEP 406, Pattern Matching for switch (Preview), type patterns have been extended to switch case labels. In JEP 405, named record patterns have been removed from the header of an enhanced for statement

With JEP 433, Pattern Matching for switch (Fourth Preview), JEP 427, Pattern Matching for switch (Third Preview), JEP 421, Pattern Matching for switch (Second Preview), JEP 406, Pattern Matching for switch (Preview), were delivered in JDK 17. JEP 427 introduced simplified switch labels and inference of type arguments for generic type patterns and record patterns.

There is a working application on GitHub, java-19 folder, by Wesley Egberto, Java technical lead at Global Points, that illustrates Record Patterns and Pattern Matching.

JDK 21
One (1) JEP is targeted for JDK 21. Sequenced Collections has been promoted to Targeted in JDK 21. The Collections Framework lacks a well-defined order and uniform set of operations for representing the concept of a collection. LSET Tech News provides more details on JEP 431.

The following JEPs are likely to be included in JDK 21 based on recently submitted drafts and candidates.

Record Patterns, JEP 440, has been promoted to Candidate. Record Patterns (Preview), delivered in JDK 19, is finalized and enhanced by JEP 432. Record patterns deconstruct record values. JEP 420 (second preview), Pattern Matching for switch (preview), released in JDK 18, extends record patterns and type patterns to help you navigate and process data. The enhanced for statement no longer supports record patterns.

JEP 441: Pattern Matching for Switch has also been promoted from JEP Draft 8300542. A finalization of this feature and enhancements are included in JEP 433. JEP 427, Pattern Matching for switch (Third Preview), delivered in JDK 19, JEP 422, Pattern Matching for switch (Second Preview), delivered in JDK 18, and JEP 406, Pattern Matching for switch (Preview). The pattern matching feature enhances the language.

From JEP Draft 8301625, it is now a candidate. Foreign Function & Memory API (Second Preview), delivered in JDK 20, has been refined. Incubating JEP 419, Foreign Function & Memory API (Second Incubator), delivered in JDK 18, and JEP 424, Foreign Function & Memory API (Preview). Java applications can access foreign memory and invoke foreign functions efficiently using this API. Address layouts can now be dereferenced and the VaList class has been removed from JEP 434.

Oracle Java platform architects Ron Pressler and Alan Bateman submitted JEP Draft 8303683, Virtual Threads, this week. JEP 436, Virtual Threads (Second Preview), in JDK 20; and JEP 425, Virtual Threads (Preview), in JDK 19. Virtual threads make it easier to write, maintain, and observe concurrent applications. Thread-local variables are now fully supported in virtual threads, eliminating the option to opt out. See this LSET Tech News story and this JEP Café screen cast by Java developer advocate José Paumard.

As per the six-month release cadence, JDK 21 is expected to be released in mid-September 2023. Developers can expect a feature freeze in mid-June 2023. Here’s more info on other JEP drafts and candidates from LSET Tech News.

You can now download JDK 20 from Oracle, with binaries from other vendors coming soon.

Tech News

Windows Forms Binding Improvements in .NET 7 for MVVM Support img

Windows Forms Binding Improvements in .NET 7 for MVVM Support

Command binding preview features are included in the .NET 7 framework in order to modernize Windows Forms applications…

MicroStream becomes a member of the Eclipse Foundation img

MicroStream becomes a member of the Eclipse Foundation

A Java object-graph persistence framework, MicroStream, has announced its participation in the Eclipse…

Our Latest Blog

Mastering Full Stack Python Development with Django A Comprehensive Guide

Mastering Full Stack Python Development with Django: A Comprehensive Guide

Python is a powerful programming language that has taken the world of web development by...
Read More
Mastering Machine Learning A Beginner's Guide to Python

Mastering Machine Learning: A Beginner’s Guide to Python

Welcome to the world of machine learning! With the ever-increasing demand for artificial intelligence and...
Read More
Unlocking the Power of Data Science with Python A Beginner's Guide

Unlocking the Power of Data Science with Python: A Beginner’s Guide

Data science has become an essential part of many industries today, and Python has become...
Read More

Follow Us


Browse LSET presentations to understand interesting…

Explore Now

Get complete guides to empower yourself academically…

Explore Now

Learn about information technology and business…

Explore Now