Skip to content

jackson-databind 2.11.0-SNAPSHOT no longer supports Scala Either[L,R] #2569

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

Closed
pjfanning opened this issue Dec 10, 2019 · 12 comments
Closed

Comments

@pjfanning
Copy link
Member

I've isolated the change in jackson-databind to changes of 9 Nov 2019.

@pjfanning pjfanning changed the title jackson-databind 2.11 no longer supports Scala Either[L,R] jackson-databind 2.11.0-SNAPSHOT no longer supports Scala Either[L,R] Dec 10, 2019
@cowtowncoder
Copy link
Member

cowtowncoder commented Dec 10, 2019

From warnings, this seems relevant:

[warn]         ctxt.reportWrongTokenException(jp, JsonToken.END_ARRAY,
[warn]              ^
[warn] /home/travis/build/FasterXML/jackson-module-scala/src/main/scala/com/fasterxml/jackson/module/scala/ser/EitherSerializer.scala:60: method findConvertingContentSerializer in class StdSerializer is deprecated: see corresponding Javadoc for more information.
[warn]     ser = Option(findConvertingContentSerializer(prov, prop, ser.orNull))
[warn]                  ^
[warn] 5 warnings found

and as per Javadocs

    /**
     * @deprecated Since 2.9 use {link {@link #findContextualConvertingSerializer} instead
     */
    @Deprecated
    protected JsonSerializer<?> findConvertingContentSerializer(SerializerProvider provider,
            BeanProperty prop, JsonSerializer<?> existingSerializer)

Not sure if what might have changed since deprecation was bit earlier but typically behavior of deprecated methods is less well tested after deprecated (that is, test code is updated to use non-deprecated functionality, most of the time).

But it probably makes sense to start by changing the call as suggested and see if that helps.

@pjfanning
Copy link
Member Author

I removed the use of the findConvertingContentSerializer method but the same issue occurs.

@pjfanning
Copy link
Member Author

In my testing, I isolated the change that caused the issue to the commits of Nov 9. https://github.com/FasterXML/jackson-databind/commits/2.11?after=2f89b9ca71f8e009f50b86506dc5f11804b5ad94+34

@cowtowncoder
Copy link
Member

Did not realize that Either was a ReferenceType. This could be related since registration of serializers is based on subtype of JavaType.

Unfortunately I can't quite decipher Scala code with traits and all so I don't know where and how EitherSerializer is registered -- but I suspect it may be relying on older mechanism wherein default ("bean" / POJO) lookup was (also) called, not just one added for ReferenceType (which itself was added in 2.6).

@pjfanning
Copy link
Member Author

@cowtowncoder I fixed jackson-module-scala with FasterXML/jackson-module-scala@2718645 - in the past, findBeanDeserializer worked but now findReferenceDeserializer is needed

@cowtowncoder
Copy link
Member

@pjfanning excellent, thank you.

I am not sure how this could be done, but it would be great to figure out a way to do Travis builds to help figure out breaking changes in jackson-databind (or theoretically jackson-core) wrt downstream dependencies, during development of new minor versions.
This would make it much easier to resolve issues if they were discovered earlier.

@pjfanning
Copy link
Member Author

@cowtowncoder I set up a daily build on jackson-module-scala 2.11 branch - based on https://docs.travis-ci.com/user/cron-jobs/ - I'll see if it runs as expected

@cowtowncoder
Copy link
Member

cowtowncoder commented Dec 16, 2019

the only (?) trick really would be to trigger that build when jackson-databind or jackson-core runs. Perhaps it could be triggered by availability of a new snapshot version at Sonatype snapshot repo?

I am specifically worried about changes in databind, over time. Changes in modules themselves are caught quite well by travis builds already.

@pjfanning
Copy link
Member Author

the cron-based build I set up for jackson-module-scala pulls in latest jackson 2.11.0-SNAPSHOT jars

@cowtowncoder
Copy link
Member

cowtowncoder commented Dec 16, 2019

@pjfanning ah so it runs on regular schedule, in addition to being triggered by new commits? That would work.

Unrelated, but now that we are talking: just filed this

#2571

which is more triggered by needs of Kotlin (originally filed #2527) but might help resolve some long term Scala module challenges too.

@pjfanning
Copy link
Member Author

yes it builds off both commits and a daily schedule

@cowtowncoder
Copy link
Member

Not related to this issue which is now fixed it sounds like (yay!), but completing #2527 which supports Kotlin's approach via new AnnotationIntrospector method. Not sure it would be useful for Scala, but will mention for sake of completeness.

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