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.

This pull request has now been integrated.

Changeset: 9f9ab02f
Author:    Hannes Wallnöfer <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/9f9ab02ff6a3779b43c9024e5ec190de4eec9ab5
Stats:     950 lines in 9 files changed: 419 ins; 453 del; 78 mod

8303895: Simplify and clean up LinkFactory code

Reviewed-by: prappo

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

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

Reply via email to