Interface extension gets confused by duplicate methods

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • None
    • Affects Version/s: 1.1.5
    • Component/s: tools
    • x86
    • windows_95, windows_nt



      Name: diC59631 Date: 01/28/98


      Compile the following:

          interface F1 { void method (); }
          interface F2 { void method (); }
          interface F3 extends F1 /*, F2 */ {}

          class C implements F3 {
             public void method () { System.out.println("So there!"); }
          }

          public class Hello {
             public static void main (String[] args) {
                F3 f = new C();
                f.method();
             }
          }

      Note, however, if you remove the comments around ", F2 " in the definition
      of F3, you will get a compiler error, which is inconsistent with the Java
      language spec.

      Error: C:\rich\bugs\Hello.java(12): Reference to method is ambiguous. It is defined in void method() and void method().

      As far as I can see in the Java language spec, this is a totally valid program.
      (Review ID: 24108)
      ======================================================================

            Assignee:
            Todd Turnidge (Inactive)
            Reporter:
            Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: