Here is a class
public static class Base {
public int b1;
}
Here is a Consumer function
public static Consumer<Base> consumer = (t) -> {
System.out.println("" + t.b1);};
This is the calling sequence:
Base base1 = new Base();
consumer.accept(base1);
This is what I expect.
If I change the consumer to accept extensions of Base:
public static Consumer<? extends Base> consumer = (t) -> {
System.out.println("" + t.b1);};
Then the same calling sequence doesn't compile. The compiler complaining that the capture of the consumer is not applicable to argument Base
Base surely extends Base??
If instead of a Consumer I define a method:
static <T extends Base> void accept(T param) {}
This method can be called with base1 without compiler error.