You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "itsCodeTide (via GitHub)" <gi...@apache.org> on 2026/10/14 06:37:25 UTC
[PR] fix(java): copy non-serializable JDK objects by reference [fory]
itsCodeTide opened a new pull request, #4179:
URL: https://github.com/apache/fory/pull/4179
## Why?
`Fory.copy` currently fails when an object graph contains a non-serializable JDK object such as `java.lang.Package`. Copy and serialization share serializer lookup, so the serializability guard rejects the type before the copy path can handle it.
## What does this PR do?
- Routes non-serializable JDK types through a serializer that preserves the object by reference during copy.
- Keeps binary serialization unsupported for those types; serializer reads and writes still fail.
- Adds tests for direct and nested `Package` copies and for serialization still failing.
## Related issues
Fixes #2941
Related: #3797 is an open PR for the same issue with a field-copy approach. This PR instead preserves the opaque JDK object by identity.
## AI Contribution Checklist
- [x] Substantial AI assistance was used: `yes`
- [x] Included an AI Usage Disclosure below.
- [ ] I can explain and defend the changes.
- [ ] I reviewed the changes line by line and completed my self-review.
- [x] Two fresh AI reviews ran on commit `029ca6a834e1ca71c3c335594611b28c16740088`; neither found actionable issues.
- [x] No actionable AI review comments needed fixes or another review round.
- [ ] I completed human verification and reviewed the results.
- [ ] I confirmed provenance and licensing.
AI Usage Disclosure
- substantial_ai_assistance: yes
- scope: design discussion, code, and regression tests
- affected_files_or_subsystems: Java `fory-core` resolver, serializer, GraalVM serializer metadata, and copy tests
- ai_review: Two fresh read-only reviews of commit `029ca6a834e1ca71c3c335594611b28c16740088` reported no actionable findings.
- ai_review_artifacts:
- Fory-guided reviewer `/root/fory_review`, reviewed `029ca6a834e1ca71c3c335594611b28c16740088`: “No actionable findings.”
- Independent reviewer `/root/independent_review`, reviewed `029ca6a834e1ca71c3c335594611b28c16740088`: “No actionable correctness, edge-case, maintainability, or test-quality findings.”
- human_verification: The agent ran the focused `ForyCopyTest` (12 passed), Spotless (passed), and Checkstyle (0 violations). The complete `fory-core` suite ran 2,348 tests and had 17 failures on JDK 24, in collection, ObjectStream, and URL-copy cases; these have not been checked against the base branch. Contributor review is still required.
- performance_verification: N/A; no benchmark was run.
- provenance_license_confirmation: Please confirm before checking this item; the new code uses the project’s standard Apache license header and introduces no third-party code.
## Does this PR introduce any user-facing change?
`Fory.copy` now succeeds for graphs containing non-serializable JDK objects by retaining those objects by reference.
- [ ] Public API change
- [ ] Binary protocol compatibility change
## Benchmark
N/A
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org