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

javadoc allows to create a @link to a non-existent method

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 23
    • tools
    • None
    • behavioral
    • minimal
    • JavaDoc will fail to generate documentation for code containing reference tags that use the wrong type.
    • Other

      Summary

      JavaDoc should not accept member references that use a nested type instead of the type containing the member.

      Problem

      When linking to a method or field in JavaDoc comments, it is currently possible to use a nested type of the type containing the method or field in the reference tag. Consider the following example:

      {@link Map.Entry#put(K, V)}

      Although interface Map.Entry does not have a put method, the tag is accepted by JavaDoc and creates a link to the put(K, V) method in the enclosing Map interface.

      Solution

      When resolving a reference to a field or method with an explicit type name, JavaDoc should make sure the given type contains the given field or method, otherwise report an error.

      The solution should not affect member references where the type name is omitted, which are resolved against the type containing the reference and its enclosing types, if any.

      Specification

      Honor the type name in JavaDoc method or field references, and report an error if the method or field is not found in the given type.

            hannesw Hannes Wallnoefer
            prappo Pavel Rappo (Inactive)
            Pavel Rappo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: