The spec requires that the inferred type arguments are within bounds. See section 5.6.2. It talks of type parameters T extends U1&...Um, for which a type argument A is inferred, which is "the most specific non-null type such that ... T:=A". Which means that the inferred type argument must in within bounds. That's not what the compiler does.
Example:
public class Cell2 {
<A, B extends A> doS(A[] h, B i) {
h[0] = i;
}
public static void main(String[] args) {
Cell2 c = new Cell2();
c.doS(new Integer[]{new Integer(5)}, new String("Hallo"));
}
}
yields the error message:
Test.java:8: doS<A, B extends A>(A[],B) in Test cannot be applied to
(java.lang.Integer[],java.lang.String); inferred type argument(s)
java.lang.Integer,java.lang.String do not conform to bounds of type
variable(s) A,B
doS(new Integer[] {new Integer(5)}, "hello");
^
1 error
Why does the compiler infer A:=Integer and B:=String? According to the spec it must infer A:=Object and B:=Object, because they conform to the bounds.