-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
injector.instance[Class with Trait] throws UnsupportedException #87
Comments
I wanted to add that we've discovered another common case where this fails for us as well. When attempting to bind or read the bound instance of a Jackson ObjectMapper augmented with the ScalaObjectMapper:
Thanks. |
I can probably look at that in a few days. If you wanted to fiddle with substituting the contents of the scalatypetojavatype method with the json4s stuff that would greatly speed it up. The only time I have to work on this is after dinner when the spouse is busy. If the json4s thing worked it would fix a lot of issues and probably get rid of all the ignored tests. We should sure to make regression tests for all the cases you are finding. |
@tsuckow understood -- thanks for your help here. Let me see if I can get json4s stuff working without too much surgery. Thanks again. |
Should be fixed in 4.2.9. Thank you for your PR's |
Hey there, back again. We're continuing our upgrade of Finatra to the latest version of scalaguice and have encountered another issue around the TypeConversions logic.
We have a fair amount of usage of the finagle-mysql library where a common pattern is to create a MySQL client, then augment it for doing transactions, e.g.,
Client with Transactions
. An instance of this type is then typically provided to the object graph via an@Provides
-annotated method in a Module. However, with the latest scalaguice library, the TypeConversions fails to translate the ScalaType to a JavaType and thus any attempt to get the bound instance via an injector lookup throws an exception like this:Here's an example repro using Scala 2.12.10, JDK 8, scalaguice 4.2.8 and guice 4.2.3.
Binding this type via the scalaguice bind DSL in the ScalaModule also fails similarly:
And like before this worked in scalaguice 4.2.0 pre the transition from Manifests to TypeTags.
I wanted to also point out that translation from Scala types to Java types is something we have to do a lot in JSON serialization/deserialization and after years of having our own hand-rolled stuff we switched to make use of the reflection portion of the json4s library which handles a fair amount of these cases -- not sure if it's worth taking a look but thought I'd mention.
Any help here would be greatly appreciated as this blocks our Finatra library upgrade to the latest version of scalaguice which enables us to get to Scala 2.13 support. Thanks!
The text was updated successfully, but these errors were encountered: