Method reference is ambiguous for Thread.sleep
问题 I've come across a weird problem where a method reference to Thread::sleep is ambiguous but a method with the same signature is not. package test; public class Test { public static void main(String[] args) { foo(Test::sleep, 1000L); //fine foo((FooVoid<Long>)Thread::sleep, 1000L); //fine foo(Thread::sleep, 1000L); //error } public static void sleep(long millis) throws InterruptedException { Thread.sleep(millis); } public static <P, R> void foo(Foo<P, R> function, P param) {} public static <P>