With Java 18 due as a production release in two weeks, Java 19 is beginning to take shape. The next release of standard Java is set to move forward with an API to interoperate with code outside the Java runtime, the first of many potential proposals that could cover capabilities ranging from universal generics to a RISC-V port.The Java 19 proposal now floating in the OpenJDK community is a foreign function and memory API, which would allow Java programs to interoperate with code and data outside of the Java runtime. The feature will be previewed in Java Development Kit (JDK) 19, which is expected to arrive this September.Identified as JEP (JDK Enhancement Proposal) 424, the foreign function and memory API would invoke code outside the JVM by accessing foreign memory. This API was featured in an incubator stage in JDK 17 and will be re-incubated in JDK 18, which is scheduled to ship on March 22. For JDK 19, the API would move to a preview stage, incorporating refinements based on feedback. JDK 19 will be a short-term release of Java supported for just six months.Another possibility for inclusion in JDK 19 is a vector API, which is being incubated for a third time in JDK 18. A fourth incubation has been proposed. This API would express vector computations that compile at runtime to optimal vector instructions. Pattern matching for switch expressions and statements, which is undergoing a second preview in JDK 18, is another possibility.Overall, Java this year is slated to continue the evolution of four initiatives, Oracle said. These include Project Valhalla, to incubate advanced JVM and language features; Project Panama, to interconnect native and JVM code; Project Loom, to improve concurrency; and Project Amber, to explore and incubate smaller, productivity-oriented Java language features.The following features, which are the subject of JEPs or draft JEPs not now targeted to a specific version of Java, could very well find their way into Java 19:
A preview of universal generics, from Valhalla. Delivered through three JEPs, universal generics would unify the treatment of reference and primitive types in generic code by allowing Java type variables to range over both kinds of types.
A preview of value objects, also an enhancement from Valhalla, providing class instances that have only final instance fields and lack object identity. Identity-free value classes would be declared.
A preview of record patterns, to deconstruct record values. This is part of Project Amber.
Region pinning for the G1 garbage collector, to reduce latency by implementing region pinning to G1 so garbage collection does not need to be disabled during JNI (Java Native Interface) critical regions.
A Linux port of the JDK for RISC-V, an open source, royalty-free instruction set architecture.
Some of these features, if they do not end up in JDK 19, might end up in a subsequent release such as JDK 20, which would arrive in March 2023, based on standard Java’s six-month release cadence. Others might slip to an even later release or perhaps never make the cut to be in Java at all.
Copyright © 2022 IDG Communications, Inc.