RFR: 8320234: Merge doclint.Env.AccessKind with tool.AccessKind

Jonathan Gibbons jjg at openjdk.org
Fri Nov 17 22:11:34 UTC 2023


On Fri, 17 Nov 2023 21:46:16 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/AccessLevel.java line 59:
>> 
>>> 57:                 && PROTECTED.ordinal() == 2
>>> 58:                 && PUBLIC.ordinal() == 3;
>>> 59:     }
>> 
>> While not wrong, this is a weird not-recommended use of `.ordinal()`.
>> How much is the order actually relied on?
>
> A different solution, is one is really needed, would be a regression test to verify the expected order.

Yet another alternate suggestion would be to use something like


assert List.of(AccessLevel.values())
    .equals(List.of(PRIVATE, PACKAGE, PROTECTED, PUBLIC)

    
 although I still think it is paranoid  (and non-standard) to assert the order of enum members for any enum that is used as `Comparable`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16714#discussion_r1397937169


More information about the javadoc-dev mailing list