Release Note: An Exhaustive Switch over an Enum Class Should Throw `MatchException` Rather Than `IncompatibleClassChangeError` If No Switch Label Applies at Runtime

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Delivered
    • Priority: P4
    • 20
    • Affects Version/s: 20
    • Component/s: tools

      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.

            Assignee:
            Jan Lahoda
            Reporter:
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: