Skip to content

fix(java): fix objectstream serializer async jit and graalvm support#3534

Merged
chaokunyang merged 24 commits intoapache:mainfrom
chaokunyang:fix_objectstream_serializer_async_jit
Apr 3, 2026
Merged

fix(java): fix objectstream serializer async jit and graalvm support#3534
chaokunyang merged 24 commits intoapache:mainfrom
chaokunyang:fix_objectstream_serializer_async_jit

Conversation

@chaokunyang
Copy link
Copy Markdown
Collaborator

@chaokunyang chaokunyang commented Apr 2, 2026

Why?

This PR addresses the same bug as #3514 and is intended to replace it from a writable fork branch.

ObjectStreamSerializer can hit the async/generated meta-shared layer path for customized JDK serialization cases such as TreeSet/TreeMap subclasses. The original failure is tracked in #3515. The JVM-side async fix is necessary, but the final implementation also has to keep the generated layer serializer working for GraalVM native-image runtime.

What does this PR do?

  • fixes generated meta-shared layer serializer bootstrap for ObjectStreamSerializer
  • preloads generated layer serializer constructors during GraalVM build time so native-image runtime does not fall back to broken constructor discovery
  • persists layer TypeDef metadata through the GraalVM registry so newly created runtime Fory instances can rebuild generated layer serializers correctly
  • adds GraalVM coverage for a compatible ObjectStreamSerializer case using defaultWriteObject/defaultReadObject with TreeSet/TreeMap subclasses

This PR supersedes #3514.
Closes #3515.

Related issues

AI Contribution Checklist

  • Substantial AI assistance was used in this PR: yes
  • If yes, I included a completed AI Contribution Checklist in this PR description and the required AI Usage Disclosure.
  • If yes, I can explain and defend all important changes without AI help.
  • If yes, I reviewed AI-assisted code changes line by line before submission.
  • If yes, I ran adequate human verification and recorded evidence (checks run locally or in CI, pass/fail summary, and confirmation I reviewed results).
  • If yes, I added/updated tests and specs where required.
  • If yes, I validated protocol/performance impacts with evidence when applicable.
  • If yes, I verified licensing and provenance compliance.

AI Usage Disclosure

  • substantial_ai_assistance: yes
  • scope: implementation, refactor, GraalVM validation, test coverage updates
  • affected_files_or_subsystems: java/fory-core generated meta-shared layer bootstrap, GraalVM runtime registry/bootstrap path, integration_tests/graalvm_tests
  • human_verification: reviewed changes line by line; ran targeted JVM tests, checkstyle, and GraalVM native-image build/runtime validation locally; reviewed all passing results
  • performance_verification: no formal performance claim is made; the change preserves generated layer serializers on the hot path instead of falling back to interpreter behavior
  • provenance_license_confirmation: Apache-2.0-compatible provenance confirmed; no incompatible third-party code introduced

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?

@chaokunyang chaokunyang requested review from pandalee99 and urlyy April 2, 2026 10:17
@chaokunyang chaokunyang changed the title fix(java): fix objectstream serializer async jit fix(java): fix objectstream serializer async jit and graalvm support Apr 3, 2026
@chaokunyang chaokunyang merged commit e459a30 into apache:main Apr 3, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] ObjectStreamSerializer async meta-shared layer JIT fails for TreeSet/TreeMap subclasses

3 participants