The thing is that if a class A (or interface) extends a raw type of a generic class (class MyRawBean extends MyBean; class MyBean<T>), than there "are no generics" in the type hierarchy of the class A, i.e. only raw versions of generic supertypes are supertypes of the class A (MySuperInterface instead of MySuperInterface<Number>).
I did not find (did not even search) where this behavior is defined. I detected the behavior with these steps: https://bugs.eclipse.org/bugs/show_bug.cgi?id=437511 - I remember that Eclipse editor could not detect this and did not warn me, so I filed an issue. For "definition", see Stephan's comment. (And to raise the priority of the issue, just verify that Eclipse compiles it without problems. I am forced to use IDEA now.)
Another case:
public interface MyGenericInterface<T extends MySuperInterface<Number>>
public class MyGenericBean<T extends MyRawBean> implements MyGenericInterface<T>
In IntelliJ IDEA, it shows me a problem "Type parameter 'T' is not within its bounds; should implement MySuperInterface<Number>" which means that MyRawBean is not (considered to be) a subtype of MyGenericInterface<T>.
|