Suppose I have:
public interface Action<S extends Shape> {
public void start( S shape );
}
Why do I get the following?
public <S extends Shape> void performAction( Action<S> action, Shape shape ) {
action.start(shape); // error: cannot supply Shape
}
In other words, in the future, I might have subclasses of Shape
and Action
s that operate on them like:
Action<Rectangle>
Action<Blob>
I'd like to have a uniform interface that can apply Action
s to a bunch of different subclasses of Shape
.