RFR: JDK-8312044: Simplify toolkit Builder/Writer world.
Pavel Rappo
prappo at openjdk.org
Fri Jul 21 15:41:46 UTC 2023
On Mon, 17 Jul 2023 22:21:18 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
> Please review a medium-sized but conceptually simple change to simplify the overall class hierarchy of the `doclet` world.
>
> As described in detail in the JBS entry, the classes in `toolkit.builder.*Builder` and corresponding writer interfaces in `toolkit.*Writer` provide little useful benefit, and only serve to clutter a somewhat chaotic situation.
>
> In this patch, the following is done:
> * the `builder` methods in `toolkit/builders/---Builder.java` are moved into the corresponding `formats/html/---WriterImpl.java` class. Generally, the insertion was done "early" in the file, typically after the constructor(s).
> * the `writer` interfaces in `toolkit/---Writer.java` are deleted and references to them in `implements` clauses removed.
> * the `writer` classes in `formats/html/---WriterImpl.java` are renamed to `formats/html/---Writer.java` and in a couple of anomalous cases, the `writer` classes in `formats/html/Html---Writer.java` are also renamed to `formats/html/---Writer.java`.
> * the markup root class `Content` no longer needs to be in `toolkit` and is moved to `formats/html`. (It's a close call whether it is better there or in `formats/html/markup`.
>
> * Because of the class renaming, one test had to be updated; no other tests were affected by these changes.
> * Because of the class renaming, the `<meta name="generator" ...>` information changes; there are no other changes to the generated JDK API documentation.
>
> The changes to the `doclets` class hierarchy are shown in two attachments in the JBS entry. In those images, you can see the "clutter" of the `builder` world and `writer` world being simplified.
>
> The following tables show the changes in the number of files and the number of lines of code resulting from this refactoring.
>
> ### # files
> | | before | after | change | %before |
> |-------------:|-------:|------:|-------:|--------:|
> | toolkit | 79 | 46 | -33 | 58% |
> | formats/html | 108 | 109 | 1 | 101% |
> | doclets | 189 | 157 | -32 | 83% |
>
> ### # lines of code
>
> | | before | after | change | %before |
> |-------------:|-------:|------:|-------:|--------:|
> | toolkit | 21445 | 15597 | -5848 | 73% |
> | formats/html | 29805 | 31968 | 2163 | 107% |
> | doclets | 51325 | 47640 | -3685 | 93% |
>
> This generally completes the recent large-scale refactoring and simplification that was started in
> [JDK-8309566](https://bugs.openjdk.org/browse/JDK-8309566). While large-scale ref...
Looks good.
-------------
Marked as reviewed by prappo (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14913#pullrequestreview-1541392855
More information about the javadoc-dev
mailing list