zhan7236 opened a new pull request, #3062:
URL: https://github.com/apache/fory/pull/3062

   ## Why?
   
   Java lacks native support for Union/Variant types that are common in other 
languages (C++ std::variant, Rust enum, Python typing.Union). This limits 
cross-language serialization interoperability when working with union types.
   
   ## What does this PR do?
   
   Implements Union type support in Java for cross-language serialization, 
addressing issue #3030.
   
   **Changes:**
   
   1. **Types.java**: Added `UNION` (38) and `NONE` (39) type constants 
following the xlang specification
   2. **Union.java**: A tagged union wrapper class that can hold one of several 
alternative types
   3. **UnionSerializer.java**: Handles serialization/deserialization with 
xlang protocol support
   4. **ClassResolver.java**: Registered UnionSerializer as default serializer
   5. **XtypeResolver.java**: Registered Union type with UNION type id for 
xlang serialization
   6. **xlang_type_mapping.md**: Updated type mapping documentation
   
   **Serialization format:**
   - Variant index (varuint32): identifies which alternative is active
   - Type info: type information for the active alternative
   - Value data: serialized value
   
   ## Related issues
   
   Closes #3030
   
   ## Does this PR introduce any user-facing change?
   
   Yes. Users can now use the `Union` class for cross-language union type 
serialization.
   
   - [x] Does this PR introduce any public API change?
   - [ ] Does this PR introduce any binary protocol compatibility change?
   
   ## Benchmark
   
   Not applicable - this adds new functionality without modifying existing 
serialization paths.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to