-
Clarification
-
Resolution: Obsolete
-
Major
-
None
-
1.2.Final
-
None
-
None
Rules defined in section '5.2.4. Assignability of raw and parameterized types' do not consider the case when a type variable has multiple bounds.
For example, the bullet
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.
should have meaning similar to:
... for each upper bound T of the bean type parameter, there is an (at least one) upper bound of the required type which is assignable to T.
Consider the following example:
- interfaces Bar, Baz, Foo
class BarImpl implements Bar { ... }
interface MyInterface<T> { ... }
- bean:
class MyBean<T extends Bar & Baz & Foo> implements MyInterface<T> { ... }
- injection point:
class TestClass<U extends BarImpl & Baz> { @Inject MyInterface<U> bean; }
MyBean should not be assignable to this IP as U does not have the bound Foo. However, if e.g. BarImpl implemented also Foo, it should be OK, i.e. MyBean could be injected.
Please, correct me if I am wrong.
- is related to
-
WELD-1684 BeanTypeAssignabilityRules#matches is incorrect for TypeVariable with multiple bounds
- Resolved