JDK 19: The features targeted for Java 19

Java Advancement Package 19, due this September, now has five features formally proposed for it. A few recent additions, a foreign operate and memory API, digital threads, and pattern matching (all previews), join two formerly cited capabilities, a vector API (in a fourth incubation) and a port of the JDK to the open source Linux/RISC-V instruction set architecture (ISA).

JDK 19, or just Java 19, perhaps could host a extensive selection of characteristics, ranging from common generics to price objects, according to strategies under way for improving Java. JDK 19 would follow JDK 18, which arrived March 22. Standard Java is on a six-thirty day period launch cadence.

The OpenJDK developers have printed an formal launch program for JDK 19, which has it arriving September 20 as a production release, preceded by rampdown phases June 9 and July 21, and launch candidates to be published August 11 and August 25.

Early obtain builds of JDK 19 can be accessed from jdk.java.net/19. The proposed JDK 19 attributes include things like:

  • A preview of a overseas function and memory API, which would introduce an API by which Java programs can interoperate with code and data outside the house the Java runtime. By competently invoking international functions (i.e., code outdoors the Java runtime) and securely accessing international memory (i.e., memory not managed by the JVM) the API permits Java applications to connect with native libraries and method indigenous knowledge without the need of the threat and brittleness of the Java Native Interface (JNI). The international operate and memory API brings together two earlier incubating APIs, the foreign memory entry API and the foreign linker API. The foreign purpose and memory API was beforehand incubated in JDK 17 and reincubated in JDK 18. Goals of the proposal include ease of use, effectiveness, generality, and protection.
  • A preview of virtual threads, which are light-weight threads that considerably lessen the energy of creating, protecting, and observing superior-throughput concurrent apps. Plans contain enabling server purposes published in the easy thread-for every-ask for design and style to scale with in close proximity to-best hardware utilization, enabling current code that takes advantage of the java.lang Thread API to adopt virtual threads with negligible modify, and empower troubleshooting, debugging, and profiling of virtual threads with existing JDK resources. It is not a goal of this proposal to transform the primary concurrency model in Java or supply a new info parallelism construct in either the Java language or Java libraries. Nor is it a target to eliminate the common implementation of threads or to silently migrate present programs to use digital threads.
  • A third preview of pattern matching for change expressions and statements, extending pattern matching to change, to permit an expression to be analyzed from a range of patterns, every with a precise motion, so intricate knowledge-oriented queries can be expressed concisely and properly. This capacity earlier was previewed in JDK 17 and JDK 18. The third preview would include refinements such as the substitution of guarded styles with when clauses in swap blocks. Also, the runtime semantics of a pattern change when the value of the selector expression is null are much more intently aligned with legacy change semantics. Objectives of the strategy incorporate growing the expressiveness and applicability of change expressions and statements by enabling styles to appear in circumstance labels, allowing the historic null-hostility of swap to be peaceful when ideal, escalating the security of switch statements, and ensuring that existing switch expressions and statements carry on to compile with no modifications and execute with identical semantics.
  • A fourth incubation of a vector API that would categorical vector computations that reliably compile at runtime to optimal vector directions on supported CPU architectures, consequently achieving general performance outstanding to equal scalar computations. Builders working with the API acquire a way to publish complex vector algorithms in Java, making use of the HotSpot auto-vectorizer but with a person product that helps make vectorizations additional predictable and strong. The vector API earlier was incubated into JDK 16, JDK 17, and JDK 19.
    Advancements to the API proposed for JDK 19 contain enhancements to load and retailer vectors to and from MemorySegments as described by the foreign purpose and memory API preview. JDK 19 would also incorporate two cross-lane vector operations, compress and increase, collectively with a complementary vector mask compress procedure. The compress vector operation maps lanes of a supply vector, chosen by a mask, to a spot vector in lane get though the grow operation does the inverse. The compress operation is beneficial in filtering question success.
    In yet another addition to the vector API, bitwise integral lanewide operations would be expanded, which includes operations these types of counting the selection of one particular bits, reversing the order of bits, and compressing and expanding bits. Goals of the API provided staying crystal clear and concise, system-agnostic, possessing reliable runtime and compilation general performance on x64 and AArch64 architectures, and enabling “graceful” degradation, for scenarios in which a vector computation are not able to be thoroughly expressed at runtime as a sequence of vector operations.
  • With the Linux/RISC-V port, Java would achieve aid for a components instruction set that is by now supported by a vast vary of language toolchains. RISC-V actually is a loved ones of similar ISAs. The Linux/RISC-V port would only aid the RV64GV configuration of RISC-V, a normal reason 64-bit ISA that includes vector recommendations. The builders of Java may perhaps contemplate other RISC-V configurations in the potential.

The port would support the following HotSpot VM options: the template interpreter, C1 (consumer) JIT compiler, C2 (server) JIT compiler, and all latest mainline garbage collectors together with ZGC and Shenandoah. The actual porting is approximately entire the emphasis of the JDK Improvement Proposal (JEP) is integration of the port into the JDK mainline repository.

Like JDK 18, JDK 19 is thanks to be a shorter-expression launch, with only six months of top-level, Premier guidance.

The preceding launch, JDK 17, was a Extended Phrase Assistance (LTS) launch, with numerous many years of guidance. It arrived September 14, 2021.

Copyright © 2022 IDG Communications, Inc.