I am having a hard time understanding why the error below happens. If #1 is ok, why is #2 not?
public interface IFoobar<DATA extends IFoobar> {
void bigFun();
}
class FoobarImpl<DATA extends IFoobar> implements IFoobar<DATA> {
public void bigFun() {
DATA d = null;
IFoobar<DATA> node = d; //#1 ok
d = node; //#2 error
}
}
Because
DATAis a type ofIFoobar, but not the other way around. It’s no different than: