r/java • • 21d ago

Withdrawing the Primitive Patterns preview feature in JDK 28

https://mail.openjdk.org/archives/list/amber-spec-experts@openjdk.org/thread/UYEK3PGOHN6R56AHJTSLPGAY363K666S/

Primitive Types in Patterns will be removed in JDK 28 and will no longer be available in that release.

The Valhalla project has been exploring a new vision for Java numerics, including the possibility of user-defined numeric types. New kinds of numeric types would need to support exact numeric conversion, and vice versa. Given that the Valhalla work is still evolving, it would be premature to finalize Primitive Types in Patterns with their current definition of exact numeric conversion.

93 Upvotes

36 comments sorted by

View all comments

Show parent comment

7

u/vips7L 20d ago

If as an expression would be nice too. I tend to always make these tiny functions for these situations. 

2

u/koflerdavid 19d ago

Blocks should be generalized to be value returning if used in a RHS position. That would also be useful to group variable initialization statements together.

1

u/simon_o 16d ago

Unified condition expressions can express if-then-else, the ternary operator, switches and pattern matching all in one syntax and work as both expressions and statements.

But that's of course too late for Java.

2

u/vips7L 16d ago

That’s why I write Kotlin now ;)

1

u/simon_o 15d ago

Kotlin still has if and switch.