Java Development Kit is soon to generally avail the JDK-19 download and they have recently announced the seventh feature that can be look forward to. The new version of JDK is expected to hold a number of features that will bring a significant change in programming. From universal generics to value objects, many features will be included according to Java Enhancement Proposal.
The JDK 19 release is expected in September 2022.
The Java Development Kit 19 has announced the following 7 features-
This is the recently released feature of JDK-19. Structured concurrency is introduced to simplify multithreaded programming. Its goal is to simplify error handling and cancellation by treating tasks running on multiple threads as a single unit. This will be an incubating AOI which will also improve reliability and observability. This concurrent programming style will reduce the risk of cancellations and shutdowns.
Record and type patterns can be nested to create a coherent, efficient, and adaptable data retrieval and processing system. The proposal’s goals include enhancing pattern matching, and defining more advanced, modular data searches while keeping type patterns’ syntax and semantics unchanged. Project Amber, which aims to examine and incubate smaller, productivity-oriented Java technologies, includes Record Patterns.
Foreign Functions and Memory API
A preview of Foreign Functions and Memory API is given. The API will interoperate the java programs with code and data outside the java runtime. Without daggering java native interface, the API can enable java program to call native libraries by evoking foreign functions and accessing foreign memory. This API was first incubated in JDK 17 and reintubated in JDK 18. Ease of use, efficiency, flexibility and security are all aims of the proposal.
This is the preview of lightweight threads that reduces the effort of writing, managing, and analyzing concurrent high-throughput applications. The goal is to enable server applications designed in the basic thread-per-request paradigm to scale with near-optimal hardware usage and to enable existing code that uses the java lang. To enable troubleshooting, debugging, and profiling of virtual threads using existing JDK tools, use the Thread API to deploy virtual threads with minimal change.
Pattern Matching for Switch Experience management
Complicated data-oriented queries can be represented concisely and safely by testing expressions against a number of patterns, each with a distinct action. The potential was already shown in JDK 17 and JDK 18. The third preview would include changes such as the substitution of guarded patterns. In addition, when the value of the selector expression is null, the runtime semantics of a pattern switch is more closely matched with traditional switch semantics.
This is the fourth incubation of vector API that on specified CPU architectures, compile to optimum vector instructions at runtime, achieving performance superior to equivalent scalar computations. Developers that use the API can leverage the HotSpot auto-vectorizer to build complicated vector algorithms in Java, but with a user model that makes vectorizations more predictable and robust. Improvements to the API proposed for JDK-19 features include enhancements to load and store vectors to and from MemorySegments, as defined by the Foreign Function and Memory API preview. JDK 19 would also add two cross-lane vector operations, compress and expand, together with a complementary vector mask compress operation.
Linux RISC-V Post
Java would acquire support for a hardware instruction set that is already supported by a wide range of language toolchains with the Linux/RISC-V port. RISC-V is a collection of similar ISAs. Only the RV64GV configuration of RISC-V, a general-purpose 64-bit ISA with vector instructions, would be supported by the Linux/RISC-V port. Other RISC-V variants may be considered by Java developers in the future.
The rampway of the language will be released on June 9 and July 21 and the release candidate will be published on published August 11 and August 25.