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

Jonathan Gibbons jjg at openjdk.org
Thu Aug 8 23:06:34 UTC 2024


On Thu, 8 Aug 2024 09:47:58 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> 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`.

OK, understood

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

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


More information about the javadoc-dev mailing list