Neil Madden explains compatibility traps when using sealed types and exhaustive pattern matching in public library APIs. Adding a new subtype can make a switch non-exhaustive when existing clients are recompiled, while unrecompiled code can throw MatchException upon encountering a new value. The Java Language Specification likewise treats adding permitted subtypes as binary compatible while explicitly noting possible migration incompatibility at runtime. Internal models built together and externally distributed APIs need different consideration in versioning policies.
Back to Tech
Extending Java sealed types is not safe on binary compatibility alone
Adding subtypes to public APIs requires evaluating both existing switch failures at runtime and recompilation effects.