Thanks Guy.

All corrected.

Gavin

On 8 Apr 2022, at 03:27, Guy Steele 
<guy.ste...@oracle.com<mailto:guy.ste...@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


Reply via email to