Code on a screen, representing the Java 22 release.

Java 22 finalized the Foreign Function and Memory API for calling native code, previewed stream gatherers and statements before super, and let developers run multi-file source programs directly.

What happened

Java 22 (JDK 22) was released on March 19, 2024, according to Oracle's official announcement on inside.java by Sharat Chander. It was the 13th feature release delivered on time through the six-month release cadence and delivered 12 enhancements significant enough to warrant their own JDK Enhancement Proposals, including seven preview features and one incubator feature. Oracle noted it would not offer long-term support for JDK 22, which would be superseded by JDK 23.

Foreign Function and Memory API

The headline was the finalisation of the Foreign Function and Memory API through JEP 454, after several preview rounds. It lets Java programs interoperate with code and data outside the Java runtime, efficiently invoking foreign functions and safely accessing foreign memory, replacing the brittle Java Native Interface with a concise, pure-Java API that guarantees no use-after-free bugs even across threads.

Language and library previews

Java 22 finalised unnamed variables and patterns via JEP 456, denoted by an underscore for declarations that are required but unused. It previewed statements before super() so constructors can run logic that does not reference the new instance before an explicit superclass call, a second preview of string templates, a preview Class-File API for parsing and generating class files, and stream gatherers via JEP 461 to support custom intermediate stream operations.

Tooling and performance

The release added the ability to launch multi-file source-code programs via JEP 458, letting developers run a program supplied as multiple Java source files without compiling first, easing the transition from small to larger programs. It also delivered regional pinning for the G1 garbage collector to reduce latency during JNI critical regions, plus garbage-collector throughput improvements and hundreds of smaller updates.

Why it mattered

Java 22 matured several long-running efforts, most notably finalising the Foreign Function and Memory API that modernises native interop. Together with ergonomic previews and the ability to run multi-file source programs directly, it continued Java's steady, predictable evolution between its long-term-support releases.

See also: Java 21 and virtual threads.

Sources

Published date reflects the original event date (2024-03-19). This article is original Skillo editorial written from the sources above; facts were verified in September 2026.

Skillo Staff

Skillo Staff

All stories by: Skillo Staff

Leave a Reply