I am facing issue with method reference combined with generic types.
We have code where we need to call a overloaded method, but it is failing with error:
Cannot resolve value m1()
I have simplified my problem to make it clear where the problem lies.
The following code fails:
public class Test { void test() { // Getting error here setValue(C1::m1, Integer.ONE); } <E extends I1, T> void setValue(BiConsumer<E, T> cons, T value) { } } interface I1 { } class C1 implements I1 { void m1(Integer value) { } void m1(int value) { } } Can someone please why this is behaving like this ?
Kindly note this is not related to the question Java 8 Method reference with generic types