On Tue, 11 Jun 2024 13:41:58 GMT, Pavel Rappo <pra...@openjdk.org> wrote:
>> 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. I suggest one of 1. Add a `boolean global;` member to the enum, and provide a second constructor that allows that boolean member to be set true. For example, WIDTH, STYLE(true), 2. Make the `Set` be static and init it in a static initializer. See the `javac` `Source` and `Target` classes for examples of this technique. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19652#discussion_r1635524009