Suppose there is classes/interfaces hierarchy:
class A<T>{
T method(T t){
return t;
}
}
class B<T> extends A{
T method(T t){ // method(T)' in 'B' clashes with 'method(T)' in 'A'; both methods have same erasure, yet neither overrides the other
return t;
}
}
As we see there are a compiler error. I've never came across the rules how to treat generics when inherit. What are the restrictions? (please don't be confused with inheritance IN generic type itself, i'm asking about inheritance in original classes
also don't be confused with "What is a raw type", I know the raw types, at this question I wanna figure out what are the rules for inheritance)
also don't be confused thinking I wanna fix this error. Of course class B extends A fix it. My question is about: "where can I read the restrictions?"