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

javac gives inappropriate warning about potentially ambiguous methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 13
    • Fix Version/s: 15
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      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

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

              Dates

              Created:
              Updated:
              Resolved: