fix(java): Correct resolution of dependent/nested serializers in GraalVM#3532
Merged
chaokunyang merged 8 commits intoapache:mainfrom Apr 1, 2026
Merged
fix(java): Correct resolution of dependent/nested serializers in GraalVM#3532chaokunyang merged 8 commits intoapache:mainfrom
chaokunyang merged 8 commits intoapache:mainfrom
Conversation
…nd remove the threaded setup (should be separate issue and fix)
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.
Why?
GraalVM native-image serializer codegen can leak
GraalvmSerializerHolderinto generated serializer constructor paths. When serializer resolution returnsserializer.getClass()instead of the underlying generated serializer class, dependent generated codecs can later fail withjava.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 registeredThis PR fixes that resolver behavior and adds regression tests.
What does this PR do?
ClassResolverto unwrap holder-backed serializers viagetGraalvmSerializerClass(...)when resolving serializer classes.TypeResolverto query the iterated resolver, notthis, when checking the GraalVM registry, and to unwrap holder-backed serializers there as well.CompatibleDependentSerializerThreadSafeExample, that features generated serializer to depend on anotherRelated issues
None.
AI Contribution Checklist
yes/noyes, I included a completed AI Contribution Checklist in this PR description and the requiredAI Usage Disclosure.yes, I included the standardizedAI Usage Disclosureblock below.yes, I can explain and defend all important changes without AI help.yes, I reviewed AI-assisted code changes line by line before submission.yes, I ran adequate human verification and recorded evidence.yes, I added/updated tests and specs where required.yes, I validated protocol/performance impacts with evidence when applicable.yes, I verified licensing and provenance compliance.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.