You haven't defined a binding for C.class with the given annotation. The only annotated binding you've defined is for A.class. I can't say for sure what precisely is wrong since other parts of your code don't make entire sense (a SSCCE as always would be instrumental in helping us help you), but I'm guessing that if you change your test line to ask for an instance of A rather than C that you'll get the behavior you're expecting.
Here is a good example of an SSCCE that removes any possible confusion about what is trying to be done... except for the fact that this one was built by me in an already confused state. :-) If I'm doing some things differently that you intended, it's because I had to guess.
Notice that I'm asking the injector for an instance of A, and getting an instance of C in return.
static interface A<T> {}
static abstract class B<T> implements A<T> {}
static class C<T> extends B<T> {}
static class MyModule extends AbstractModule {
@Override protected void configure() {
bind(Key.get(A.class, Names.named("id"))).toProvider(new MyProvider());
}
}
static class MyProvider implements Provider<A<?>> {
@Inject Injector injector;
@Override public A<?> get() {
return (A<?>) injector.getInstance(C.class);
}
}
public static void main(String[] args) {
Injector injector = Guice.createInjector(new MyModule());
A<?> a = injector.getInstance(Key.get(A.class, Names.named("id")));
System.out.println(a instanceof A);
System.out.println(a instanceof B);
System.out.println(a instanceof C);
}
Your issue does not at this point seem to be related to generics, although there are some other questionable decisions made here that are related to generics.