RFR: JDK-8285869: Selective cleanup in doclint Checker class

Jonathan Gibbons jjg at openjdk.java.net
Tue May 3 21:34:17 UTC 2022


On Tue, 3 May 2022 11:03:02 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> Please review some localized cleanup for the doclint Checker class, primarily focused on upgrading to the use of "enhanced `switch`"
>> 
>> The output of one test was changed because of some improvements in one switch statement to eliminate the use of fall-through semantics.
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 737:
> 
>> 735:     private Element getEnclosingPackageOrClass(Element e) {
>> 736:         while (e != null) {
>> 737:             if (e.getKind().isDeclaredType() || e.getKind() == ElementKind.PACKAGE) {
> 
> This change does not seem to be equivalent: `isDeclaredType()` accepts more kinds than the `switch` did. Does it matter here?

I don't think it matters and/or the code is more correct according to the semantics of the name.

I think this is a case where we get bit-rot from new values being added to enums and not being consistently used throughout the code.

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

PR: https://git.openjdk.java.net/jdk/pull/8460


More information about the javadoc-dev mailing list