-
-
Notifications
You must be signed in to change notification settings - Fork 1k
#1216 Pick candidate method with most specific return type #2993
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When there are multiple candidate methods returning different types. We should be able to use the method with the most specific return type (if such a method exists)
sjaakd
reviewed
Aug 28, 2022
processor/src/main/java/org/mapstruct/ap/internal/model/source/selector/MethodSelectors.java
Show resolved
Hide resolved
sjaakd
reviewed
Aug 30, 2022
processor/src/test/java/org/mapstruct/ap/test/bugs/_2840/Issue2840Test.java
Outdated
Show resolved
Hide resolved
sjaakd
reviewed
Sep 4, 2022
...ct/ap/test/selection/resulttype/ErroneousAmbiguousMostSpecificResultTypeSelectingMapper.java
Show resolved
Hide resolved
Contributor
|
Apparently i missed that one.. sorry. Hi ahead and merge
Op zo 4 sep. 2022 12:35 schreef Filip Hrisafov ***@***.***>:
… ***@***.**** commented on this pull request.
------------------------------
In
processor/src/test/java/org/mapstruct/ap/test/selection/resulttype/ErroneousAmbiguousMostSpecificResultTypeSelectingMapper.java
<#2993 (comment)>:
> +import org.mapstruct.Mapping;
+
+/**
+ * @author Filip Hrisafov
+ */
***@***.***
+public interface ErroneousAmbiguousMostSpecificResultTypeSelectingMapper {
+
+ @mapping( target = "apple", source = "fruit")
+ AppleFamily map(FruitFamily fruitFamily);
+
+ default GoldenDelicious toGolden(IsFruit fruit) {
+ return fruit != null ? new GoldenDelicious( fruit.getType() ) : null;
+ }
+
+ default Apple toApple1(IsFruit fruit) {
Did you check Issue2840Mapper as part of this PR?
—
Reply to this email directly, view it on GitHub
<#2993 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPDEY42KEDVNXWVGUASMDDV4R3OBANCNFSM573LRIBA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Member
Author
sjaakd
approved these changes
Oct 1, 2022
...ain/java/org/mapstruct/ap/internal/model/source/selector/MostSpecificResultTypeSelector.java
Show resolved
Hide resolved
Contributor
|
General mechanism LGTM. One question though.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When there are multiple candidate methods returning different types.
We should be able to use the method with the most specific return type (if such a method exists)
Fixes #1216