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

Interface extension gets confused by duplicate methods

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.5
    • 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)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: