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

Identical signatures cause ambiguity during overload resolution

XMLWordPrintable

    • 1.2fcs
    • x86
    • windows_95, windows_nt
    • Not verified



      Name: mc57594 Date: 02/07/97


      if the primary expression of a method invocation has interface
      type, and that interface inherits two methods with the same signature, the
      compiler reports an ambiguity if f() is called through the derived
      interface, even though the signatures are identical and so should be
      treated as one entity for the purposes of overload resolution. (Guy Steele
      has confirmed this interpretation of the JLS.)

      Sample code:

      interface A {
          void f ();
      }

      interface B {
          void f ();
      }

      interface C extends A, B {
      }

      class D {
          void g (C c) {
              c.f(); // this should not be ambiguous
          }
      }

      Note that if C is an abstract class not an interface the code compiles
      correctly.
      ======================================================================


      allan.jacobs@Eng 1997-11-24
      Added a bug to "See also...." Changing the Description to get around
      a Bugtraq bug.

      Nope. Didn't work. The shadow for this bug is 4094971.

            tturnidgsunw Todd Turnidge (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: