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

jackson-databind 3.0.0-SNAPSHOT refactor causing compile issues for jackson-module-scala #2748

Closed
pjfanning opened this issue Jun 8, 2020 · 3 comments

Comments

@pjfanning
Copy link
Member

https://groups.google.com/forum/#!topic/jackson-dev/q9U-ztM0QYA

I had this module compiling but a lot of tests were broken. There is 1 compile problem now (after a recent jackson-databind change).

https://travis-ci.org/github/FasterXML/jackson-module-scala/jobs/695451500

There is an instance where I only have access to a DeserializationConfig but then need the full DeserializationContext to call a method. Any suggestions about how I can get a context from a config or how I could refactor the code to store a context?

Response from @cowtowncoder

Since DeserializationContext is per-call (i.e. no stateful instance
created for each readValue()) but DeserializationConfig is not (it
is immutable already in 2.x), latter can not contain reference to
former, so that is unfortunately not possible.

I think I'd need to understand usage bit better -- could you create an
issue for jackson-databind, adding references from your link, so I
can have a look at it? AnnotationIntrospector is similar to
DeserializationConfig and lacks access to DeserializationContext
(nor should expect one), but there should be a way to refactor things.

@pjfanning
Copy link
Member Author

ScalaAnnotationIntrospectorModule findValueInstantiator receives a DeserializationConfig and creates its own ValueInstantiator that makes a call that needs the full DeserializationContext -- calling StdValueInstantiator getFromObjectArguments (this is the method that seems to have changed recently)

@cowtowncoder
Copy link
Member

I must have thought I have a reason to change argument from config to context, but I can not really remember what that would be now. Since it does not actually appear to be necessary, I reverted the change, rebuilt 3.0.0-SNAPSHOT, and will try recompiling other modules just to make sure.

@cowtowncoder
Copy link
Member

Looks like ctxt was needed/used by Eclipse Collections, and the reason was that access to TypeDeserializers now requires DeserializationContext, not just DeserializationConfig.
There was a good reason (... that now escapes me) for that change, but unfortunately this can be problematic for creating ValueInstantiator. Need to resolve that, but I don't think ctxt should be passed via getFromObjectArguments()... at least until I figure out a solid reason.

I hope this allows making Scala module compile against 3.0 of databind (or at least closer)

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

No branches or pull requests

2 participants