RFR: 8322708: Global HTML attributes are not allowed [v2]

Pavel Rappo prappo at openjdk.org
Tue Jun 11 13:44:12 UTC 2024


On Tue, 11 Jun 2024 13:35:31 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/HtmlTag.java line 556:
>> 
>>> 554:     }
>>> 555: 
>>> 556:     private final EnumSet<Attr> GLOBAL_ATTRS = EnumSet.of(
>> 
>> I get it, you cannot make it static because it's used in an enum ctor. But attaching it to every single enum constant seems wasteful.
>
> If we are ordering the entries, we can use comparable to check that an attr is greater than the start of the global attr, something like
> 
> private static boolean isGlobalAttr(Attr value) {
>     return value.compareTo(Attr.ACCESSKEY) >= 0;
> }

> If we are ordering the entries, we can use comparable to check that an attr is greater than the start of the global attr, something like
> 
> ```java
> private static boolean isGlobalAttr(Attr value) {
>     return value.compareTo(Attr.ACCESSKEY) >= 0;
> }
> ```

That would also work, yes. I still avoid relying on the order of enum constants; but it's me.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19652#discussion_r1634916196


More information about the javadoc-dev mailing list