Open GoogleCodeExporter opened 9 years ago
The @Inject'd class doesn't have the assisted parameters annotated with
@Assisted. The injection is failing because there's no boolean injection point
in your main injector, and assistedinject doesn't know that it needs to assist
it.
Original comment by sberlin
on 24 Jun 2014 at 1:57
It doesn't work without @Assisted("mobile") too.
Original comment by the...@gmail.com
on 24 Jun 2014 at 2:02
Please post the newer stack trace & a minimal test-case that produces the
failure.
I'm 100% certain that it has nothing to do with "boolean" not working with
assistedinject, as we have a ton of code that successfully does that.
Keep in mind that if you intended to assist the other parameters, you should
mark those as @Assisted too, otherwise Guice will inject them from the main
injector, not from your factory-supplied arguments.
Original comment by sberlin
on 24 Jun 2014 at 2:07
Solution:
Looks like I've understand your point. Posting here a solution in case of
somebody else is as dumb as me.
Factory:
public interface RedirectorFactory {
public Redirector build(
EndpointsConfig endpoints,
@Assisted("redirectUrl") String redirectUrl,
@Assisted("redirectQuery") String redirectQuery,
boolean mobile);
}
Constructor:
@Inject
public Redirector(
@Assisted EndpointsConfig endpoints,
@Assisted("redirectUrl") String redirectUrl,
@Assisted("redirectQuery") String redirectQuery,
@Assisted boolean mobile) {
Original comment by the...@gmail.com
on 24 Jun 2014 at 2:13
Original issue reported on code.google.com by
the...@gmail.com
on 24 Jun 2014 at 11:27