edit: I've made this example far simpler
I want to create a class with a generic parameter which extends a type with a generic parameter X and I want to refer to that type X without declaring it explicitly.
I'm not sure if this answers it too Why can't I use a type argument in a type parameter with multiple bounds?
class Fruit<T> {}
// I don't want to have to redefine T e.g. <F extends Fruit<T>,T>
// because T should be implicit for Fruit (see Example of instance below)
// the below will not compile, but is roughly what I'd like
class Box<F extends Fruit<T>> {
T get( F fruit ) { return null; }
}
Example of instance
class Apple extends Fruit<String>
// this is what I would like, but this won't compile with above definiton
class AppleBox extends Box<Apple> {
// String get( Apple apple ) should be implicit
}
I don't want to have to declare
class AppleBox extends Box<Apple,String>
Because String is the only option available here and should be known implicitly