On Fri, 19 Nov 2021 18:07:50 GMT, Pavel Rappo <pra...@openjdk.org> wrote:
>> This is embarrassing. The commit clearly contradicts its message, and I >> don't immediately understand why. I'll try to figure it out before >> integrating. Thanks for noticing! > > I vaguely remember that at some stage I seem to have realized that while > `sealed` works for Style, it does not work for Attribute. This is because the > attribute is typically queried by the most specific `Class<T extends > Attribute>`, which means that the client knows the exact type of the > attribute upon return from Attributes.get (note plural attributeS). > > Here's another issue that might have contributed to this mess: although the > [sealed classes](https://openjdk.java.net/jeps/409) are available, the > [exhaustive switch for sealed hierarchies](https://openjdk.java.net/jeps/420) > is not. > > That said, here's what I will do. I will push a commit to make Style > `sealed`, which seems a reasonable thing to do. Do you have any objections, > Jon? (Asking because you have already reviewed the change.) Thanks for the explanation. Mostly, I was curious about what had happened in your thinking in this area. I have no strong preferences either way, with a mild preference for leaving it alone, and improve it later when you may be able to make better use of the declaration. ------------- PR: https://git.openjdk.java.net/jdk/pull/6359