Draft Spec for Fourth Preview of Pattern Matching for Switch (JEP 433) and Second Preview of Record Patterns (JEP 432) now available
Robbe Pincket
robbepincket at live.be
Tue Nov 15 17:27:25 UTC 2022
Hi experts
I wanted to say something about the NPE discussions that happened the last few days, but decided against it as I felt that my thoughts had already been brought up and thus my comment wouldn't really add anything new to the discussion. However while checking on some things in the current proposed spec, I did come across the following wording that felt wrong
In 14.30.2 Pattern Matching:
> If execution of the invocation of the accessor method completes abruptly for reason S, then pattern matching completes abruptly by throwing a MatchException with cause S.
Invocations can only complete by throwing exceptions, but using the catchall "completes abruptly for reason S" feels wrong to because the reason is not the "Exception V" that has been thrown, but is "throw with value V", and I can only add "V" as a cause of an exception, not "throw with value V".
A better wording might be this (based on 12.4.2 number 11 in numbered list)
> If the execution of the invocation of the accessor method completes abruptly by throwing some exception E, then pattern matching completes abruptly by throwing a MatchException with cause E.
Kind regards
Robbe Pincket
Ps. I was also wondering if could get a response to my earlier question on this list
From: Gavin Bierman<mailto:gavin.bierman at oracle.com>
Sent: woensdag 19 oktober 2022 0:23
To: amber-spec-experts<mailto:amber-spec-experts at openjdk.java.net>
Subject: Draft Spec for Fourth Preview of Pattern Matching for Switch (JEP 433) and Second Preview of Record Patterns (JEP 432) now available
Dear experts:
The first draft of a joint spec covering JEP 433 (Fourth Preview of Pattern Matching for switch) and JEP 432 (Record Patterns) is available at:
https://cr.openjdk.java.net/~gbierman/jep432+433/latest
This covers all the changes for these JEPs *apart* from the proposal to infer type arguments in patterns. This will be added and announced shortly.
Comments welcomed!
Gavin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-observers/attachments/20221115/6044f4e4/attachment-0001.htm>
More information about the amber-spec-observers
mailing list