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

javac gives inappropriate warning about potentially ambiguous methods

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 15
    • 13
    • 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

            asotona Adam Sotona
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: