RFR: JDK-8285869: Selective cleanup in doclint Checker class [v2]

Pavel Rappo prappo at openjdk.java.net
Tue May 3 22:28:34 UTC 2022


On Tue, 3 May 2022 21:53:21 GMT, Jonathan Gibbons <jjg 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.
>
> Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision:
> 
>   address review feedback

I have a few more comments, Jon.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 217:

> 215:         hasNonWhitespaceText = false;
> 216: 
> 217:         implicitHeadingRank = switch (p.getLeaf().getKind()) {

(observation) Since _rank_ is a rather unusual word to see, I explored this a bit. Numerals in H1, H2, H3, H4, H5, and H6 were somewhat implicitly referred to as _heading levels_ by HTML4, and indeed became referred to as _ranks_ in HTML5.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 866:

> 864:         if (paramElement == null) {
> 865:             switch (env.currElement.getKind()) {
> 866:                 case CLASS, INTERFACE -> {

A record can be generic too.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 1230:

> 1228:         for (DocTree d: list) {
> 1229:             switch (d.getKind()) {
> 1230:                 case TEXT -> {

Using `switch` here seems overkill.

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

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


More information about the compiler-dev mailing list