JDK 19 / Java 19 Official GA

JDK 19 / Java 19 has been officially released .

The new release contains a total of 7 new JEPs:

405: Record Patterns (Preview)
422: Linux/RISC-V Port
424: Foreign Function & Memory API (Preview)
425: Virtual Threads (Preview)
426: Vector API (Fourth Incubator)
427: Pattern Matching for switch (Third Preview)
428: Structured Concurrency (Incubator)
  • 405: Record Patterns enter the preview stage

Record Patterns deconstruct record values. Record patterns and Type patterns can be nested to achieve powerful, declarative, and composable forms of data navigation and processing.

This feature is currently in preview.

  • 422: Porting JDK to Linux/RISC-V platform

Currently only the RV64GV configuration of RISC-V is supported, which is a generic 64-bit ISA. Support for other RISC-V configurations, such as the generic 32-bit configuration (RV32G), will be considered in the future.

  • 424: Foreign Function & Memory API has entered the preview stage

Java programs can interoperate with code and data outside the Java runtime through this API. By efficiently calling external functions (that is, code outside the JVM) and safely accessing external memory (that is, memory not managed by the JVM), this API enables Java programs to call native libraries and process native data without the As dangerous and fragile as JNI.

One sentence summary: This feature makes it more convenient and efficient for Java to call ordinary native code.

  • 425: Virtual Threads (Virtual Threads) enter the preview stage

Introduces virtual threads for Java. Virtual threads are lightweight threads implemented by JDK that have proven useful in other multithreaded languages, such as Goroutines in Go and processes in Erlang. Virtual threads avoid the extra cost of context switching, take into account the advantages of multi-threading, simplify the complexity of high-concurrency programs, and effectively reduce the workload of writing, maintaining, and observing high-throughput concurrent applications.

For details, see  Java's introduction of the preview version of the virtual thread (coroutine) function, which greatly improves application throughput

  • 426: Vector API (Vector API) enters the 4th incubation stage

Vector computation consists of a series of operations on vectors. The Vector API is used to express vector computations that can be reliably compiled at runtime to the best vector instructions on the supported CPU architecture, resulting in better performance than equivalent scalar computations. The goal of the Vector API is to provide users with concise, easy-to-use, platform-independent representations of a wide range of vector computations.

  • 427: Switch pattern matching (Pattern Matching for switch) enters the third preview stage

Enhance the Java programming language with switchpattern matching of expressions and statements, and extensions to the pattern language. Extends pattern matching to switch, allowing expressions to be tested against some patterns, so that complex data-oriented queries can be expressed concisely and safely.

  • 428: Structured Concurrency enters the incubation stage

JDK 19 introduces structured concurrency, a multi-threaded programming method that aims to simplify multi-threaded programming through structured concurrency APIs, not to replace java.util.concurrent, which is currently in the incubation stage.

Structured concurrency treats multiple tasks running in different threads as a single unit of work, simplifying error handling, improving reliability, and enhancing observability. That is, structured concurrency preserves the readability, maintainability, and observability of single-threaded code.

Download address | Release Note

おすすめ

転載: www.oschina.net/news/211079/jdk-19-ga