JDK 19 · JSR 394

Java 19

JDK 19 is Java SE 19, JSR 394, generally available on 20 September 2022. Virtual threads, record patterns, and the foreign function and memory API are previews. Structured concurrency is an incubator API, not a preview and not a final API.

How to read the status

Language

Virtual Threads (Preview)

JEP 425 · Preview · Language

Virtual threads are lightweight threads for blocking work. In Java 19 they are a preview.

Second preview in Java 20 (JEP 436). Final in Java 21 (JEP 444).

OpenJDK JEP 425 (leaves JavaMastery)

Related reading: Concurrency

APIs / Libraries

Structured Concurrency (Incubator)

JEP 428 · Incubator · APIs / Libraries

An incubator API treats related tasks as one unit of work. It is not a preview feature and not a standard API.

Second incubator in Java 20 (JEP 437). Preview from Java 21 (JEP 453) through Java 25 (JEP 505). It is not final in Java 25.

OpenJDK JEP 428 (leaves JavaMastery)

Related reading: Concurrency

Foreign Function & Memory API (Preview)

JEP 424 · Preview · APIs / Libraries

The foreign function and memory API leaves incubation and becomes a preview.

Final in Java 22 (JEP 454).

OpenJDK JEP 424 (leaves JavaMastery)

Also in this release: a Linux/RISC-V port (JEP 422).

Examples

  • versions6Java21Features.javaModern Java 21 example · Requires Java 21Virtual threads, record patterns, and pattern matching for switch were previews in Java 19 and became final in Java 21. This source requires Java 21. It is not a Java 19 program.

Related reading

Historical notes

The linked file is a Java 21 program. Virtual threads, record patterns, and switch patterns were previews in Java 19. Structured concurrency was an incubator in Java 19, and that file does not demonstrate it.

Sources. General availability, JSR 394, and the JEP list: OpenJDK JDK 19. OpenJDK JDK 19 (leaves JavaMastery)

All versions