E.g. I have:
interface Consumer<F extends FoodType>
interface Vegetarian extends Consumer<Grass>
interface Predator extends Consumer<Meat>
I want to have something like:
class Feeder<C extends Consumer<F>>
to use F type parameter within Feeder class declaration. The aim is to pass only informative type parameter and to take up other type parameters from the passed ones:
new Feeder<Vegetarian>().buyFood(bluegrassIsGrassAndCouldNotBeMeat)
If the class is going to use two generic types it’s going to need two generic parameters even if they are dependent.
If may be useful to be a bit more flexible.
(Josh Bloch’s uses the acronym PECS: Producer’s
extend; Consumer’ssuper.)