Why method reference doesn’t work with this?

I have a method look like this.

static <R> R applyOthers(Some some, Function<List<Other>, R> function) {
    List<Other> others = ...;
    return function.appply(others);

Now when I try this,

withSome(some -> {
   List<Other> others1 = applyOthers(some, v -> v); // works
   List<Other> others2 = applyOthers(some, Function::identity); // doesn't

An error, I get.

incompatible types: unexpected static method <T>identity() found in unbound lookup
  where T is a type variable:
    T extends Object declared in method <T>identity()

Why ::identity doesn’t work?


Function<Object, Object> f1 = v1 -> v1;
Supplier<Object> s1 = Function::identity;
Supplier<Object> s2 = () -> Function.identity();

See this piece of code, i guess you just misused the method reference here. When we say SomeObject::method, this method reference should match with some functional interface. In the above example, Function::identity is kind of supplier instance not java.util.function.Function instance.