Patterns: Exhaustiveness, Unconditionality, and Remainder


As the switch construct has been made steadily more expressive (first to support switch expressions, and later to support patterns in switch), it has become important to provide compile-time checking for whether a particular switch is exhaustive for its selector type. All switch expressions, and any switch statement that uses a pattern label, must be exhaustive, or a compilation error will occur …'

More at https://openjdk.org/projects/amber/design-notes/patterns/exhaustiveness