rakow opened a new pull request, #3532:
URL: https://github.com/apache/fory/pull/3532
## Why?
GraalVM native-image serializer codegen can leak `GraalvmSerializerHolder`
into generated serializer constructor paths. When serializer resolution returns
`serializer.getClass()` instead of the underlying generated serializer class,
dependent generated codecs can later fail with
`
java.lang.ClassCastException: […]Codec_0 cannot be cast to
org.apache.fory.util.GraalvmSupport$GraalvmSerializerHolder
at org.apache.fory.Fory.processSerializationError(Fory.java:377)
`
or
`java.lang.RuntimeException: Class […] is not registered`
This PR fixes that resolver behavior and adds regression tests.
## What does this PR do?
- Fixes `ClassResolver` to unwrap holder-backed serializers via
`getGraalvmSerializerClass(...)` when resolving serializer classes.
- Fixes `TypeResolver` to query the iterated resolver, not `this`, when
checking the GraalVM registry, and to unwrap holder-backed serializers there as
well.
- Adds a new GraalVM integration example,
`CompatibleDependentSerializerThreadSafeExample`, that features generated
serializer to depend on another
## Related issues
None.
## AI Contribution Checklist
- [x] Substantial AI assistance was used in this PR: `yes` / `no`
- [x] 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`.
- [x] If `yes`, I included the standardized `AI Usage Disclosure` block
below.
- [x] If `yes`, I can explain and defend all important changes without AI
help.
- [x] If `yes`, I reviewed AI-assisted code changes line by line before
submission.
- [x] If `yes`, I ran adequate human verification and recorded evidence.
- [x] If `yes`, I added/updated tests and specs where required.
- [x] If `yes`, I validated protocol/performance impacts with evidence when
applicable.
- [x] If `yes`, I verified licensing and provenance compliance.
```text
AI Usage Disclosure
- substantial_ai_assistance: yes
- scope: code drafting, regression tests
- affected_files_or_subsystems: java/fory-core resolver logic;
integration_tests/graalvm_tests GraalVM regression example
- human_verification: contributor reproduced the error using tests and than
verified the fix works as expected, contributor reviewed changes line by line
- performance_verification: no intended user-facing performance change and
no dedicated benchmark was run
- provenance_license_confirmation: Apache-2.0-compatible provenance
confirmed; no incompatible third-party code introduced
```
## Benchmark
N/A. No dedicated benchmark was run for this change. The validation for this
PR is targeted regression coverage for GraalVM build-time serializer resolution
and GraalVM integration behavior.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]