We have a used ReferenceMapper defined in an @MapperConfig annotation and also in the @Mapper annotation itself.
This leads to the following error:
Ambiguous mapping methods found for mapping property "foo.bar.Source source" to foo.bar.Target:
foo.bar.Target foo.bar.ReferenceMapper.toTarget(foo.bar.Source source),
foo.bar.Target foo.bar.ReferenceMapper.toTarget(foo.bar.Source source).
Interesting one :) I think we could do that in a 1.0.1 as there is a work-around (remove one of the references).
+1
I really want this , at least provide some config that i can specified mapping method
or pick it base on method modifier
thx
Yes, we should eliminate the duplicates in this case. Maybe you'd be
willing to help out? Should be an easy fix.
You should be able to work around this issue easily by just removing the
referenced mapper from @Mapper#uses().
Found this old issue and looks like it was solved in the meantime or my test-case is not correct.
I just pushed the test case. If you still know what exactly the issue was/is you may could check the test case I created.
@chris922 Looking at the test case it seems that it is correct and it seems it has been fixed somehow 馃槃. In any case you can provide a PR with the test, having more tests is always good 馃槈.
Just some small info. Classes in Mapper#uses can be non @Mapper classes. It can also be a normal class that (in which case MapStruct will instantiate by invoking its default constructor) or if it has static methods just invoke that.
And for the @{jacocoArgLine} if the reason is IntelliJ, I think that you can explicitly tell IntelliJ to not pick the surefire argLine
Ok great, later on I will create a PR with this test-case.
It was not planned to commit the removal of the @{jacocoArgLine}. But good to know that there is somewhere in IntelliJ the setting to disable this. It was a bit annoying to remove it always and take care it will not be committed..
But I will clean this up before creating the PR.
Closing as we now have a test case for this and it seems it can been fixed somehow as well. I suspected that it was by https://github.com/mapstruct/mapstruct/issues/634.
Thanks @chris922 for providing the PR.
But I will clean this up before creating the PR.
I didn't say it because of that. I was just sharing info.
Here is an example how you can disable the argLine in IntelliJ

And for the @{jacocoArgLine} if the reason is IntelliJ, I think that you can explicitly tell IntelliJ to not pick the surefire argLine
running into the same problem (trying IntelliJ).. Should we document this in the IDE / development part of MapStruct?
Most helpful comment
Yes, we should eliminate the duplicates in this case. Maybe you'd be
willing to help out? Should be an easy fix.
You should be able to work around this issue easily by just removing the
referenced mapper from @Mapper#uses().