Status: New
Owner: ----

New issue 811 by [email protected]: Assisted inject doesn't work with boolean
http://code.google.com/p/google-guice/issues/detail?id=811

Description of the issue:
Assisted inject doesn't work with boolean, version 3.0

Steps to reproduce:
1. Code for Factory interface:
public interface RedirectorFactory {
    public Redirector  build(
            @Assisted("endpoints") EndpointsConfig endpoints,
        @Assisted("redirectUrl") String redirectUrl,
        @Assisted("redirectQuery") String redirectQuery,
        @Assisted("mobile") boolean mobile);
}
2. Constructor for Object:
    @Inject
    public Redirector(
            EndpointsConfig endpoints, String redirectUrl,
            String redirectQuery,
            boolean mobile) {...}
3. Code that executes:
Redirector redirector = redirectorFactory.build(endpoints, pureRedirectUrl, pureRedirectQuery, pureMobile);
4. Getting:
1) Could not find a suitable constructor in java.lang.Boolean. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
  at java.lang.Boolean.class(Boolean.java:43)
  while locating java.lang.Boolean
for parameter 3 at com.nytimes.lire.service.Redirector.<init>(Redirector.java:65) at com.nytimes.lire.service.RedirectorFactory.build(RedirectorFactory.java:1) at com.google.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:539) at com.google.inject.assistedinject.FactoryModuleBuilder$1.configure(FactoryModuleBuilder.java:335)

1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435) at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:175) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
        at com.google.inject.Guice.createInjector(Guice.java:95)
        at com.google.inject.Guice.createInjector(Guice.java:72)
        at com.google.inject.Guice.createInjector(Guice.java:62)


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to