This content has been marked as final.
Show 3 replies
-
1. Re: Unsatisfied deps in migration to Weld2
luksa Jul 30, 2013 7:10 AM (in response to nickarls)You also can't do this in Java, actually.
DummyManager<Dummy, Dummy> dummyManager = new MyDummyManager() will not compile. See http://docs.oracle.com/javase/tutorial/java/generics/inheritance.html
You should change the injection point to DummyManager<? extends Dummy, ? extends Dummy>.
-
2. Re: Unsatisfied deps in migration to Weld2
luksa Jul 30, 2013 7:33 AM (in response to luksa)A good explanation of why this shouldn't be possible is this:
Let's say DummyManager had a setter for F:
public abstract class DummyManager<F extends Dummy, B extends Dummy> { private F f; public void setF(F f) { ... } }
Now, if MyDummyManager was injected into injection point
@Inject private DummyManager<Dummy, Dummy> dummyManager;
It would be possible for you to do:
this.dummyManager.setF(new Bar());
So you'd end up with MyDummyManager having an instance of Bar stored in field f, which is supposed to be of type Foo.
-
3. Re: Unsatisfied deps in migration to Weld2
nickarls Jul 30, 2013 9:53 AM (in response to luksa)Indeed! Thanks for the clarification. My migration project now blows up at a fresh location