Reputation: 1682
If I have
public abstract class SomeType<T extends SomeOtherType> {}
public class WrapperType<U extends SomeType<T>> {}
Is there a way to modify the latter signature (which is an error 'cannot resolve symbol "T"') so that I can use the generic type in WrapperType, say for List<T>
or something analogous?
(If I have posed this question using the wrong terminology, I'd appreciate the corrections.)
Upvotes: 4
Views: 116
Reputation: 178263
It's quite simple once you realize what's going on. You didn't define T
in the scope of the class WrapperType
. Declare it with at least the same bounds as in SomeType
.
class WrapperType<T extends SomeOtherType, U extends SomeType<T>> {}
Upvotes: 5