RFR: JDK-8261665: Clean up naming of StringContent and FixedStringContent

Hannes Wallnöfer hannesw at openjdk.java.net
Mon Feb 22 15:24:45 UTC 2021


On Fri, 12 Feb 2021 19:51:34 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

> Relatively simple update to clean up some of the old naming in the `html.markup` world.
> 
> `FixedStringContent` is renamed to just `Text` and a new factory method `Text.of(CharSequence)` introduced.
> 
> `StringContent` is renamed to `TextBuilder`.
> 
> `StringContent` was the original type and is widely used; `FixedStringContent` was added much later, along with `Contents` to support shared reusable tree nodes.  But most uses of `StringContent` do not need mutability, and most can be replaced with the lighter-weight `Text` class.  This change is done, just leaving `textBuilder` to be used in `ContentBuilder` and `HtmlTree` which support the `add(CharSequence)` method.

Nice! 

I guess it could be questioned whether the `TextBuilder` class is still needed, since its only purpose is to have text appended to it instead of adding a new `Text` object to a content list in the `add(CharSequence)` methods of `ContentBuilder` and `HtmlTree`.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java line 35:

> 33: import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
> 34: import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
> 35: import jdk.javadoc.internal.doclets.formats.html.markup.TextBuilder;

It looks like you're not using TextBuilder in this class after all.

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

Marked as reviewed by hannesw (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2556


More information about the javadoc-dev mailing list