A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/MatchException.html below:

MatchException (Java SE 21 & JDK 21)

All Implemented Interfaces:
Serializable

Thrown to indicate an unexpected failure in pattern matching.

MatchException may be thrown when an exhaustive pattern matching language construct (such as a switch expression) encounters a value that does not match any of the specified patterns at run time, even though the construct has been deemed exhaustive. This is intentional and can arise from a number of cases:

MatchException may also be thrown by the process of pattern matching a value against a pattern. For example, pattern matching involving a record pattern may require accessor methods to be implicitly invoked in order to extract the component values. If any of these accessor methods throws an exception, pattern matching completes abruptly and throws MatchException. The original exception will be set as a cause of the MatchException. No suppressed exceptions will be recorded.

See Java Language Specification:
14.11.3 Execution of a switch Statement
14.30.2 Pattern Matching
15.28.2 Run-Time Evaluation of switch Expressions
Since:
21
See Also:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4