RFR: 8283269: Improve definition and use of jdk.javadoc.internal.doclets.toolkit.Content
Pavel Rappo
prappo at openjdk.java.net
Fri Mar 25 14:09:16 UTC 2022
This PR started in a draft mode as a refactoring effort. After a few commits and chats with Jonathan Gibbons, I decided that further refactoring belongs to follow-up PRs and that this PR could be marked as "Ready for review".
The motivation for the initial refactoring effort was as follows. The word "tree" is heavily overloaded in the JavaDoc codebase, both in comments and code. Here are some of the contexts this word appears in:
* Hierarchy Tree (i.e. overview-tree.html and package-tree.html)
* DocTree (AST nodes)
* ClassTree, *TreeWriter (data structures and entities related to supertype-subtype relationship)
* HtmlTree (HTML nodes) and specifically UL/OL elements which are nested lists
Sometimes contexts overlap, making the word "tree" ambiguous. To reduce this ambiguity, the word "tree" should be dropped in favor of a more specific word of phrase where possible.
In the case where the context is `jdk.javadoc.internal.doclets.toolkit.Content`, the programmer is already aware that they are dealing with trees in the sense that `Content` objects support recursive composition. There's no need to have the phrase "content tree" where "content" would do. Moreover, in the context that is exclusively about `Content` objects, the word "content" can be dropped too, since the type information is assumed.
As an example of content overlap, have a look at the source of `jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder::buildSummary`. This method used to needlessly mix DocTree with Content tree.
-------------
Commit messages:
- Improve
- Removed `@link` to a wrong type
- Merge branch 'master' into 8283269
- Address feedback and more
- Remove more "trees"
- Undo some of the changes
- Clarify HtmlDocument ctor param
- Undo unrelated var-ification
- Remove more occurrences of "tree"
- Initial commit
Changes: https://git.openjdk.java.net/jdk/pull/7843/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7843&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8283269
Stats: 2412 lines in 76 files changed: 9 ins; 209 del; 2194 mod
Patch: https://git.openjdk.java.net/jdk/pull/7843.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7843/head:pull/7843
PR: https://git.openjdk.java.net/jdk/pull/7843
More information about the javadoc-dev
mailing list