I am trying to assign a method reference to the following generic interface.
interface Interface1<R> {
  public R doIt();
}
interface Interface2<P, R> {
  public R doIt(P x);
} 
public class Test {
  public static Long foo(Long x) {
      return x;
  }
  public static Long bar() {
      Long x = 1L;
      return x;
  }
  public static void main(String[] args) {
    Interface1<? extends Number> fun1 = Test::bar; //works
    Interface2<? extends Number, ? extends Number> fun2 = Test::foo; // does not work
  }
} 
The second assignment gives me
incompatible types: Number cannot be converted to Long
What am I missing here!
 
    