I have an interface
interface x {
A getValue();
}
and the implementation
class y implements x {
public B getValue() { return new B();}
}
B is a subclass of A. This works because of covariant overriding, I guess.
But if I rewrite the interface as
interface x{
<T extends A> T getValue();
}
I get a warning in the implementation that
Warning needs a unchecked cast to conform to A.getValue()
What is the difference between 2 versions of the interface? I was thinking they are the same.