H
HK
Consider the following interface:
import java.util.List;
public interface Action<CDTA> {
void invoke(List<? extends CDTA> r);
}
Now I try to implement it like this:
private static class Xaction implements Action<Number> {
public void invoke(List<Number> l) {
// not yet implemented
}
}
The compiler, however, complains that Xaction does not
implement Action. I can only guess that type-safety
would break if the implementation was allowed. But how?
Can someone give an example that goes wrong if the
above is allowed?
Harald.
import java.util.List;
public interface Action<CDTA> {
void invoke(List<? extends CDTA> r);
}
Now I try to implement it like this:
private static class Xaction implements Action<Number> {
public void invoke(List<Number> l) {
// not yet implemented
}
}
The compiler, however, complains that Xaction does not
implement Action. I can only guess that type-safety
would break if the implementation was allowed. But how?
Can someone give an example that goes wrong if the
above is allowed?
Harald.