作者是在评审 JEP 524(PEM 编码的密码学对象)时发现这个问题的:它把密封接口放进了公开 API。
结论是密封类型适合组件内部实现,不适合暴露给库的使用者。
💡 金句
sealed types are probably most useful within the implementation of a component, and are less useful when exposed in the public API that a component offers to other components