I have a functional interface defined as
@FunctionalInterface
public interface SetupConstraint<T extends GraphicalObject> {
public void setup(T object);
}
The class hierarchy here is
OutlineRect is a subclass of GraphicalObject
SelectableOutlineRect is a subclass of OutlineRect that implements Selectable
Now I have
SelectableOutlineRect r = new SelectableOutlineRect();
SetupConstraint<? extends OutlineRect> constraint = ...; // from somewhere else
constraint.setup(r);
In the final line of code, the compiler gives the following error:
The method setup(capture#1-of ? extends OutlineRect) in the type
SetupConstraint<capture#1-of ? extends OutlineRect> is not
applicable for the arguments (SelectableOutlineRect)Java(67108979)
I'm so confused about this right now... I'm fairly new to this but I believe since SelectableOutlineRect is a subclass of OutlineRect this should not report an error. What am I missing here?