RFR: 8338133: Cleanup direct use of `new HtmlTree` [v2]

Hannes Wallnöfer hannesw at openjdk.org
Wed Sep 4 09:37:19 UTC 2024


On Tue, 3 Sep 2024 20:31:34 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Please review an update to "clean up" the direct use of HtmlTree constructors.
>> 
>> Hitherto, many/most instances of `HtmlTree` were created by static factory methods.  This update extends that convention.
>> In most cases, this is by providing either simple no-arg factory methods or commonly used overloads that take an `HtmlId` or `HtmlStyle`.
>> 
>> For some tags, (`br`, `hr`, `wbr`) this allows a singleton instance to be used.
>> For some of the more obscure cases, a more generic `HtmlTree.of(HtmlTag)` method was used.
>> 
>> Notes:
>> * some significant block-level nodes, like `pre`, should probably always set a style, which could be enforced by suitable factory methods. That is currently not the case and could be a future cleanup.
>> * some lists put the same style info on each list item, but might be better placed on the enclosing list. That could be a future cleanup
>
> Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision:
> 
>   adddress review feedback

Looks good, except for an extra line break that was added in `HtmlTree.of(HtmlTag)` in the second commit.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java line 87:

> 85:      */
> 86:     public static HtmlTree of(HtmlTag tag) {
> 87: 

I think this extra line break was added accidentally.

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

Marked as reviewed by hannesw (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20778#pullrequestreview-2279524420
PR Review Comment: https://git.openjdk.org/jdk/pull/20778#discussion_r1743397498


More information about the javadoc-dev mailing list