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

javac incorrectly gives ambiguity warning with override-equivalent abstract inherited methods

XMLWordPrintable

    • b40
    • generic
    • generic, solaris_8
    • Not verified

      An Eclipse developer observed that javac detects an error in the program below, but the Eclipse compiler does not.

      interface J {
        String foo(Number n);
      }
      interface K {
        Object foo(Number n);
      }
      public abstract class X implements J, K {
        void foo() {
          foo(0.0f); // javac error: ambiguous
        }
      }
      class Z extends X {
        public String foo(Number f) {
            return null;
        }
        public static void main(String args[]) {
            System.out.println(new Z().foo(0.0f));
        }
      }

            mcimadamore Maurizio Cimadamore
            abuckley Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: