Using the `@serial` tag, a class can explicitly opt-in to being documented on the serialized form page. However, a class that does not want to opt-in should not be required to have a doc comment, and should not trigger the "missing comment" warning if there is no comment.
The fix is to check for the presence of the comment on a class before analyzing it to see if it contains `@serial` tags. The code in `Utils.getDocCommentTree0` is slightly refactored to allow a new predicate `hasDocCommentTree` to be added. ------------- Commit messages: - JDK-8251200: False positive messages about missing comments for serialization Changes: https://git.openjdk.java.net/jdk16/pull/70/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk16&pr=70&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8251200 Stats: 138 lines in 3 files changed: 115 ins; 21 del; 2 mod Patch: https://git.openjdk.java.net/jdk16/pull/70.diff Fetch: git fetch https://git.openjdk.java.net/jdk16 pull/70/head:pull/70 PR: https://git.openjdk.java.net/jdk16/pull/70