The GitHub Actions job "Fory CI" on fory.git/main has succeeded.
Run started by GitHub user chaokunyang (triggered by chaokunyang).

Head commit for run:
d6f646139521c8e822534a75bc40c803c9aca5cd / Damon Zhao <[email protected]>
fix(rust): enable Union type cross-language serialization between Rust and Java 
(#3094)

## Why?

### Struct fingerprint mismatch for enum fields

When computing struct version hash for cross-language compatibility,
Java and C++ treat enum fields as nullable=true by default. However,
Rust's proc-macro cannot determine at compile time whether a field type
is an enum, causing fingerprint mismatch.

### Cross-language Union serialization fails

Java's AbstractObjectSerializer expects to read type_id for non-final
fields, but Rust/C++ skip type_id for Union fields per xlang spec. This
caused Type id 104 not registered errors when Java tried to deserialize
Rust-serialized Union data.

## What does this PR do?

### Rust changes:
- Union-compatible enum handling for xlang mode
- Fix `field_need_write_type_info()` to handle UNION TypeId

### Java changes:
- `AbstractObjectSerializer`: Skip `type_id` read for Union types
- `UnionSerializer`: Add `read()`/`write()` delegating to
`xread()`/`xwrite()`


### Tests:
- Add testUnionXlang for Rust enum <-> Java Union2 interoperability

## Related issues

## Does this PR introduce any user-facing change?

[ ] Does this PR introduce any public API change?
[x] Does this PR introduce any binary protocol compatibility change?
Note: Struct version hash for structs containing enum fields will now
match Java/C++.

## Benchmark


## Others
It's really hard to determine this bug :sob:...

Report URL: https://github.com/apache/fory/actions/runs/20613095070

With regards,
GitHub Actions via GitBox


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

Reply via email to