Draft JEPs for Patterns in switch and Record Patterns
Gavin Bierman
gavin.bierman at oracle.com
Tue Feb 28 16:21:42 UTC 2023
Hello,
We are planning to finalize the two pattern matching JEPs in JDK 21. Drafts of
these final JEPs are available here:
Pattern matching for switch: https://openjdk.org/jeps/8300542
Record patterns: https://openjdk.org/jeps/8300541
We're proposing some small changes from the preview versions about to appear in
JDK 20. These include:
- We're dropping parenthesized patterns. They were leftover from a previous
version of patterns, and they weren't used very much. They complicate the spec
for not a lot of gain.
- We're going to support case labels that are the qualified name of enum
constants, and allow switches over non-enum types to have enum case labels
provided they use the qualified names of the enum constants and these labels
are assignment compatible with the switch type.
- We're dropping the support for record patterns in the header of enhanced for
statements. These will re-appear in a separate forthcoming JEP.
Please take a look at these new JEPs and give us your feedback (either on this
list or directly to me).
Thanks,
Gavin
More information about the amber-spec-experts
mailing list