Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

JDK 28 Drops Primitive Pattern Matching After 5 Previews — Valhalla Conflict Cited

JDK 28 withdraws JEP 532 (Primitive Types in Patterns, instanceof, and switch) after five preview rounds because Project Valhalla's evolving numeric model may conflict with its exact numeric conversion semantics; the Amber team plans Constant Patterns as an alternative, retaining some gains.

Short-Lived JEP 532

On November 9, 2026, Angelos Bimpoudis and Gavin Bierman announced on the OpenJDK amber-spec-experts mailing list that development of Primitive Types in Patterns, instanceof, and switch (JEP 532) would stop. The feature had gone through five preview rounds from JDK 23 (JEP 455) to JDK 27 (JEP 532) with zero changes in the last two rounds, and many developers expected it to finalize in JDK 28. Instead, it will be removed entirely — even with --enable-preview.

What JEP 532 Aimed to Solve

The feature extended pattern matching to primitive types ( int, long, double, boolean, etc.), addressing two long-standing gaps:

Switch on primitives beyond int : Previously switch only accepted byte, short, char, int, and reference types. JEP 532 allowed switch on long and boolean.

Lossless conversion checks via instanceof : The feature introduced exact numeric conversion semantics. For example:

long v = 3_000_000_000L;
if (v instanceof int i) {
    // matches only if v fits in int without loss; i is directly usable
}

Here 3_000_000_000 exceeds int range, so the pattern fails — eliminating manual range checks like -128 <= i && i <= 127.

Why It Was Withdrawn

The withdrawal email explicitly ties the decision to Project Valhalla, which is exploring a new vision for Java's numeric system, including user-defined numeric types. The reasoning chain:

Valhalla may introduce custom numeric types beyond the current eight primitives.

Those new types will need exact numeric conversion semantics — the same foundation JEP 532 relies on.

Finalizing JEP 532 now on today's definition of exact conversion risks semantic conflict when Valhalla lands, saddling Java with a permanent compatibility burden.

In short: the feature isn't bad, but its semantic ground may shift. The team prefers to withdraw now and revisit after Valhalla's direction solidifies.

The email notes that preview withdrawal is allowed by JEP 12 (Preview Feature Specification) — preview features can be removed via a JBS issue without a new JEP. This confirms the preview mechanism is a genuine "test field," not a formality.

Alternative: Constant Patterns

Amber plans to introduce Constant Patterns, allowing constants as nested patterns in record patterns (e.g., case Point(0, 0)). This inherits some JEP 532 work, including extended switch support for primitives, and reduces reliance on when clauses. The five years of exploration are not wasted; they live on in a different form.

Project Amber: Nine Years of Incremental Language Evolution

Project Amber (started 2017, led by Brian Goetz) focuses on small, high-productivity language features. Its track record includes: var (JDK 10)

Switch expressions (JDK 14)

Text Blocks (JDK 15) instanceof pattern matching (JDK 16)

Records (JDK 16)

Sealed Classes (JDK 17)

Switch pattern matching & record patterns (JDK 21)

Unnamed variables/patterns, module imports, compact source files, flexible constructor bodies (JDK 22–25)

Amber has also seen withdrawals: String Templates (JEP 465) was pulled after two previews in JDK 23. The JEP 532 withdrawal is the second such case, reinforcing that the preview process is real — community feedback and long-term consistency trump release schedules.

Looking Ahead

JDK 28's headline features now shift to value objects (Valhalla), structured concurrency (finalized), AOT compilation, and default generational Shenandoah GC. When Valhalla arrives, Java's performance story may be rewritten.

JEP 532 preview history table
JEP 532 preview history table
Project Valhalla illustration
Project Valhalla illustration
About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

Project Valhallapattern matchingprimitive typespreview featuresProject AmberJDK 28Java language evolutionJEP 532

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion