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

Incorrect unmapped target warning for fluent setters #121

Closed
andye2004 opened this issue Feb 21, 2023 · 1 comment · Fixed by #126
Closed

Incorrect unmapped target warning for fluent setters #121

andye2004 opened this issue Feb 21, 2023 · 1 comment · Fixed by #126
Milestone

Comments

@andye2004
Copy link

andye2004 commented Feb 21, 2023

I know there have been a few of these reported, but this appears to be slightly different to the others I've read over.

At the organisation I work for we use avro schema files to generate classes and any time we use these generated files as the mapping target of a mapper we get an Add unmapped target property: 'get' warning from the IntelliJ IDEA plugin.

The issue is not specifically related to the code generated by avro, but instead is related to over-ridden methods of an abstract base class that should return a java.lang.Object. This happens as MapstructUtil.isFluentSetter() determines that the method is part of a builders fluent setter pattern, even when builders are explicitly disabled.

I have put together an example of the issue here, although the example project doesn't use avro it does highlight the issue as outlined.

andye2004 added a commit to andye2004/mapstruct-idea that referenced this issue Feb 21, 2023
@filiphr
Copy link
Member

filiphr commented Apr 2, 2023

I do agree that this is a a bug, but the reason is not because the builders are enabled. If you see how the MapStruct processor works you'll see that irregardless whether builders are enabled or disabled there will be no warning for unmapped property.

This needs to be fixed by making sure that the fluent setter return type is assignable to the type being mapped

@filiphr filiphr added this to the 1.4.1 milestone Apr 2, 2023
@filiphr filiphr changed the title Plugin incorrectly gives umapped target warning Incorrectly gives unmapped target warning for fluent setters May 7, 2023
@filiphr filiphr changed the title Incorrectly gives unmapped target warning for fluent setters Incorrect unmapped target warning for fluent setters May 7, 2023
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

Successfully merging a pull request may close this issue.

2 participants