Skip to content
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

investigate why JsonValue annotation does not work in Scala 3 #532

Closed
pjfanning opened this issue Jul 31, 2021 · 6 comments
Closed

investigate why JsonValue annotation does not work in Scala 3 #532

pjfanning opened this issue Jul 31, 2021 · 6 comments
Labels

Comments

@caarmen
Copy link

caarmen commented Dec 4, 2021

I was trying to debug the issue with @JsonValue being ignored with scala 3.

The way this works is mostly a mystery to me, but I did notice one difference, using the debugger, when running TestJsonValue with scala 2 vs 3.

I executed this in the debugger "Evaluate expression" tool

classOf[ValueClass].getMethod("value").getDeclaredAnnotations

With scala 2, it returns an array with one item. With scala 3, it returns an empty array.

Not sure how useful this is :)

@pjfanning
Copy link
Member Author

Thanks @caarmen - that sounds like the likely cause. The Scala3 compiler has a few optimisations that has caused a few issues for jackson.

@caarmen
Copy link

caarmen commented Dec 4, 2021

Could this issue be related? scala/scala3#12492

@pjfanning
Copy link
Member Author

I've also linked to FasterXML/jackson-databind#3063

@pjfanning
Copy link
Member Author

Looks like Scala 3.3 fixes this. Tested with https://github.com/FasterXML/jackson-module-scala/tree/scala-3.3

It is likely that jackson-module-scala will not be compiled with Scala 3.3 until maybe the 2.16.0 release but it is likely that using Scala 3.3 runtime should be enough to fix this for users.

@pjfanning
Copy link
Member Author

Scala 3.3.0 is released. You should be able to use this any recent jackson-module-scala release with Scala 3.3.0. Upgrading to Scala 3.3.0 should be enough. See #635 for the formal uptake of Scala 3.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants