I have problems with binding wildcard types in scala Guice. If you define a binding like bind[Container[_]].toInstance(someInstance) or bind[Containter[_ <: SomeImpl].toInstance(someInstance) then injections of these types into constructors/fields will fail.
I have pinpointed the problem to the way scalaGuice generates a typeLiteral see spec below:
val typeLiteralScalaGuice = typeLiteral[Container[_ <: Impl1]]
val typeLiteralJavaWay = new TypeLiteral[Container[_ <: Impl1]] {}
typeLiteralJavaWay shouldEqual typeLiteralScalaGuice //this failes
I have problems with binding wildcard types in scala Guice. If you define a binding like
bind[Container[_]].toInstance(someInstance)
orbind[Containter[_ <: SomeImpl].toInstance(someInstance)
then injections of these types into constructors/fields will fail. I have pinpointed the problem to the way scalaGuice generates a typeLiteral see spec below: