Integrated: JDK-8312044: Simplify toolkit Builder/Writer world

Jonathan Gibbons jjg at openjdk.org
Fri Jul 21 18:55:51 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...

This pull request has now been integrated.

Changeset: 3c644dc5
Author:    Jonathan Gibbons <jjg at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3c644dc586e8990607923a2cb56656d0d6bf45e4
Stats:     14868 lines in 133 files changed: 5517 ins; 9214 del; 137 mod

8312044: Simplify toolkit Builder/Writer world

Reviewed-by: prappo

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

PR: https://git.openjdk.org/jdk/pull/14913


More information about the javadoc-dev mailing list