Closed GoogleCodeExporter closed 8 years ago
Strange, this should work, in all its variations. I'll take a look today.
Original comment by aragos
on 3 Nov 2010 at 4:24
Turns out this problem exists because Guice doesn't support untargetted
annotated bindings. In pure Guice, the below test yields and error. I'll follow
up with the Guice guys whether this is intentional.
public void testUntargettedAnnotatedBinding() {
String annotated = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(String.class).annotatedWith(Names.named("foo"));
}
}).getInstance(Key.get(String.class, Names.named("foo")));
assertNotNull(annotated);
}
1) No implementation for java.lang.String annotated with
@com.google.inject.name.Named(value=foo) was bound.
at com.google.gwt.inject.rebind.GuiceTest$1.configure(GuiceTest.java:33)
Original comment by aragos
on 3 Nov 2010 at 5:52
Appears also that "redundant" by virtue of the existence of an @ImplementedBy
annotation on the target interface also has this problem. e.g.
bind(IMyWidgetUI.class).annotatedWith(Names.named("blah")).to(MyWidgetUI.class).
in(Singleton.class);
where:
@ImplementedBy(MyWidgetUI.class)
public interface IMyWidget {
...
}
Original comment by craig...@gmail.com
on 21 Dec 2010 at 8:20
I'll mark this issue as "Won't fix" for now since Guice exhibits the same
behaviour and Gin generally follows Guice. Please take this up with the Guice
guys if you'd like to get it fixed.
Original comment by aragos
on 21 Jan 2011 at 9:23
Original issue reported on code.google.com by
mapa...@google.com
on 3 Nov 2010 at 12:10