Draft JEPs for Patterns in switch and Record Patterns
Gavin Bierman
gavin.bierman at oracle.com
Wed Mar 1 00:42:40 UTC 2023
Fixed. Thanks.
> On 28 Feb 2023, at 21:30, Remi Forax <forax at univ-mlv.fr> wrote:
>
> ----- Original Message -----
>> From: "John Hendrikx" <hjohn at xs4all.nl>
>> To: "Gavin Bierman" <gavin.bierman at oracle.com>, "amber-dev" <amber-dev at openjdk.org>
>> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.org>
>> Sent: Tuesday, February 28, 2023 10:11:39 PM
>> Subject: Re: Draft JEPs for Patterns in switch and Record Patterns
>
>> In https://openjdk.org/jeps/8300542, the example in "Improved support
>> for enum constant case labels" seems to be incorrect.
>>
>> I think the `goodEnumSwitch2`:
>>
>> static void goodEnumSwitch2(Currency c) {
>>
>> Should use `Coin` as parameter:
>>
>> static void goodEnumSwitch2(Coin c) {
>>
>> Also, the enum is called `Coin`, but `Coins` is used a qualifier in
>> several places.
>>
>> --John
>
> Also s.equalsIgnoreCase("YES") is better than s.toUpperCase().equals("YES")
>
> Rémi
>
>>
>> ------ Original Message ------
>> From "Gavin Bierman" <gavin.bierman at oracle.com>
>> To "amber-dev at openjdk.org" <amber-dev at openjdk.org>
>> Cc "amber-spec-experts" <amber-spec-experts at openjdk.org>
>> Date 28/02/2023 17:21:42
>> Subject Draft JEPs for Patterns in switch and Record Patterns
>>
>>> 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