urlyy opened a new pull request, #3057: URL: https://github.com/apache/fory/pull/3057
<!-- **Thanks for contributing to Apache Fory™.** **If this is your first time opening a PR on fory, you can refer to [CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md).** Contribution Checklist - The **Apache Fory™** community has requirements on the naming of pr titles. You can also find instructions in [CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md). - Apache Fory™ has a strong focus on performance. If the PR you submit will have an impact on performance, please benchmark it first and provide the benchmark result here. --> ## Why? Issue #3049 reveals a problem. For example, when serializing the field `my_vec: Vec<Wrapper<Inner>>`, the current Fory-Rust writes ``` (id: Vec::type_id, generics: [ ( id: Wrapper<Inner>::type_id, generics: [] ) ]) ``` That is, the concrete generic type parameters on structs/enums are not written into the `FieldType` metadata. This results in inconsistent metadata between the sender and the receiver, and causes `assign_field_ids()` to assign `remote_field.field_id = -1`, leading to the issue. ## What does this PR do? When obtaining the field type on the sender side, for field_type `Vec<Wrapper<Inner>>`, the `FieldType` objects for `Vec` and `Wrapper<Inner>` have already been created, so there is no need to further create a `FieldType` object for `Inner`. Therefore, further recursion over generic types on structs/enums is truncated in the runtime. Meanwhile, because different languages provide different levels of support for generic types on classes, serializing structs/enums with generics is `not supported in xlang mode`. A `runtime check` has been added for this. ## Related issues Fixes #3049 <!-- When the PR has an impact on performance (if you don't know whether the PR will have an impact on performance, you can submit the PR first, and if it will have impact on performance, the code reviewer will explain it), be sure to attach a benchmark data here. Delete section if not applicable. --> -- 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]
