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

Ambiguous factory method for @ObjectFactory with and without parameters #1242

Closed
filiphr opened this Issue Jul 9, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@filiphr
Member

filiphr commented Jul 9, 2017

In the javadoc of the new @ObjectFactory we state:

If there are two factory methods, both serving the same type, one with no parameters and one taking sources as input, then the one with the source parameters is favored. If there are multiple such factories, an ambiguity error is shown.

However, when that situation actually occurs. Currently we have compile error ambiguous factory methods. Should we update the implementation or the Javadoc?

@agudian

This comment has been minimized.

Show comment
Hide comment
@agudian

agudian Jul 10, 2017

Member

I double checked. That was part of the original PR and a result of the discussions about that feature. I missed that the case was not covered in the tests and during the refactoring done in 79f87e8, I broke that feature. Let me add it back again... 😁

Member

agudian commented Jul 10, 2017

I double checked. That was part of the original PR and a result of the discussions about that feature. I missed that the case was not covered in the tests and during the refactoring done in 79f87e8, I broke that feature. Let me add it back again... 😁

@filiphr

This comment has been minimized.

Show comment
Hide comment
@filiphr

filiphr Jul 10, 2017

Member

It looks like we also missed in the review as well 😄. Sure let's add it back and add a test for it 😄

Member

filiphr commented Jul 10, 2017

It looks like we also missed in the review as well 😄. Sure let's add it back and add a test for it 😄

agudian added a commit to agudian/mapstruct that referenced this issue Jul 10, 2017

#1242 Fix favoring of a single factory method with source params befo…
…re others without source params.

From the Javadoc of @ObjectFactory: If there are two factory methods, both serving the same type, one with no parameters and one taking sources as input, then the one with the source parameters is favored. If there are multiple such factories, an ambiguity error is shown.

agudian added a commit to agudian/mapstruct that referenced this issue Jul 11, 2017

#1242 Fix favoring of a single factory method with source params befo…
…re others without source params.

From the Javadoc of @ObjectFactory: If there are two factory methods, both serving the same type, one with no parameters and one taking sources as input, then the one with the source parameters is favored. If there are multiple such factories, an ambiguity error is shown.

@filiphr filiphr closed this in #1246 Jul 11, 2017

filiphr added a commit that referenced this issue Jul 11, 2017

#1242 Fix favoring of a single factory method with source params befo…
…re others without source params.

From the Javadoc of @ObjectFactory: If there are two factory methods, both serving the same type, one with no parameters and one taking sources as input, then the one with the source parameters is favored. If there are multiple such factories, an ambiguity error is shown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment