Commit 4777250
authored
fix(java): auto-select child serializers for sorted containers (#3552)
## Why?
Auto serializer selection was falling back to JDK-compatible serializers
for eligible sorted/container subclasses such as `TreeSet`, `TreeMap`,
`ConcurrentSkipListSet`, `ConcurrentSkipListMap`, and `PriorityQueue`.
That routed child containers through the inefficient
`ObjectStreamSerializer` path even when the optimized child-container
strategy could preserve both container state and subclass fields.
## What does this PR do?
- extend `ChildContainerSerializers` with constructor-aware child
serializers for sorted sets, sorted maps, and priority queues
- teach auto-selection to use those serializers for eligible subclasses
instead of the JDK-compatible fallback
- register the new serializers in the builtin serializer factory and
GraalVM defaults
- add regression coverage for auto-selected sorted/container subclasses
with preserved child state and comparator behavior
## Related issues
Closes #3521.
## AI Contribution Checklist
- [ ] Substantial AI assistance was used in this PR: `yes` / `no`
- [ ] If `yes`, I included a completed [AI Contribution
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
in this PR description and the required `AI Usage Disclosure`.
- [ ] If `yes`, my PR description includes the required `ai_review`
summary and screenshot evidence of the final clean AI review results
from both fresh reviewers on the current PR diff or current HEAD after
the latest code changes.
## Does this PR introduce any user-facing change?
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?1 parent d254818 commit 4777250
4 files changed
Lines changed: 565 additions & 20 deletions
File tree
- java/fory-core/src
- main/java/org/apache/fory
- serializer
- collection
- util
- test/java/org/apache/fory/serializer/collection
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
249 | 258 | | |
250 | 259 | | |
251 | 260 | | |
| |||
0 commit comments