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

Inheriting documentation for a linked library

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • None
    • tools
    • None

      CASE 1. Try and inherit doc from a compiled element, such as `java.lang.Object`

      Source:
      package po;

      /**
       * Class O.
       */
      public class O {
          private O() { }

          /**
           * Before.
           * {@inheritDoc}
           * After.
           *
           * @param other the other
           * @return the result
           */
          @Override
          public boolean equals(Object other) {
              return super.equals(other);
          }
      }

      Output: no diagnostic, and this in the generated output:
      public boolean equals(Object other)
      Before. After.
      Overrides:
      equals in class Object

      Note: nothing between "Before." and "After."

      Preferred behavior would be to get a distinct warning or error in these different cases:
      1. the element was found in a class file, so the source was not available
      2. the element was found in a source file, but there was no comment for the element
      3. the element was found in a source file, and there was a comment, but the relevant part of the comment was empty.


      CASE 2. Separate end user libraries.

      Library A declares a class A with a method.
      Library B declares a class B that extends A, overrides the method, and uses `{@inheritDoc}`

      Generate docs for A, then:
      2.1 Generate docs for B, A not provided ... gives compilation error as expected
      2.2 Generate docs for B, A on source path ... finds A's source and comments, but does not link
      2.3 Generate docs for B, A on classpath... finds A classes, but inheritDoc is quiet no-op, and no link (same as CASE 1)
      2.4 Generate docs for B, A with -linkoffline ... gives compilation error as expected
      2.5 Generate docs for B, A on source path and with -linkoffline: works as expected, finds A's source and comments, and links
      2.6 Generate docs for B, A on class path and with -linkoffline: finds A classes, but inheritDoc is quiet no-op, and links


      CASE 3: Same as case 1, but also using --patch-module to provide partial source for java.base

      3.1 put po on sourcepath, use --patch-module for java.base

      result: fails to find files for po
      Possible cause: confusion between internal module (source) path and explicit sourcepath

      3.2 list po files on command line

      result: works as expected: finds O.java and source for Object.java, inherits doc comment correctly and generates expected links

            Unassigned Unassigned
            jjg Jonathan Gibbons
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: