Java 20: What's Coming Next

With Java 19 having just arrived on September 20, Java 20 is next on the docket, expected in March 2023. The release potentially could add new functionality for universal generics, immutable data, and string templates and finalize capabilities such as record patterns.

The current OpenJDK webpage for JDK 20 lists no officially proposed features as of September 23, but that will change soon enough. Capabilities that could make it into Java 20 include:

  • Universal generics, to unify the treatment of reference and primitive types in generic code. This proposal has been floating for a while and did not make it into JDK 19.
  • Extent-local variables, to enable sharing of immutable data within and across threads.
  • String templates, to simplify Java programming by making it easy to express strings that include values computed at run time.
  • Value objects, to enhance the Java object model with class instances that have only final instances and lack object identity.
  • Primitive classes, which are special kinds of value classes that define new primitive types.
  • Sequenced collections, providing a Collection interface to represent a collection with a defined encounter order.
  • An API for asynchronous stack traces, which would provide information on Java and native frames.
  • A classfile API, to parse, generate, and transform Java class files.
  • Record patterns, previewed in JDK 19, for deconstructing record values.
  • Foreign function and memory API, previewed in JDK 19 as a mechanism for Java programs to interoperate with code and data outside the Java runtime.
  • Another JDK 19 preview feature, virtual threads, serves as lightweight threads to make it easier to write and maintain high-throughput concurrent applications.
  • A vector API, incubated for a fourth time in JDK 19, expresses vector computations that reliably compile at runtime to optimal instructions on supported CPU architectures, achieving better performance than scalar computations.
  • Structured concurrency, in an incubator phase in JDK 19, would simplify multithreaded programming via an API.
  • Pattern matching for switch expressions and statements, previewed for a third time in JDK 19, to enhance Java programming.

Based on standard Java’s six-month release cadence, Java 20, or Java Development Kit 20, would arrive as a production release in March 2023. Like JDK 19, JDK 20 would be a short-term release with only six months of premium support from Oracle. The following JDK 21 is due in a year and would be an LTS (Long Term Support) release with several years of backing by Oracle.