-
Notifications
You must be signed in to change notification settings - Fork 359
feat(xlang/java): refactor java native serialization type system and streaming type info for xlang #3153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chaokunyang
merged 44 commits into
apache:main
from
chaokunyang:implement_stream_class_meta
Jan 19, 2026
Merged
feat(xlang/java): refactor java native serialization type system and streaming type info for xlang #3153
chaokunyang
merged 44 commits into
apache:main
from
chaokunyang:implement_stream_class_meta
Jan 19, 2026
Conversation
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
365c79f to
72817de
Compare
pandalee99
approved these changes
Jan 16, 2026
08798d4 to
4c1b726
Compare
4c1b726 to
6a1d48f
Compare
- Override buildDecodeExpression() to include readLayerClassMeta() call to maintain consistency with interpreter-mode MetaSharedLayerSerializer - Fix fallback serializer class from ObjectSerializer to MetaSharedLayerSerializer since ObjectSerializer is not compatible with MetaSharedLayerSerializerBase - Add static helper method readLayerClassMeta() for generated code to call
…ializer The read() method now properly handles schema evolution when: - Sender has class layers that receiver doesn't have (skip sender's data) - Receiver has class layers that sender doesn't have (call readObjectNoData) Previously, the code would cause ArrayIndexOutOfBoundsException or data corruption when sender had parent classes that don't exist in receiver. Changes: - Rewrite read loop to properly match sender and receiver layers - Add skipUnknownLayerData() to skip data for sender-only layers - Handle remaining receiver-only layers at the end
Add full support for schema evolution when sender has class layers that receiver doesn't have. This includes: 1. LayerReadContext class to track ClassDefs during deserialization: - Maintains list of ClassDefs in stream order - Caches skip serializers for reuse - Supports both new ClassDefs and references to previously seen ones 2. readAndTrackLayerMeta() to read and track layer meta: - Handles new ClassDefs (reads inline and tracks) - Handles references (looks up from tracked list) - Returns the ClassDef for the layer 3. trackLayerMetaFromSerializer() to track ClassDefs from matched layers: - Peeks at buffer to track ClassDefs without consuming - Allows matched layers to contribute to tracking - Enables later unknown layers to reference earlier ClassDefs 4. skipUnknownLayerData() enhanced with context: - Uses tracked ClassDefs for references - Creates skip serializer from ClassDef - Properly advances buffer position 5. MetaSharedLayerSerializer.skipFields() method: - Skips all field types: buildIn, container, other - Uses FieldSkipper for basic types - Uses binding.readField() for complex types
…alizer The key insight is that different senders may have different ClassDefs for the same class layer (schema evolution). The serializer must be created based on the actual ClassDef from the stream, not the receiver's expected schema. Changes: 1. ObjectStreamSerializer now reads layer ClassDef before calling serializer 2. Creates/caches serializers based on the actual ClassDef from stream 3. Calls readFieldsOnly() instead of readAndSetFields() to avoid double-read 4. MetaSharedLayerSerializer.readFieldsOnly() reads fields without meta 5. Removed trackLayerMetaFromSerializer() - no longer needed 6. Simplified LayerReadContext to use single getOrCreateSerializer()
f07323a to
aee8b30
Compare
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?
Fory needs streaming-friendly shared type meta so readers can deserialize without seeking. The current work also unifies native/xlang type IDs and removes legacy paths that were causing inconsistent type resolution and CI failures across languages.
What does this PR do?
registerSerializerAndTypeAPI for explicit type+serializer registration flow.Related issues
Closes #3157
Closes #3119
#2609 #2818
Does this PR introduce any user-facing change?
Benchmark
Not run.