Skip to content
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

Unmapped field when the field name starts with 'set' and Lombok @Builder is used #36

Open
baltendo opened this issue Aug 5, 2019 · 0 comments

Comments

@baltendo
Copy link

baltendo commented Aug 5, 2019

MapStruct Support: v1.1.1
MapStruct 1.3.0.Final
Lombok: 1.8.8
Java: openjdk version "11.0.2" 2019-01-15
Gradle: 5.4.1

We use MapStruct to map Java objects and Avro objects.
In one object there is one field that is not mapped from Avro to Java (the other way works).
This seems to be an issue only in Intellij because the test works when I run it with Gradle.

When I compare the generated ...MapperImpl.java from Intellij and Gradle I see that Intellij is using the .builder() from Lombok and Gradle uses the default constructor and then calls the setters (mapstruct/mapstruct#1742).

I think the issue is that the field starts with 'set' like 'settlement' which is already a known issue in MapStruct (mapstruct/mapstruct#1799). The Lombok builder just uses the field name as method name and MapStruct removes the 'set' so this ends up in 'tlement' which has no corresponding field in Avro. Because of that the generated ...MapperImpl.java never calls .settlement() on the builder.

Avro also generates a builder but it is prefixing the methods with 'set' (setSettlement) and thus it is not an issue mapping from Java to Avro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant