1 of 1 people found this helpful
you're right, this is covered in the first paragraph of 5.2.4. Assignability of raw and parameterized types. This sentence is there since CDI 1.0 and it follows the rules for Java generics.
@Inject Instance<Dao> allDaosis de facto
@Inject Instance<Dao<Object>> allDaosand you can't assign
Dao<Object>. Imagine that there is a
Dao.save(T instance)method. If it was permitted to inject
Dao<Object>, the client code would be able to
Dao.save("stringInsteadOfInteger")which is obviously wrong.
Hi Martin, thank you very much for the clarification.