Java's sealed classes add compile-time exhaustiveness checks, new breaking-change risk
A technical explainer describes how sealed classes, introduced in Java 17, let developers restrict which subtypes can implement an interface or extend a class, enabling the compiler to verify that switch expressions handle every possible case without a default branch. The piece notes that forgetting a case triggers a compile-time error rather than a runtime failure, demonstrating this with a toy SealedType example using records.