7 New JDK 19 Features Explained
Infiraise
Posted on November 1, 2023
The features for Java Development Kit 19 have been frozen, and the non-LTS update is due to release in September 2022. This update will be a predecessor to JDK 18, which was released in March 2022. The update is now feature-complete, and there is a lot to explore in the JDK 19 feature list from Record Patterns to Structured Concurrency.
Earlier this June, the kit just reached its ramp-down phase one. Before we dive into these features one by one, here is the complete timeline for JDK 19: The second ramp-down phase will begin on July 21, 2022. The initial release candidate would be on August 11, 2022, and the final release candidate is slated for August 25, 2022. JDK 19 will be generally available from September 9, 2022.
There are seven features to look forward to: Record Patterns, Linux/RISC-V Port, Foreign Function & Memory API, Virtual Threads, Vector API, Pattern Matching for the switch, and Structured Concurrency.
Record Patterns
A preview language feature, record patterns, and type patterns will allow developers to navigate and process the composable and powerful forms of data.
This JDK 19 feature will be a part of Project Amber which aims to incubate and explore productivity-oriented Java language features.
Without making any changes to the semantics or syntax of type patterns, this feature aims to express composable and sophisticated data queri
Linux/RISC-V Port
With this feature, It would be possible to port the JDK to Linux/RISC-V. A wide range of language toolchains already supports this hardware instruction set. At the core, RISC-V is a free open-source instruction set architecture (SIA).
Currently, Linux/RISC-V port will only support general-purpose 64-bit SIA that has vector instructions: an RV64GV configuration of RISC-V. In the future, the developers may also consider configuring general-purpose 32-bit, the RV32G.
HotSpot subsystems that will be supported by this JDK 19 feature:
- C1 (client) JIT compiler
- C2 (server) JIT compiler
- Template interpreter
- All mainline GCs, including ZGC and Shenandoah
Foreign Function & Memory API
Aimed to enhance safety, generality, and ease of use with performance, This API is a combination of foreign memory access API and foreign linker API. This was first incubated in JDK 17 and reincubated in JDK 18.
With this API, Java programs can interoperate with data and code outside the Java runtime. It also aims to mitigate the brittleness of Java Native Interface (JNI).
This API can efficiently invoke codes outside JVM (foreign functions), and access the memory not managed by JVM (foreign memory) safely. The foreign function and memory API enables programs to call native data and libraries while avoiding the danger of JNI.
Virtual Threads
With high-throughput concurrent applications, virtual threads reduce the effort of maintaining, observing, and even writing due to their lightweight operation.
Not only this preview API will enable thread-per-request style applications to scale with optimal hardware utilisation, but it will also help java. lang. Thread API to adopt this API without many changes.
It will also enable profiling, debugging, and troubleshooting of virtual threads with existing JDK tools without removing the traditional implementation of threads and changing the basic Java concurrency model.
Article Source: https://www.infiraise.com/7-new-jdk-19-features-explained/
Posted on November 1, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.