It's not clear if you want to carry the type-bounds or simply allow any subclass of SomeClass
.
By definition, the compare
method you implement will allow comparison with any subtype (because any subtype can be cast to the more general parent type when passed to the method).
To allow any parameterized type instead of the restrictive Sometype
, you can write:
public abstract class SomeClass<Sometype extends OtherClass> extends Something
implements Comparator<SomeClass<?>>
It's also legal to write this with explicit type bounds:
public abstract class SomeClass<Sometype extends OtherClass> extends Something
implements Comparator<SomeClass<Sometype>>