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

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

    Details

    • Subcomponent:
    • Resolved In Build:
      b40
    • CPU:
      generic
    • OS:
      generic, solaris_8
    • Verification:
      Not verified

      Description

      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));
        }
      }

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: