Issue 249: NPE in  
com.google.inject.ProviderToInternalFactoryAdapter$1.call()
http://code.google.com/p/google-guice/issues/detail?id=249

Comment #4 by tonyandpat:
As mentioned above, for an "AbstractModule" subclass this is equivalent to

bind(PermanentRedirect.class)
   .annotatedWith(Names.named("RedirectMain"))
   .in(Scopes.SINGLETON);

This is not a problem with Scopes.SINGLETON, but rather that the provider  
passed into
the scope is a "ProviderToInternalFactoryAdapter" with a null  
internalFactory.

The same thing without the annotation does work OK:
bind(PermanentRedirect.class)
   .in(Scopes.SINGLETON);

So it seems that this is a bug.

As a work-around, you may want something like this:
bind(PermanentRedirect.class)
   .annotatedWith(Names.named("RedirectMain"))
   .to(PermanentRedirect.class)
   .in(Scopes.SINGLETON);

However, that also produces an error. The one work-around I have found that  
does work
is as follows:

bind(PermanentRedirect.class)
   .annotatedWith(Names.named("RedirectMain"))
   .to(new TypeLiteral<PermanentRedirect>() {})
   .in(Scopes.SINGLETON);





-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to