public class StaticInstanceReference {
private static A a = new A();
public void staticMethodReference() {
//consumesRun(() -> a.doIt());
consumesRun(a::doIt);
//A b = new A();
//consumesRun(b::doIt);
}
private void consumesRun(Runnable r) {
r.run();
}
public static class A {
public void doIt() {
}
}
}
修复类似这种静态实例的方法引用