interface I1 { ... }
interface I2 { ... }
interface I3 { ... }
interface I4 { ... }
interface MyFactory {
Object<? extends I1 & I2 & I3> createI1I2I3(); // doesn't work
Object<? extends I2 & I3 & I4> createI2I3I4(); // doesn't work
}
Is there a trick to do it? I was thinking about things like
interface I1I2I3 extends I1, I2, I3 { ... }
But I1I2I3 != <? extends I1 & I2 & I3>. There's a reason I just can't use this approach - I1, I2 and I3 are foreign code.
Update
For those who curious why might someone need such a weird thing:
interface Clickable {}
interface Moveable {}
interface ThatHasText {}
interface Factory {
Object<? extends Clickable> createButton(); // just a button with no text on it
Object<? extends Clickable & ThatHasText> createButtonWithText();
Object<? extends Moveable & ThatHasText> createAnnoyingBanner();
}