So after a bit of spec re-reading and debugging... The condition for assignability starts with - A parameterized bean type is considered assignable to a parameterized required type if they have identical raw type and for each parameter: Identical raw type means you will actually be matching a required type of GenericFoo<Long> and a bean type of GenericFoo<T extends Comparable<T>> (not FooImpl). The condition for assignability then continues with - the required type parameter and the bean type parameter are both type variables and the upper bound of the required type parameter is assignable to the upper bound, if any, of the bean type parameter Upper bound of required type is Long; upper bound of bean type parameter is Comparable<T>. Now, is Long assignable to Comparable<T>? I don't think so, it would be assignable to Comparable<Long> but T can stand for any type and Long is simply too specific in this case. Or am I missing something? These generics are always brain-frying matter Also, would love to hear Martin Kouba opinion on this. |