Following code fails to compile:
public class Test10 {
interface Iface<T extends U, U> { }
public static void main(String argv[]) {
Iface<? extends Integer, ? super Number> i = null;
}
}
however according to JLS8 4.5:
"A parameterized type C<T1,...,Tn> is well-formed if ... when subjected to capture conversion (��5.1.10) resulting in the type C<X1,...,Xn>, each type argument Xi is a subtype of S[F1:=X1,...,Fn:=Xn] for each bound type S in Bi."
In this case, given 'CAP1 extends Integer' and 'CAP2 super Number', Iface<CAP1, CAP2> is within its bounds -- CAP1 is a subtype of CAP2.
Swapping T and U causes compilation to succeed:
public class Test11 {
interface Iface2<U, T extends U > { }
public static void main(String argv[]) {
Iface2<? super Number, ? extends Integer> i2 = null;
}
}
The code above is attached.