On Tue, 11 Jun 2024 13:35:31 GMT, Chen Liang <li...@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

Reply via email to