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

Types referred in @link/@linkplain tags are not always hyperlinks

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • tools
    • None
    • behavioral
    • low
    • JDK

      Summary

      Emit a waring for silent link failures when {@link} or {@linkplain} tags refer to members or types that are not visible under the current Javadoc visibility flag (e.g., a private field when -private is not enabled).

      Problem

      Authors may write

      /**
       * See {@link #privateField} for details.
       */
      public void foo() {}

      and expect a hyperlink, but if privateField is private (and -private isn't specified), javadoc silently renders plain text with no feedback. Author may also accidentaly link to a private field when they intended to link to a public method.

      Solution

      If the referenced element cannot be linked, emit a warning to alert users about this issue.

      Specification

      No specification changes are required.

      Specification

      The proposed text for the warning is:

       warning: the specified link will not be shown because the referenced element has access-level "-private" (see -private)
               *     {@link <ref>} text.
                     ^

            nbenalla Nizar Benalla
            prappo Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: