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

Lambda Spec: Most-specific for an exact method reference targeting different parameter types

    XMLWordPrintable

Details

    • Verified

    Description

      In the following example, one of the overloaded methods should (probably) not be treated as more specific than the other, because they have different parameter types. The limitation of special most-specific treatment to explicit lambdas and exact method references was meant to avoid cases like this, but didn't account for the fact that method reference target parameters can be widened.

      Integer foo(Object arg) { ... }

      interface I { Object invoke(Number arg); }
      interface J { Number invoke(Integer arg); }

      void m(I arg);
      void m(J arg);

      m(this::foo);

      Attachments

        Activity

          People

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: