If the module contains a duplicate binding such as:
binder.bind(String.class).annotatedWith(Names.named("test"));
binder.bind(String.class).annotatedWith(Names.named("test")).in(Singleton.class)
;
then the following exception is thrown:
java.lang.UnsupportedOperationException
at
com.google.inject.InvalidBindingImpl.acceptTargetVisitor(InvalidBindingImpl.java
:34)
at
com.google.inject.BindingProcessor.putBinding(BindingProcessor.java:252)
at
com.google.inject.BindingProcessor.access$300(BindingProcessor.java:39)
at
com.google.inject.BindingProcessor$4.visitUntargetted(BindingProcessor.java:177)
at
com.google.inject.BindingProcessor$4.visitUntargetted(BindingProcessor.java:125)
at
com.google.inject.internal.ModuleBinding$1.acceptTargetVisitor(ModuleBinding.jav
a:54)
at
com.google.inject.internal.ModuleBinding.acceptTargetVisitor(ModuleBinding.java:
116)
at
com.google.inject.BindingProcessor.visitBinding(BindingProcessor.java:125)
at
com.google.inject.BindingProcessor.visitBinding(BindingProcessor.java:39)
at
com.google.inject.internal.ModuleBinding.acceptVisitor(ModuleBinding.java:108)
at
com.google.inject.AbstractProcessor.processCommands(AbstractProcessor.java:55)
at
com.google.inject.InjectorBuilder.buildStatically(InjectorBuilder.java:141)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:97)
at com.google.inject.Guice.createInjector(Guice.java:92)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
[snip]
I assume the same holds true if the duplicate binding is scattered across
different modules. The above stack-trace was produced using the trunk code.
Original issue reported on code.google.com by gili.tza...@gmail.com on 22 Nov 2008 at 5:43
Original issue reported on code.google.com by
gili.tza...@gmail.com
on 22 Nov 2008 at 5:43