-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
feat: 🚀 Support parameterized types in ClassTagExtensions #518
Conversation
@gaeljw thanks - would it be possible to retarget this PR to the 2.13 branch? - the master branch is for a future unscheduled release |
I'm not sure if this won't break binary compatibility for existing ScalaObjectMapper users. We don't make any promises about binary compatibility in jackson-module-scala v2 but we've recently started doing MIMA checks. One possibility would be to put the new code in an existing class called ClassTagExtensions - that class is not very useful as is so I'd happily replace it - so users can opt in to using your new code but would have to make an explicit change to their code to use it. |
f7d045f
to
d06e656
Compare
d06e656
to
a61c163
Compare
Done :)
I'm 100% sure it breaks binary compatibility indeed.
Indeed, I had not see this class, my proposal makes more sense in |
@gaeljw that's what I am proposing - it's awkward to balance the expectations of users who want binary compatibility and those who want to continue to support ScalaObjectMapper for Scala 3 users. One other option (that I would prefer slightly less than the existing proposal) is that we already have scala version specific src dirs and could keep ScalaObjectMapper as is in scala 2.x source but use your version in scala 3.x source. |
I'll think about the different options in the coming days and will update the PR next week probably :) |
a61c163
to
6f6edfb
Compare
Finally had some time to update the PR. The suggested code now lives in |
Not sure why the build is failing for Scala 2.13. Output is incomplete on TravisCI 🤷 |
Thanks very much @gaeljw - I'll merge and see what happens with the build |
Thanks very much @gaeljw - I'll merge this and see what happens with build - it was probably just some travis issue that caused the build failure
@pjfanning I'm currently using Scala 2.11.12 and fasterXML 2.13.1. When I compile, I see the following:
Will this deprecation warning be resolved/fixed once we move to Scala 2.12.x or later? |
@tmunk123 please read the documentation: https://github.com/FasterXML/jackson-module-scala#classtagextensions The deprecation will not disappear, you have to change your code. |
Aims to solve #503 by enriching
ClassTagExtensions
asScalaObjectMapper
is being deprecated/removed for Scala 3.The idea is to use a home-made typeclass
JavaTypeable
in combination withClassTag
s.An instance of
JavaTypeable
being provided for all non-generic types and generic types up to 5 type parameters.This compiles and pass the tests in
ClassTagExtensionsTest
.However I see at least one caveat to this implementation: if using a generic class with more type parameters than "allowed" (3 for now in this MR), the error provided to the user is not very clean:
This is because a
JavaTypeable[Uber[B,C,D]]
is provided instead of a more regular "implicit not found" error. I don't know if there's a way around that 🤷This might be acceptable though if we provide the typeclass for up to 10 or even 22 type parameters as it would occur on a very rare basis?