JDK 19: The new features in Java 19

Java Progress Package 19, a non-LTS (extended-phrase assistance) release of standard Java, arrives right now as a production release.

Seven features concentrate on the release which includes structured concurrency, report designs, a preview of a foreign operate and memory API, and help for the open supply Linux/RISC-V instruction set architecture (ISA). All features but the Linux/RISC-V capability are both in preview or incubator phases.

JDK 19 follows the March 22 arrival of JDK 18. Regular Java has been on a six-thirty day period release cadence for 5 a long time, with JDK 19 staying the tenth 6-thirty day period launch.

JDK 19 is out there at oracle.com. The manufacturing launch follows two launch candidates and two rampdown phases, courting back to June. The JDK 19 functions include:

  • Structured concurrency, in an incubator stage, is intended to simplify multithreaded programming through a structured concurrency API. This concurrency treats multiple duties running in various threads as a one device of do the job, to streamline mistake handling and cancellation. Reliability and observability are improved. This characteristic is from Task Loom, which released a new light-weight concurrency model.
  • A preview of file designs, to deconstruct file values. Document designs and style styles can be nested to permit a declarative, effective, and composable form of information navigation and processing. Plans of the proposal include extending sample matching to specific more subtle, composable information queries whilst not changing the syntax or semantics of style styles. This proposal builds on sample matching for instanceof, delivered in JDK 16  in March 2021. Potential ideas may perhaps simply call for history patterns to be prolonged with capabilities this sort of as array patterns and vararg patterns. File designs is component of Task Amber, an effort to take a look at and incubate lesser, productiveness-oriented Java functions.
  • A preview of a foreign purpose and memory API, which would introduce an API by which Java applications can interoperate with code and knowledge outside the house the Java runtime. By successfully invoking overseas functions (i.e., code outside the JVM) and securely accessing foreign memory (i.e., memory not managed by the JVM) the API allows Java programs to phone indigenous libraries and course of action native information without having the risk and brittleness of the Java Indigenous Interface (JNI). The overseas functionality and memory API combines two previously incubating APIs: the overseas memory accessibility API and the overseas linker API. The foreign functionality and memory API was formerly incubated in JDK 17 and reincubated in JDK 18. The proposal’s ambitions contain ease of use, overall performance, generality, and security.
  • A preview of virtual threads, which are light-weight threads that radically decrease the hard work of composing, protecting, and observing high-throughput, concurrent purposes. Plans include things like enabling server programs created in the straightforward thread-for every-request fashion to scale with near-exceptional components utilization, enabling existing code that takes advantage of the java.lang Thread API to undertake digital threads with negligible change, and allow troubleshooting, debugging, and profiling of virtual threads with current JDK resources. It is not a intention of this proposal to transform the fundamental concurrency design in Java or present a new facts parallelism assemble in both the Java language or Java libraries. Nor is it a target to clear away the conventional implementation of threads or to silently migrate existing applications to use digital threads. This function is also section of Undertaking Loom.
  • A 3rd preview of pattern matching for swap expressions and statements, extending pattern matching to swap, to make it possible for an expression to be tested towards a number of styles, each with a precise action, so intricate knowledge-oriented queries can be expressed concisely and safely. This ability previously was previewed in JDK 17 and JDK 18. The 3rd preview would increase refinements like the alternative of guarded patterns with when clauses in change blocks. Also, the runtime semantics of a pattern switch when the value of the selector expression is null are much more closely aligned with legacy swap semantics. The plan’s objectives incorporate increasing the expressiveness and applicability of switch expressions and statements by letting styles to show up in scenario labels. Other targets involve making it possible for builders to loosen up the historic null-hostility of swap when wished-for, raising the basic safety of swap statements and guaranteeing that present switch expressions and statements continue to compile with no changes and execute with similar semantics. The hope is to eventually support pattern matching through Java, including it to sites wherever expressions are employed. This element also is element of the Amber venture.
  • A fourth incubation of a vector API that would specific vector computations that reliably compile at runtime to best vector guidelines on supported CPU architectures, consequently reaching overall performance outstanding to equivalent scalar computations. Builders making use of the API achieve a way to compose intricate vector algorithms in Java, using the HotSpot car-vectorizer but with a user product that makes vectorizations a lot more predictable and strong. The vector API formerly was incubated into JDK 16, JDK 17, and JDK 19.
    Improvements to the API proposed for JDK 19 include enhancements to load and keep vectors to and from MemorySegments, as described by the Overseas Purpose and Memory API preview. JDK 19 would also incorporate two cross-lane vector operations, compress and extend, collectively with a complementary vector mask compress operation. The compress vector procedure maps lanes of a resource vector, selected by a mask, to a place vector in lane order, although the increase operation does the inverse. The compress operation is useful in filtering question final results.
    In a further addition to the vector API, bitwise integral lanewise functions would be expanded, which includes operations this kind of counting the quantity of one bits, reversing the purchase of bits, and compressing and growing bits. Ambitions of the API bundled being very clear and concise, system-agnostic, getting dependable runtime and compilation effectiveness on x64 and AArch64 architectures, and enabling “graceful” degradation, for conditions in which a vector computation can not be completely expressed at runtime as a sequence of vector functions. The vector API is from Task Panama, which aims to help more simple communications amongst indigenous and JVM code.
  • With the Linux/RISC-V port, Java would achieve guidance for a components instruction established that is now supported by a huge range of language toolchains. RISC-V essentially is a relatives of connected ISAs. The Linux/RISC-V port would only assist the RV64GV configuration of RISC-V, a general objective 64-bit ISA that features vector guidance. The developers of Java may possibly consider other RISC-V configurations in the long term.

The port would assistance the adhering to HotSpot VM choices: the template interpreter, C1 (consumer) JIT compiler, C2 (server) JIT compiler, and all recent mainline garbage collectors together with ZGC and Shenandoah. The real porting is almost complete the concentration of the JDK Enhancement Proposal (JEP) is integration of the port into the JDK mainline repository.

Like JDK 18, JDK 19 is because of to be a shorter-expression release, with only 6 months of leading-stage, Leading assist.

The preceding launch, JDK 17, was a Prolonged Time period Aid (LTS) release, with many several years of guidance. It arrived September 14, 2021. The future LTS release, JDK 21, is because of one 12 months from now, preceded by JDK 20, presumably in March 2023.

Copyright © 2022 IDG Communications, Inc.

Jennifer R. Kelley

Next Post

Netgear Nighthawk RAX120 Giveaway: Enter to Win this Cool Router Today!

Tue Sep 20 , 2022
You are in for a possibility to win this Netgear Nighthawk RAX120 giveaway. This router is just one of the initial Wi-Fi 6 routers and has been also just one of the greatest. And it is a single of the coolest-wanting parts of Wi-Fi hardware, as well, which does not harm. […]
Netgear Nighthawk RAX120 Giveaway: Enter to Win this Cool Router Today!

You May Like