On Tue, 14 Mar 2023 11:27:32 GMT, Hannes Wallnöfer <[email protected]> wrote:
> Please review a change to clean up and simplify the link info and factory > classes. This includes the following: > > - Flatten the type hierarchy and remove the abstract `LinkInfo` and > `LinkFactory` classes in the > `jdk.javadoc.internal.doclets.toolkit.util.links` package. These classes are > not used in the toolkit code and the abstraction has lost any value it may > have had while significantly increasing complexity and readability of the > code. > - Make all fields in `HtmlLinkInfo` private and add getters and setters to > access them. The setters mostly use fluent style where it makes sense. I used > a mixed approach to getter/setter naming, using get/set prefixes for fields > with nouns as names, while omitting the prefix for complex names that start > with a verb. While not being totally consistent I think this results in the > best readability. > - Introduce a `forType(TypeMirror)` factory method to `HtmlLinkInfo` that > returns a copy of itself with a new type. This is used to produce links to > subtypes instead of tweaking and reusing the original `HtmlLinkInfo`. > > The change does not cause any changes in the generated documentation for the > JDK. There are a few places in the old code where the `skipPreview` flag is > switched on or off. Some of these did not seem to be necessary to pass the > tests and produce the same JDK documentation. This could either be caused by > the change to copy `HtmlLinkInfo` objects instead of reusing them, or by > changes in the JDK preview API since the feature has been introduced. In the > end I chose to preserve all explicit changes to the `skipPreview` flag. Looks good. >From what I can see, this link subsystem, which includes LinkInfo, LinkFactory >and LinkOutput, was added sometime in 2003, but never delivered. LinkOutput >was removed in JDK-8267434 ( 878d1b3f600d4a51b082f0c3276df6de49a9bc4f ). Now >the remaining parts are removed as well. ------------- Marked as reviewed by prappo (Reviewer). PR: https://git.openjdk.org/jdk/pull/13014
