RFR: 8313931: Javadoc: links to type parameters actually generate links to classes [v3]

Hannes Wallnöfer hannesw at openjdk.org
Thu Aug 8 09:50:32 UTC 2024


On Wed, 7 Aug 2024 21:04:08 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   More post-merge cleanup
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template line 239:
> 
>> 237:         link.addEventListener("click", (e) => {
>> 238:             const href = e.currentTarget.getAttribute("href");
>> 239:             if (href && href.startsWith("#") && href.indexOf("type-param-") > -1) {
> 
> Does the `href.startsWith("#")` mean that this only works for references within the same file? Is it even a sensible question to wonder if you can link to type parameters in other files?

This is  a workaround to allow the highlight animation to play multiple times if the type parameter link is clicked repeatedly. This is only necessary for internal links and does not affect links to other files. 

Examples for a type parameter link in another class are the links to the type parameters of `Map.Entry` in the [nested class summary](https://cr.openjdk.org/~hannesw/8313931/api.02/java.base/java/util/Map.html#nested-class-summary) of `java.util.Map`, or the links back to `Map` type parameters in the [enclosing interface definition](https://cr.openjdk.org/~hannesw/8313931/api.02/java.base/java/util/Map.Entry.html) in `Map.Entry`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20494#discussion_r1709094633


More information about the javadoc-dev mailing list