Thanks to MForster <http://stackoverflow.com/users/492158/mforster> at 
Stack Overflow for his answer:

Guice doesn't allow binding TypeLiteral. But it's unclear why you would 
want to inject a TypeLiteral in the first place.

Maybe this is what you want:

class A {
  Class<? extends SuperClass> a;
  @Inject A(Class<? extends SuperClass> a) {
    this.a = a;
  }
}

together with this binding:

bind(new TypeLiteral<Class<? extends SuperClass>>() {})
    .toInstance(SubClass.class);

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/rd8MwaTg6o0J.
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?hl=en.

Reply via email to