In:
// services
public interface Mother { public Collection<? extends Father> getMamaStuff() {}}
public interface Daughter extends Mother {}
// data
public interface Father { public String getPapaStuff() }
public interface Son extends Father { public String playLoudMusic() }
why is this not allowed:
public class Clazz {
Clazz(Daughter daughter) {//boilerplate}
public Collection<Son> idk = doughter.getMamaStuff();
}
It seems to me there is no way around type checking.
The reason it's not allowed:
interface Feline { }
interface Kitten extends Feline {}
interface Tiger extends Feline {}
...
Cage<? extends Feline> makeCage();
// at this point, it's actually really important that
// the right kind of cage was created...
makeCage().put(new Tiger());
Parameterizing Mother
may work in your situation:
public interface Mother<T extends Father> {
public Collection<T> getMamaStuff(); {}
}