-
Sub-task
-
Resolution: Delivered
-
P4
-
20
In this release, when preview features are enabled with `--enable-preview`, a
`switch` expression over an enum type will throw a `MatchException` rather than
an `IncompatibleClassChangeError` should the selector expression yield an
unexpected enum constant value. This can only happen if the enum class has been
changed by adding a new enum constant _after_ compilation of the `switch`.
This change is required to unify the treatment of erroneous exhaustive switches
introduced by enhancing `switch` with pattern labels.
`switch` expression over an enum type will throw a `MatchException` rather than
an `IncompatibleClassChangeError` should the selector expression yield an
unexpected enum constant value. This can only happen if the enum class has been
changed by adding a new enum constant _after_ compilation of the `switch`.
This change is required to unify the treatment of erroneous exhaustive switches
introduced by enhancing `switch` with pattern labels.