The following legal Java program doesn't compile:
class Test {
<Z extends Number> Z m(String o) { return null; }
<Z extends String> Z m(Object o) { return null; }
{ String s = m(null); } //error in javac
}
Reading JLS 3rd, section 15.12.2.2, method m(String) is not applicable - (because there's no instance of the type-variable Z satisfying the constraints imposed by the expected return type, as described in JLS 15.12.2.8). Hence, the applicability check fails and, method resolution discovers another suitable candidate, namely m(Object). javac seems to never get there.