RFR: 8273544: Increase test coverage for snippets [v3]
Pavel Rappo
prappo at openjdk.java.net
Fri Nov 19 18:11:10 UTC 2021
On Fri, 19 Nov 2021 17:38:03 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/snippet/Attribute.java line 61:
>>
>>> 59: * deletion without notice.</b>
>>> 60: */
>>> 61: public abstract class Attribute {
>>
>> General question: the commit message is:
>>
>>> So we can finally use sealed classes where they were originally envisioned.
>>
>> But, the code edits seem to be backing away from using sealed classes and interfaces. What happened?
>
> 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 a seems reasonable thing to do. Do you have any objections, Jon? (Asking because you have already reviewed the change.)
-------------
PR: https://git.openjdk.java.net/jdk/pull/6359
More information about the javadoc-dev
mailing list