-
Bug
-
Resolution: Fixed
-
P2
-
None
-
Verified
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);
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);