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

Specify how to resolve an ambiguous reference to an overloaded method

XMLWordPrintable

      Here's an example. A doc comment for java.lang.invoke.CallSite#setTarget contains the following link: {@linkplain MethodType#equals equal to}. Now, there are two methods called "equals" in the MethodType class: one public and one private method. While IntelliJ IDEA seems to be choosing the private method, which is naturally inaccessible from the outside of MethodType, javadoc (tool) choses the public method, which is inherited from the java.lang.Object. The specification seems silent on that.

      I haven't yet checked what happens in either javadoc (tool) or IntelliJ IDEA if there are more than one accessible same-named method.

      I also assume there might be some clarification required for the case where a field and a method share a name and the link does not contain enough information to disambiguate them. For example,

          private int hashCode;

          @Override
          public int hashCode() {
              return super.hashCode();
          }

          /**
           * {@link #hashCode}
           */
          void method() { }

      See the attached screenshots of IntelliJ IDEA.

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

              Created:
              Updated: