RFR: JDK-8326332: Unclosed inline tags cause misalignment in summary tables

Jonathan Gibbons jjg at openjdk.org
Fri Mar 8 19:22:53 UTC 2024


On Thu, 7 Mar 2024 14:29:39 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

> Please review a simple fix to make sure inline tags are always closed in summary tables, even when the tags are closed after the first sentence in the original doc comment. 
> 
> I decided to colocate the functionality to track open inline tags with the existing `ignoreNonInlineTag` method that filters out non-inline elements because there is a lot of common functionality, such as retrieving the name and kind of an HTML tag. I considered giving the method a name that describes the additional functionality, but couldn't find one that wasn't comically long. Suggestions are welcome of course.

Nice.  

I like that you managed this without needing to build anything resembling an HTML conformance checker or even to extend existing support for HTML tags.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 1191:

> 1189:                 }
> 1190:                 // Keep track of open inline tags that need to be closed, see 8326332
> 1191:                 if (kind == START_ELEMENT && htmlTag.endKind == HtmlTag.EndKind.REQUIRED) {

Clever use of `endKind` -- I would not have thought of that.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 1268:

> 1266:         configuration.tagletManager.checkTags(element, trees);
> 1267:         commentRemoved = false;
> 1268:         ArrayList<Name> openTags = new ArrayList<>();

Suggest either using `var` or just `List<Name>`.

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

Marked as reviewed by jjg (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18154#pullrequestreview-1925669369
PR Review Comment: https://git.openjdk.org/jdk/pull/18154#discussion_r1518188269
PR Review Comment: https://git.openjdk.org/jdk/pull/18154#discussion_r1518188994


More information about the javadoc-dev mailing list