June 24, 2024


The Joy of Technology

JDK 19: The features targeted for Java 19


Java Enhancement Package 19, due this September, has just experienced a sixth element proposed for it: a preview of file styles, for info navigation and processing. Report designs joins 5 former attributes, ranging from a preview of a overseas purpose and memory API to support for the open up source Linux/RISC-V instruction set architecture (ISA).

JDK 19, or merely Java 19, most likely could host a broad number of capabilities, ranging from common generics to worth objects, according to strategies underway for improving Java. JDK 19 would stick to JDK 18, which arrived March 22. Regular Java is on a 6-month launch cadence.

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

Early obtain builds of JDK 19 can be accessed from jdk.java.internet/19. Proposed JDK 19 options incorporate:

  • A preview of history styles, to deconstruct file values. Document styles and form styles can be nested to permit a declarative, effective, and composable kind of details navigation and processing. Aims of the proposal include things like extending pattern matching to specific a lot more subtle, composable knowledge queries when not modifying the syntax or semantics of kind designs. This proposal builds on sample matching for instanceof, shipped in JDK 16  in March 2021. Foreseeable future strategies might phone for record styles to be extended with capabilities these types of as array patterns and vararg designs. Report patterns is part of Undertaking Amber, an work to examine and incubate scaled-down, productiveness-oriented Java functions.
  • A preview of a international functionality and memory API, which would introduce an API by which Java applications can interoperate with code and details outside the Java runtime. By proficiently invoking international capabilities (i.e., code outside the house the Java runtime) and safely accessing overseas memory (i.e., memory not managed by the JVM) the API enables Java plans to contact native libraries and process indigenous facts without having the risk and brittleness of the Java Indigenous Interface (JNI). The overseas functionality and memory API brings together two previously incubating APIs: the overseas memory obtain API and the overseas linker API. The international functionality and memory API was earlier incubated in JDK 17 and reincubated in JDK 18. The proposal’s aims contain ease of use, effectiveness, generality, and basic safety.
  • A preview of digital threads, which are light-weight threads that significantly lessen the effort and hard work of producing, maintaining, and observing substantial-throughput, concurrent apps. Plans include enabling server applications written in the very simple thread-per-request design to scale with around-optimal hardware utilization, enabling current code that takes advantage of the java.lang Thread API to adopt digital threads with nominal improve, and empower troubleshooting, debugging, and profiling of digital threads with current JDK equipment. It is not a objective of this proposal to change the essential concurrency product in Java or provide a new data parallelism build in either the Java language or Java libraries. Nor is it a purpose to get rid of the traditional implementation of threads or to silently migrate existing applications to use virtual threads.
  • A third preview of pattern matching for switch expressions and statements, extending sample matching to change, to allow an expression to be examined against a quantity of patterns, every single with a specific action, so intricate data-oriented queries can be expressed concisely and securely. This capability formerly was previewed in JDK 17 and JDK 18. The 3rd preview would add refinements like the replacement of guarded patterns with when clauses in switch blocks. Also, the runtime semantics of a sample swap when the worth of the selector expression is null are more carefully aligned with legacy switch semantics. The plan’s goals incorporate expanding the expressiveness and applicability of swap expressions and statements by allowing patterns to seem in circumstance labels. This will make it possible for builders to unwind the historic null-hostility of swap when sought after, and is meant to enhance the protection of switch statements and be certain that current swap expressions and statements continue to compile with no variations and execute with similar semantics.
  • A fourth incubation of a vector API that would convey vector computations that reliably compile at runtime to ideal vector guidelines on supported CPU architectures, thus achieving general performance remarkable to equal scalar computations. Developers using the API gain a way to write complicated vector algorithms in Java, working with the HotSpot car-vectorizer but with a user design that will make vectorizations far more predictable and sturdy. The vector API beforehand was incubated into JDK 16, JDK 17, and JDK 19.
    Enhancements to the API proposed for JDK 19 include enhancements to load and retailer vectors to and from MemorySegments, as described by the Foreign Function and Memory API preview. JDK 19 would also increase two cross-lane vector operations, compress and broaden, collectively with a complementary vector mask compress operation. The compress vector procedure maps lanes of a source vector, picked by a mask, to a place vector in lane buy, even though the increase procedure does the inverse. The compress procedure is practical in filtering query final results.
    In an additional addition to the vector API, bitwise integral lanewide operations would be expanded, which includes operations these kinds of counting the quantity of a person bits, reversing the buy of bits, and compressing and growing bits. Plans of the API bundled getting obvious and concise, system-agnostic, possessing responsible runtime and compilation functionality on x64 and AArch64 architectures, and enabling “graceful” degradation, for cases in which a vector computation simply cannot be fully expressed at runtime as a sequence of vector operations.
  • With the Linux/RISC-V port, Java would get assist for a components instruction set that is by now supported by a extensive selection of language toolchains. RISC-V truly is a household of related ISAs. The Linux/RISC-V port would only guidance the RV64GV configuration of RISC-V, a basic objective 64-bit ISA that contains vector directions. The builders of Java may perhaps look at other RISC-V configurations in the future.

The port would support the following HotSpot VM alternatives: the template interpreter, C1 (customer) JIT compiler, C2 (server) JIT compiler, and all recent mainline rubbish collectors together with ZGC and Shenandoah. The true porting is just about comprehensive the aim of the JDK Enhancement Proposal (JEP) is integration of the port into the JDK mainline repository.

Like JDK 18, JDK 19 is owing to be a shorter-term release, with only 6 months of top rated-amount, Leading aid.

The previous launch, JDK 17, was a Prolonged Phrase Support (LTS) release, with various years of guidance. It arrived September 14, 2021.

Copyright © 2022 IDG Communications, Inc.


Resource connection