javac gives inappropriate warning about potentially ambiguous methods

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 15
    • Affects Version/s: 13
    • Component/s: tools
    • b25

      Javac reports the following warning:

      src/share/classes/jdk/codetools/apidiff/model/TypeMirrorComparator.java:77: warning: [overloads] compareAll(Function<Integer,Position>,IntTable<TypeMirror>) in TypeMirrorComparator is potentially ambiguous with compareAll(Function<ElementKey,Position>,KeyTable<TypeMirror>) in TypeMirrorComparator

      The type of the second argument should prevent any ambiguity: it's either KeyTable<TypeMirror> or IntTable<TypeMirror> which are unrelated classes:

      grep 'class' src/share/classes/jdk/codetools/apidiff/model/*Table.java
      src/share/classes/jdk/codetools/apidiff/model/IntTable.java:public class IntTable<T> {
      src/share/classes/jdk/codetools/apidiff/model/KeyTable.java:public class KeyTable<T> {

      with no common supertype other than Object.

      Filed as a bug, because the code is as intended, with no trivial workaround, and the warning prevents use of -Xlint:all -Werror

            Assignee:
            Adam Sotona
            Reporter:
            Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: