Status: New
Owner: ----
New issue 349 by kristofer.karlsson: Can not bind multiple interfaces to
the same class
http://code.google.com/p/google-guice/issues/detail?id=349
I am using Guice 1.0, sample code is attached.
It runs if you bind InterfaceB to Impl2 instead of Impl.
It produces the following output:
Exception in thread "main" java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
com.google.inject.ConstructorInjector.construct(ConstructorInjector.java:161)
at
com.google.inject.InjectorImpl$ImplicitBinding.get(InjectorImpl.java:1006)
at
com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:37)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:756)
at
com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:35)
at com.google.inject.Scopes$1$1.get(Scopes.java:53)
at
com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at
com.google.inject.BindingBuilderImpl$FactoryProxy.get(BindingBuilderImpl.java:299)
at com.google.inject.InjectorImpl$9$1.call(InjectorImpl.java:708)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:747)
at com.google.inject.InjectorImpl$9.get(InjectorImpl.java:702)
at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:728)
at GuiceTest.start(GuiceTest.java:22)
at GuiceTest.main(GuiceTest.java:17)
Caused by: java.lang.reflect.InvocationTargetException
at GuiceTest$Impl$$FastClassByGuice$$a1577db2.newInstance(<generated>)
at
com.google.inject.cglib.reflect.FastConstructor.newInstance(FastConstructor.java:40)
at
com.google.inject.DefaultConstructionProxyFactory$2.newInstance(DefaultConstructionProxyFactory.java:67)
at
com.google.inject.ConstructorInjector.construct(ConstructorInjector.java:142)
... 13 more
Caused by: java.lang.ClassCastException: $Proxy6 cannot be cast to
GuiceTest$InterfaceB
... 17 more
Attachments:
GuiceTest.java 1.1 KB
--
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
-~----------~----~----~----~------~----~------~--~---