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

Jonathan Gibbons jjg at openjdk.org
Fri Mar 8 19:27:52 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.

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

> 1183: 
> 1184:         if (name != null) {
> 1185:             HtmlTag htmlTag = HtmlTag.get(name);

minor P5 suggestion to consider in future:
maybe add convenience forms for `HtmlTag.of` that accept a `DocTree`.


HtmlTree htmlTag = HtmlTree.of(tree);



HtmlTree of(DocTree dtree) {
    return switch (tree.getKind()) {
        case START_ELEMENT -> of(((StartElementTree)dtree).getName());
        case END_ELEMENT -> of(((StartElementTree)dtree).getName());
        default -> throw new IllegalArgumentException(tree.getKind().toString());
    }
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18154#discussion_r1518202125


More information about the javadoc-dev mailing list