Method invocation shouldn't be ambiguous.

XMLWordPrintable

    • x86
    • windows_95



      Name: diC59631 Date: 02/04/98


      To repro
      1 prepare C.java and other\O.java
      2 javac C.java
      expected: no error
      actual : 1 error

      It seems to be violating JLS15.11.2.

      "f(null)" is applicable to both of O#f(String) and O#f(Vector).
      However only f(Vector) is accessible.
      So the method invocation shouldn't be ambiguous.

      // C.java
      import other.O;
      public class C extends O {
              public static void main(String args[]) {
                      new C().g();

              }
              O o = new O();
              void g() {
      o.f(null); //<-JDK1.1beta2 issues a compile time error; Reference of f
      is ambiguous.
      o.x(null); // OK as expected
              }
      }
      // other/O.java
      package other;
      public class O {
      protected void f(String v){}
      public void f(java.util.Vector v){}

      void x(String v){}
      public void x(java.util.Vector v){}

      }
      (Review ID: 23796)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: