Primitive type patterns - an alternative approach (JEP 507)

David Alayachew davidalayachew at gmail.com
Wed Oct 15 11:25:15 UTC 2025


Hello Stephen,

I already gave my thoughts on your Reddit post [1], so I'll avoid
duplicating them here.

All I'll add is that you should CC Valhalla Dev as well. Not only are you
explicitly naming value types as part of your reasoning, but the recent
Valhalla videos that came out seem to mention (in passing) some of the
things you are concerned about.

Thank you for your time.
David Alayachew

[1] =
https://old.reddit.com/r/java/comments/1o747zu/type_conversion_in_java_an_alternative_proposal/njlech1/

On Wed, Oct 15, 2025, 2:35 AM Stephen Colebourne <scolebourne at joda.org>
wrote:

> In the vein of JEP feedback, I believe it makes sense to support
> primitive types in pattern matching, and will make sense to support
> value types in the future. And I can see the great work that has been
> done so far to enable this.
>
> Unfortunately, I hate the proposed syntactic approach in JEP 507. It
> wasn't really clear to me as to *why* I hated the syntax until I had
> enough time to really think through what Java does in the area of
> primitive type casts, and why extending that as-is to pattern matching
> would IMO be a huge mistake.
>
> (Please note that I fully grasp the pedagogical approach wrt
> instanceof defending an unsafe cast, but no matter how much it is
> repeated, I don't buy it, and I don't believe it is good enough by
> itself.)
>
> To capture my thoughts, I've written up how Java's current approach to
> casts leads me to an alternative proposal - type conversion casts, and
> type conversion patterns:
> https://tinyurl.com/typeconvertjava1
>
> thanks
> Stephen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20251015/ad0010f4/attachment.htm>


More information about the amber-dev mailing list