-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fixed so that KeyDeserializer set by annotation is not overwritten by KeyDeserializer set in the mapper #4929
Conversation
From https://github.com/FasterXML/jackson-databind/blob/eeb5f2b764a505c91fda5c55620e60da30676152/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java#L466 , it seems that only acquisition for JavaType is sufficient.
src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java
Show resolved
Hide resolved
src/test/java/com/fasterxml/jackson/databind/ser/TestKeyDeserializerOverwritten.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we have some problem with jdk8?
Other than that changes seem reasonable! 👍🏼 @k163377
src/test/java/com/fasterxml/jackson/databind/ser/TestKeyDeserializerOverwritten.java
Outdated
Show resolved
Hide resolved
src/test/java/com/fasterxml/jackson/databind/ser/TestKeyDeserializerOverwritten.java
Outdated
Show resolved
Hide resolved
Fixed |
@@ -0,0 +1,65 @@ | |||
package com.fasterxml.jackson.databind.deser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even more specifically, Map-key deserialization tests are under com.fasterxml.jackson.databind.deser.jdk
like existing MapKeyDeserialization3143Test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can move the test.
---Ok this seems like something that could easily break usage (I don't trust our test coverage in this area), so let's change PR to be against EDIT: Actually, never mind: this looks like a safe fix -- can go in 2.18 |
src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java
Show resolved
Hide resolved
}; | ||
|
||
@Test | ||
void withoutForClass() throws JsonProcessingException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use throws Exception
, going forward, just so merging to master
is easier (exceptions are renamed plus no longer extend IOException
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM: precedence of annotation-lookup must be higher than module provided ones.
This is a fix for #4444 and is also relevant to FasterXML/jackson-module-kotlin#777 .