[jdk17] RFR: JDK-8259499: Handling type arguments from outer classes for inner class in javadoc
liach
github.com+7806504+liach at openjdk.java.net
Fri Jul 9 02:46:53 UTC 2021
On Thu, 8 Jul 2021 20:40:04 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> This change adds support for generating HTML links to the type arguments of enclosing classes when creating a link to an inner class. Previously, only a link to the inner class was created and the type arguments were even omitted from the link label.
>>
>> The new feature to create separate links to the enclosing class and its type arguments is only activated if the enclosing class has type arguments. If the enclosing class is non-generic, the old behavior is preserved to create a single link to the inner class. The reason for this is that a dedicated link to the enclosing class itself provides little benefit, since it can be easily reached via the "Enclosing class" link of the inner class. Also, linking the enclosing type in absence of type arguments makes it hard to see that there are two links and easy to click on the wrong link by mistake.
>>
>> On the other hand, for type arguments a separate link should be useful since it is often not a "nearby" type. It is also easier to detect the different links than for non-generic nested classes. I came to like this "mixed" solution best after trying several other approaches.
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkInfo.java line 132:
>
>> 130: // from the documentation of an inner class, so rendering it as separate link would
>> 131: // add little benefit but add considerable noise, while type arguments may not
>> 132: // otherwise be reachable from the documentation of the inner class.
>
> Do you render the _enclosing types_ as separate links, or just the _type arguments of enclosing types_?
>
> Even if the enclosing type has type arguments, your argument about the noise from linking the name of the enclosing type is still valid.
Currently the first. But if someone clicks the class label in front of type arguments, thinking it would lead to the class that defines the type parameters (as in many IDEs) and instead goes to the innermost class, it'd be quite confusing too.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/195
More information about the javadoc-dev
mailing list