The Java language team has decided to stop work on Primitive Types in Patterns, instanceof, and switch. Inside Java published the news on November 11, 2026, after a note to the Amber spec-experts list on November 9.
The planned sixth preview, which was still a draft JEP, will not go ahead. The feature will be taken out of JDK 28 completely, so it will not work there even if you pass the enable-preview flag.
What Was Announced
Primitive Types in Patterns, instanceof, and switch was meant to make pattern matching work with primitive types such as int and double. Its first preview shipped in JDK 23 (JEP 455), then it was previewed again in JDK 24, 25, 26 and 27.
The team says each round improved the feature. Still, it judged that finalizing the current rules would be too early, so it chose to stop rather than run a sixth preview.
Why the Feature Is Being Withdrawn
The reason is the relationship with Project Valhalla. Valhalla is exploring a new vision for numbers in Java, including the possibility of user-defined numeric types.
Any new numeric type would have to work with exact numeric conversion. That idea lets pattern matching separate lossy conversions from lossless ones, and it is central to the withdrawn feature.
Because the Valhalla work is still changing, fixing the current definition now could cause trouble later.
The team admits that pulling a preview feature is rare. JEP 12, the document describing the preview process, already foresees it and lets a feature be dropped through a tracker issue, with no new JEP.
What the Feature Offered
The draft JEP shows what developers were waiting for. Primitive type patterns in switch would let a final case bind the matched value, so a default branch could become a case that exposes the number and reports it in a message.
- Primitive type patterns in switch, including guards such as a case with a when condition on an int value.
- Safer decomposition of records, so a record component declared as double could be matched against an int pattern only when the value converts without loss.
- Support for switch over all primitive types, in the spirit of the earlier enum and string switch additions.
Constant Patterns Come Next
The team plans to bring a different feature, Constant Patterns, in the meantime. It carries forward part of the primitive patterns work, including wider primitive support in switch expressions and statements.
With it, some constants can sit as patterns inside record patterns. The example is a Point record matched against two zeros, which shortens code and removes certain when clauses. A draft JEP is expected soon.
What It Means for Developers
If you have been testing this preview on JDK 23 to 27, plan to remove its use before moving to JDK 28. Code that relies on primitive patterns will no longer compile there, even with preview features turned on.
Preview features are never meant for production code, so this change mainly affects experiments, demos and library branches that track the newest JDK. It is a good reminder to keep preview code isolated and easy to rewrite.
Where you used a primitive pattern, the usual approach still works: match the reference type or record, then convert or compare the primitive value in ordinary code. Watch for the Constant Patterns draft JEP, because it may cover the simple record cases that primitive patterns would have handled.
Conclusion
Java will not ship primitive patterns in JDK 28, because the team wants to see how Valhalla shapes numeric types first. The feature is removed after five previews, and Constant Patterns is the next related change to follow.
Sources
- Inside Java: Withdrawing the Primitive Patterns Preview Feature
- OpenJDK amber-spec-experts: Withdrawing the Primitive Patterns preview feature
- OpenJDK: Draft JEP, Primitive Types in Patterns, instanceof, and switch (Sixth Preview)
See my articles more often when you search Google.
