Skip to content

refactor(java): replace static serializer spi lookup#3680

Merged
chaokunyang merged 13 commits into
apache:mainfrom
chaokunyang:refactor_static_serializer_load
May 14, 2026
Merged

refactor(java): replace static serializer spi lookup#3680
chaokunyang merged 13 commits into
apache:mainfrom
chaokunyang:refactor_static_serializer_load

Conversation

@chaokunyang
Copy link
Copy Markdown
Collaborator

@chaokunyang chaokunyang commented May 14, 2026

Why?

Follow up to #3679: static generated serializer lookup no longer needs aggregate SPI provider classes or service resources. The runtime can resolve generated serializers from the registered target class name, which simplifies Java/Kotlin generation and makes Android/R8 packaging rely on generated keep rules instead of broad user-written service-loader rules.

What does this PR do?

  • Replaces StaticGeneratedSerializerProvider service-loader discovery with registry lookup based on escaped generated serializer class names and required constructors.
  • Updates the Java annotation processor and Kotlin KSP output to use <target>_ForySerializer / <target>_ForyNativeSerializer names, emit per-target META-INF/proguard/ rules, and stop generating aggregate provider classes or service descriptors.
  • Allows supported internal Kotlin @ForyStruct classes to generate internal serializers while keeping the constructor paths the Java runtime needs.
  • Updates TypeResolver, static generated serializer registry tests, Kotlin KSP validation tests, and Kotlin xlang coverage for the new discovery path.
  • Adds Android instrumentation coverage for static generated serializers and updates the Android CI setup to install the annotation processor artifact.
  • Refreshes Java/Kotlin static generated serializer docs and removes the obsolete SPI discovery section from the xlang implementation guide.

Related issues

#3679

AI Contribution Checklist

  • Substantial AI assistance was used in this PR: yes / no
  • If yes, I included a completed AI Contribution Checklist 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?

Benchmark

Not run; this PR changes static generated serializer lookup, generated metadata, docs, and tests rather than benchmarked serialization hot paths.

@chaokunyang chaokunyang force-pushed the refactor_static_serializer_load branch from c8fafcf to 4ad7f95 Compare May 14, 2026 12:34
@chaokunyang chaokunyang force-pushed the refactor_static_serializer_load branch from 5dda4f1 to edeac19 Compare May 14, 2026 14:16
@chaokunyang chaokunyang merged commit fee9190 into apache:main May 14, 2026
59 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.

2 participants