A third preview ofprimitive types in patterns, instanceof, and switch would enhance pattern matching by allowing primitive types in all pattern contexts and extendinstanceof
andswitch
to work with all primitive types. Originally proposed inJDK 23 and followed up in JDK 24, this would still be a preview language feature in JDK 25. Among goals are enabling data exploration by allowing type patterns for all types, whether primitive or reference, and providing easy-to-use constructs that eliminate the risk of losing information due to unsafe casts.
Scoped values, to be previewed for a fifth time, allows a method to share immutable data with its callees within a thread and with child threads. Scoped values are easier to reason about than thread-local variables, according to the OpenJDK JDK Enhancement Proposal (JEP). They also have lower space and time costs, especially when used together with virtual threads and structured concurrency. Goals of the plan include ease of use, comprehensibility, robustness, and performance. The scoped values API was proposed for incubation inJDK 20, proposed for preview inJDK 21, and subsequently refined forJDK 22 throughJDK 24. The feature will be finalized in JDK 25, with one change: theScopedValue.orElse
method no longer acceptsnull
as its argument.
Thevector API is designed to express vector computations that reliably compile at runtime to optimal vector instructions on supported CPUs, thus achieving performance superior to equivalent scalar computations. The API will be incubated for the 10th time in JDK 25, after having been incubated in every release dating back toJDK 16. Two notable implementation changes are featured in the JDK 25 implementation of the API. First, the implementation now links to native mathematical-function libraries via theForeign Function and Memory API rather than customC++ code inside the HotSpot JVM, thus improving maintainability. Second, addition, subtraction, division, multiplication, square root, and fused multiply/add operations onFloat16
values now are auto-vectorized on supporting x64 CPUs. Additionally,VectorShuffle
now supports access to and fromMemorySegment
.