RFR: JDK-8305591: Cleanup use of `newline` flag in DocCommentParser

Hannes Wallnöfer hannesw at openjdk.org
Wed Apr 5 11:47:11 UTC 2023

On Tue, 4 Apr 2023 20:55:33 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

> Please remove a simple cleanup fix, to remove unnecessary assignments to set the `newline` flag  to `true` in `DocCommentParser`. The flag is always set appropriately in `nextChar()`.
> This removes a number of "fall-through" cases in switch statements. In reviewing the use of `@SuppressWarnings("fall through")` it was noted that there is a missing `break` in `case '@'` in `inlineWord()`. Fixing this breaks a test. This will be addressed separately. [JDK-8305620](https://bugs.openjdk.org/browse/JDK-8305620)

Looks good except for a `@SuppressWarnings("fallthrough")` that could be removed when combined with JDK-8305620.

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 568:

> 566:             switch (ch) {
> 567:                 case '\n':
> 568:                 case '\r': case '\f': case ' ': case '\t':

This is not a big issue, but it seems that with #13343 adding the break to the `case '@'` below, the `@SuppressWarnings("fallthrough")` could now be removed from this method, right?


Marked as reviewed by hannesw (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13341#pullrequestreview-1372727639
PR Review Comment: https://git.openjdk.org/jdk/pull/13341#discussion_r1158396328

More information about the compiler-dev mailing list