package java.raw;
import java.util.Collections;
import java.util.List;
public class ExtendsRaw {
public static class Base<T> {
public List<T> elements() { return null; }
}
public static class Derived<T> extends Base<T> {}
public static class MostDerived extends Derived {
public List<MostDerived> elements() {
return Collections.emptyList();
}
}
}
MostDerived#elements is flagged red (incompatible return type) but compiles fine. I believe it's good according to the JLS.
Interestingly, if MostDerived inherits directly from Base, the error flag goes away.