Java Development Kit 22, due to arrive in March 2024 as the next planned version of Java Standard Edition, is off and running. The first feature, a foreign function and memory API, has been officially proposed to target the release.
The foreign function and memory API allows Java programs to interoperate with code and data outside of the Java runtime. By invoking foreign functions and safely accessing foreign memory, Java programs can call native libraries and process native data without the brittleness of JNI (Java Native Interface), the proposal states.
The foreign function and memory API previously was previewed in JDK 19, JDK 20, and JDK 21. It would be finalised in JDK 22. The latest revisions cover three areas: supporting arbitrary charsets for native strings, enabling clients to build C-language function descriptors programmatically, and introducing the
Enable-Native-Access JAR-file manifest attribute. The latter allows executable JAR files to call restricted methods without having to use the
--enable-native-access command-line option.
Due March 19, 2024, Java 22 is a Feature release that will receive six months of support from Oracle, unlike just-released JDK 21, which is a Long Term Support (LTS) release that will receive at least eight years of support. Companies besides Oracle could offer longer support for JDK 22 if they so choose. Standard Java updates occur every six months, and LTS releases arrive every two years.
Other capabilities likely to appear in JDK 22 include features also previously previewed, such as string templates and unnamed classes and instance main methods. Other capabilities that could make their first appearance in JDK 22 include a class-file API, for parsing, transforming, and generating Java files, and computed constants, which are immutable value holders that are initialised at most once.
Prior to general availability, JDK 22 is set to go through rampdown phases next January and February, followed by two release candidates in February 2024.