feat(java): add xlang tests for Union types#3076
Open
zhan7236 wants to merge 3 commits intoapache:mainfrom
Open
feat(java): add xlang tests for Union types#3076zhan7236 wants to merge 3 commits intoapache:mainfrom
zhan7236 wants to merge 3 commits intoapache:mainfrom
Conversation
- Add StructWithUnionFields class with Union through Union6 fields - Add testStructWithUnionFields() to test Union types as struct fields - Add testTopLevelUnion() to test serializing top-level Union objects - Skip Union tests in GoXlangTest and RustXlangTest (not yet supported)
chaokunyang
reviewed
Dec 23, 2025
| /** Struct containing Union fields of different arities (Union through Union6). */ | ||
| @Data | ||
| public static class StructWithUnionFields { | ||
| public org.apache.fory.type.union.Union union; |
Collaborator
There was a problem hiding this comment.
Please add imports for those types instead of using qualified class
chaokunyang
reviewed
Dec 23, 2025
| @Test | ||
| @Override | ||
| public void testStructWithUnionFields() throws java.io.IOException { | ||
| throw new SkipException("Union types not yet supported in C++"); |
Collaborator
There was a problem hiding this comment.
Could you add cpp tests in cpp/fory/serialization/xlang_test_main.cc?
Only added cpp tests, and make it pass, we can ensure union xlang serialization is OK
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.
What does this PR do?
This PR adds cross-language (xlang) tests for Union types in XlangTestBase.java as requested in #3062.
Changes:
Test Details:
Related issues
Follow-up to #3062 (Java Union type support)
Relates to #3030 (Union type support tracking issue)
Does this PR introduce any user-facing change?
No, this PR only adds tests.
Benchmark
N/A - test-only changes