RFR: JDK-8261263: Simplify javadoc link code

Jonathan Gibbons jjg at openjdk.java.net
Tue Feb 9 01:56:42 UTC 2021


On Fri, 5 Feb 2021 20:59:45 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

> This is a cleanup of the javadoc link generating code.
> 
> There is a simple "horizontal" component to this change that removes the `strong` parameters from most `HtmlDocletWriter#getDocLink` methods which where the value used was always `false`, and related changes in all the code using these methods. 
> 
> The slightly more complex part of this change are changes in `LinkInfo[Impl]` and `LinkFactory[Impl]`. Here the target was to reduce the number of booean fields in `LinkInfo` and their interaction with the code, which was quite hard to grasp. I managed to replace several fields controlling generation of type parameter links with a single `includeTypeParameterLinks()` method. The use of this method and the remaining boolean fields in the code is quite straightforward. 
> 
> I also removed some bits of dead code and simplified the control flow a bit by trying to do things only in one place and one way when possible.
> 
> The code passes all javadoc tests and generates documentation identical to the old code.

A couple of places where there are remnants of `isStrong`; are they still required?

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkInfo.java line 75:

> 73:      * True if the link should be strong.
> 74:      */
> 75:     public boolean isStrong = false;

This is pervasively disappearing elsewhere. Is it still needed here?

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkInfo.java line 149:

> 147:                 ", isVarArg=" + isVarArg +
> 148:                 ", label=" + label +
> 149:                 ", isStrong=" + isStrong +

isStrong again

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

PR: https://git.openjdk.java.net/jdk/pull/2437


More information about the javadoc-dev mailing list