Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286469

Generate buttons to get links to sections



    • Type: Enhancement
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 19
    • Fix Version/s: None
    • Component/s: tools
    • Labels:


      During a discussion, it is often useful to link to a specific javadoc element. For instance a specific method, or a specific section in the class/package javadoc.

      Currently, getting a link to a method's documentation is fairly easy, by clicking the method's name in the "Method Summary" section, the page jumps to that method, and the link can be copied from the address bar. But! when scrolled down while reading the doc for a particular method, a user has to scroll up to the "Method Summary" section again to click the method there to get the link.

      Getting a link to a section in a class' javadoc is harder, for instance the section on Signature Polymorphism in MethodHandle's class javadoc: https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/invoke/MethodHandle.html#sigpoly

      A link to that section can be obtained by inspecting the web-page's source code, seeing that that section has a `<a id=sigpoly>` anchor, and then manually putting #sigpoly at the end of the URL for that page.

      In both these cases, it would be nice if there were buttons generated to get a link to these elements.

      The way I imagine this could look, is like the Kotlin documentation does for instance here: https://kotlinlang.org/docs/scope-functions.html#function-selection

      Where, if you hover over a section header, a little link icon appears next to it, which can be clicked to copy the link to that section to the address bar, from where it can then be copy to the clipboard and shared elsewhere.

      There might be more places where these link buttons are useful as well.

      This would make sharing links to specific elements of javadoc a lot easier I think.


          Issue Links



              Unassigned Unassigned
              jvernee Jorn Vernee
              0 Vote for this issue
              1 Start watching this issue