fix: enforce Serializable check in PojoUtils.realize when Map has no "class" key#16274
Open
EvanYao826 wants to merge 1 commit into
Open
fix: enforce Serializable check in PojoUtils.realize when Map has no "class" key#16274EvanYao826 wants to merge 1 commit into
EvanYao826 wants to merge 1 commit into
Conversation
…"class" key When a generic Map does not carry a "class" entry, the target type comes from the method signature. The existing Serializable check was only applied when a "class" key was present, allowing non-Serializable DTOs to slip through when the key was absent. Add a check that rejects non-Serializable types even when the Map has no "class" key, consistent with the behavior when the key is present. Fixes apache#16270 --- *AI-agent involvement: This contribution was assisted by an AI coding agent.* Signed-off-by: EvanYao826 <2869018789@qq.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16274 +/- ##
=============================================
- Coverage 60.85% 36.96% -23.90%
+ Complexity 11779 11756 -23
=============================================
Files 1953 1952 -1
Lines 89186 89170 -16
Branches 13454 13372 -82
=============================================
- Hits 54277 32964 -21313
- Misses 29353 51630 +22277
+ Partials 5556 4576 -980
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16270
Problem
When a generic Map does not carry a
"class"entry, the target type comes from the method signature. The existing Serializable check was only applied when a"class"key was present, allowing non-Serializable DTOs to slip through when the key was absent.Fix
Add a check in
PojoUtils.realize()that rejects non-Serializable types even when the Map has no"class"key. This makes the behavior consistent with the existing check that fires when the key is present.Changes
PojoUtils.java: Added Serializable interface check before the enum handling blockPojoUtilsTest.java: AddedNonSerializableDtotest class andtest_realize_rejectsNonSerializableMapWithoutClassKeytestAI-agent involvement: This contribution was assisted by an AI coding agent.