New candidate JEP: 507: Primitive Types in Patterns, instanceof, and switch (Third Preview)

Gavin Bierman gavin.bierman at oracle.com
Tue Apr 15 09:39:50 UTC 2025


Hi Glavo,

There was some discussion about the reasons for previewing on the spec-experts list: https://mail.openjdk.org/pipermail/amber-spec-experts/2025-April/004254.html

The basic point is that this JEP overlaps with forthcoming features in Valhalla; so we’re being cautious to make sure we don’t have to undo something that crops up from Valhalla.

Kind request in the meantime: Please try this feature out in anger, and report back what you found (good and bad). We need more feedback from the community on preview features like this one :-)

Thanks,
Gavin

On 14 Apr 2025, at 22:54, Glavo <zjx001202 at gmail.com> wrote:

Hi,

It looks like it has not changed since the original version (JEP 488).
Why does it need a third preview? This makes it not production-ready in JDK 25.
Is there some hidden danger that I'm not aware of that makes people hesitant about it?

Glavo

On Tue, Apr 15, 2025 at 4:17 AM Mark Reinhold <mark.reinhold at oracle.com<mailto:mark.reinhold at oracle.com>> wrote:
https://openjdk.org/jeps/507

  Summary: Enhance pattern matching by allowing primitive types in all
  pattern contexts, and extend instanceof and switch to work with all
  primitive types.  This is a preview language feature.

- Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20250415/da699d46/attachment.htm>


More information about the amber-dev mailing list