Draft Spec for Third Preview of Pattern Matching for Switch and Record Patterns (JEP 405) now available
Gavin Bierman
gavin.bierman at oracle.com
Fri Apr 8 06:51:09 UTC 2022
Thanks Guy.
All corrected.
Gavin
On 8 Apr 2022, at 03:27, Guy Steele <guy.steele at oracle.com<mailto:guy.steele at oracle.com>> wrote:
13.4.26 Evolution of Enum Classes
Adding or reordering enum constants in an enum class will not break compatibility with pre-existing binaries.
As with sealed classes (13.4.2.1<http://cr.openjdk.java.net/~gbierman/PatternSwitchPlusRecordPatterns/PatternSwitchPlusRecordPatterns-20220407/specs/patterns-switch-jls.html#jls-13.4.2.1>), whilst adding an enum constant to an enum class is considered a binary compatible change, it may cause the execution of an exhaustive switch (14.11.1<http://cr.openjdk.java.net/~gbierman/PatternSwitchPlusRecordPatterns/PatternSwitchPlusRecordPatterns-20220407/specs/patterns-switch-jls.html#jls-14.11.1>) to fail with a linkage error (an IncompatibleClassChangeError may be thrown) if the switch encounters the new enum constant that was not known at compile time (14.11.3<http://cr.openjdk.java.net/~gbierman/PatternSwitchPlusRecordPatterns/PatternSwitchPlusRecordPatterns-20220407/specs/patterns-switch-jls.html#jls-14.11.3>, 15.28.2<http://cr.openjdk.java.net/~gbierman/PatternSwitchPlusRecordPatterns/PatternSwitchPlusRecordPatterns-20220407/specs/patterns-switch-jls.html#jls-15.28.2>).
Would it be more accurate (or more to the point) to replace “whilst” with “although”?
—Guy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20220408/80bc94ed/attachment-0001.htm>
More information about the amber-spec-experts
mailing list