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

javac gives inappropriate warning about potentially ambiguous methods

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 15
    • 13
    • tools
    • b25

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: