Class MatchException


public final class MatchException extends RuntimeException

java.lang.MatchException: what a switch over patterns throws when no case matched a value it was compiled to cover -- a sealed type or an enum that gained a member after the switch was compiled -- or when a record's accessor failed while a pattern took the record apart.

javac names it in the code of every exhaustive pattern switch, so the class has to exist on a device for such a switch to load at all.

  • Constructor Details

    • MatchException

      public MatchException(String message, Throwable cause)
      A failed match, with what caused it or null.