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
Arrays cannot be mapped to collection / iterable using an adder method #3165
Comments
Thanks for reporting this @eroznik and thanks for the PR. I've added some comments to the PR (we need some tests before merging it). I also changed the title, since the problem is not linked to protobuf, but it is generally linked that arrays cannot be mapped to collection / iterable using an adder method. |
Thanks for the review. I'll be adding tests for sure, now that it's confirmed the changes make sense. |
Expected behavior
I would expect that given
I'd be able to get a mapper to map the Java POJO to
Which would map the
permission
array to the protopermissionsList
through the adder pattern.Actual behavior
The auto-code generation fails because the generated code tries to directly add the whole array instead of iterating over it, map each value on its own and add it to the list.
Steps to reproduce the problem
I modified the public Protobuff example so it fails
eroznik/mapstruct-examples@f4c3a4e
The pushed code is using the latest snapshot, mostly because I was using the latest snapshot version while testing it out locally. Keep in mind that the linked commit won't build.
MapStruct Version
All versions that I tested.
The text was updated successfully, but these errors were encountered: