-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix #7036: Jackson 2.19.0 update issues #7038
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
base: main
Are you sure you want to change the base?
Conversation
AnnotatedMember anyGetter = beanDesc.findAnyGetter(); | ||
|
||
List<BeanPropertyWriter> originalWriters = builder.getProperties(); | ||
|
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.
- Map serialization in Jackson relies on MapSerializer, which has stateful setup: the keySerializer must be properly assigned.
- BeanPropertyWriterDelegate is just a general field wrapper — it doesn't know or rebuild map serialization internals.
- Wrapping broke the key -> After the upgrade to 2.19.0
the value resolution pipeline. Jackson thought the Map was just a generic Object field, not a real Map with keys and values.
@@ -475,7 +477,7 @@ void deserializeSetAndReturnWithExceptionAndNullAnySetter() throws IOException { | |||
class ReflectionTest { | |||
|
|||
@Test | |||
@DisplayName("all methods from superclass (SettableBeanProperty) are implemented by delegating class (SettableBeanPropertyDelegate)") |
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.
SettableBeanPropertyDelegate does not exist.
@@ -530,5 +540,12 @@ private static MethodSignature from(Method m) { | |||
return new MethodSignature(m.getReturnType(), m.getName(), m.getParameterTypes()); | |||
} | |||
|
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.
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override |
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.
Note: This @Override
is not backward compatible with Jackson versions prior to 2.19.0.
I do have ready local changes using Reflection and package version checks to restore backward compatibility if needed.
…od overrides Refactored ReflectionTest to not only detect but also clearly report missing method implementations in SettableBeanPropertyDelegating. Missing methods are now listed with readable signatures, making similar failures easier to diagnose in the future.
…PropertyDelegating The missing override was detected when upgrading Jackson from 2.18.3 to 2.19.0, where unwrapped(NameTransformer) became a required concrete method.
…ySerializer null errors Fixes an issue in UnmatchedFieldTypeModule where the additionalProperties field was incorrectly wrapped in a BeanPropertyWriterDelegate during serializer construction. This resolves the following test failures: - UnmatchedFieldTypeModuleTest.writeValueAsStringWithAdditionalPropertiesOverridingFields - UnmatchedFieldTypeModuleTest.writeValueAsStringWithAdditionalPropertiesOverridingFieldsShouldLogWarning - UnmatchedFieldTypeModuleTest.writeValueAsStringWithAdditionalPropertiesOverridingFieldsShouldNotLogWarning
The previous check used writer.getName().equals("additionalProperties"), which failed for variations like getAdditionalProperties or when @JsonProperty was used. Changes: - Skip wrapping the any-getter property in BeanSerializerModifier - Add isAnyGetterWriter(...) to match the correct property by member Resolved test failures: io.fabric8.kubernetes.client.utils.SerializationAdditionalPropertiesTest - marshalWithAdditionalPropertiesOverridingFields - cloneShouldPreserveAdditionalProperties
Description
This PR upgrades Jackson from 2.18.3 to 2.19.0 and introduces required changes to align with the stricter API and serialization behavior introduced in the new version.
Key Changes
UnmatchedFieldTypeModule
:Updated the
BeanSerializerModifier
to correctly skip wrapping the property associated with@JsonAnyGetter
(commonlyadditionalProperties
) to prevent double-serialization and runtime errors.SettableBeanPropertyDelegating
:Implemented the missing
unwrapped(NameTransformer)
method to fully comply with theSettableBeanProperty
contract and ensure compatibility with Jackson internals.✅ Resolved Test Failures
io.fabric8.kubernetes.model.jackson.UnmatchedFieldTypeModuleTest
writeValueAsStringWithAdditionalPropertiesOverridingFields
writeValueAsStringWithAdditionalPropertiesOverridingFieldsShouldLogWarning
writeValueAsStringWithAdditionalPropertiesOverridingFieldsShouldNotLogWarning
io.fabric8.kubernetes.model.jackson.SettableBeanPropertyDelegatingTest
SettableBeanPropertyDelegatingTest$ReflectionTest.allMethodsFromSuperclassAreImplementedByDelegatingClass
io.fabric8.kubernetes.client.utils.SerializationAdditionalPropertiesTest
marshalWithAdditionalPropertiesOverridingFields
cloneShouldPreserveAdditionalProperties
This change requires Jackson 2.19.0 or newer.
The updated handling of
@JsonAnyGetter
serialization and the completeSettableBeanProperty
implementation are not backward-compatible with Jackson versions prior to 2.19.0.Type of change
test, version modification, documentation, etc.)
Checklist
Fixes #7035