Consider the following code:
class Test { void accept(Consumer<Integer> c) {} static void consumer(Integer i) {} void foo() { accept(this::consumer);
I came across this the other day when I accidentally called a static method in an unsteady way. I know that you should not set static methods in a non-stationary way, but I'm still wondering why the type cannot be inferred in this case?
java java-8 type-inference method-reference
sqroot raypin
source share