RFR: JDK-8315464: Uncouple AllClassesIndexWriter from IndexBuilder

Andrey Turbanov aturbanov at openjdk.org
Fri Sep 15 09:18:42 UTC 2023


On Thu, 14 Sep 2023 16:19:06 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

> My original intention with this cleanup was to keep using `[Html]IndexBuilder' for both the "All Classes" and the main index, but just improve separation of code and naming of classes. However, I then discovered two things:
> 
>  - The "All Classes" page is so simple to build that it doesn't justify using a complex builder class. In fact, moving the necessary functionality from `IndexBuilder` to `AllClassesIndexWriter` just added about a dozen lines of code to the latter, while making `IndexBuilder` much simpler by removing its dual purpose.
>  - The separation of code between `toolkit.util.IndexBuilder` and `formats.html.HtmlIndexBuilder`, although seemingly random at first sight, actually reflects the usage of functionality provided by the respective packages. Although with a single output format the separation between these packages is not as important as it used to be, it is still nice to keep things separated.
> 
> Based on these two findings, I decided to pull the "All Classes" code into "AllClassesIndexWriter", but maintain the implementation of `[Html]IndexBuilder` across the two classes/packages. Although the base `IndexBuilder` class is technically able to function on its own without the HTML-specific enhancements, I made the class abstract in order to point out that the HTML enhancements in `HtmlIndexBuilder` are actually essential for our us.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java line 107:

> 105:     }
> 106: 
> 107:     private Set<TypeElement> getTypeElements()  {

Suggestion:

    private Set<TypeElement> getTypeElements() {

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15746#discussion_r1327032004


More information about the javadoc-dev mailing list