GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — #1216 Pick candidate method with most specific return type by filiphr · Pull Request #2993 · mapstruct/mapstruct

Conversation

@filiphr

@filiphr filiphr commented Aug 28, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
filiphr added 3 commits August 28, 2022 18:57
@filiphr
mapstruct#1216 Pick candidate method with most specific return type
5146fd7
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)
@filiphr
Fix checkstyle
1446ef2
@filiphr
Use correct error line
8f13f7f
sjaakd
sjaakd reviewed Aug 28, 2022
View reviewed changes
Comment thread processor/src/main/java/org/mapstruct/ap/internal/model/source/selector/MethodSelectors.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

sjaakd
sjaakd reviewed Aug 30, 2022
View reviewed changes
Comment thread processor/src/test/java/org/mapstruct/ap/test/bugs/_2840/Issue2840Test.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

sjaakd
sjaakd reviewed Sep 4, 2022
View reviewed changes
Comment thread ...ct/ap/test/selection/resulttype/ErroneousAmbiguousMostSpecificResultTypeSelectingMapper.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sjaakd

sjaakd commented Sep 4, 2022 via email

Copy link
Copy Markdown
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: ***@***.***>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@filiphr
Remove test for issue being fixed in another PR
befa82b
@filiphr

filiphr commented Sep 26, 2022

Copy link
Copy Markdown
Member Author

I've removed the test cases we had for #2840 from this PR since the actual fix for that is in #3032. This PR is only adding a new feature

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sjaakd
sjaakd approved these changes Oct 1, 2022
View reviewed changes
Comment thread ...ain/java/org/mapstruct/ap/internal/model/source/selector/MostSpecificResultTypeSelector.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sjaakd

sjaakd commented Oct 1, 2022

Copy link
Copy Markdown
Contributor

General mechanism LGTM. One question though..

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@filiphr
Add update test
6dcb650
@filiphr
filiphr merged commit 266c5fa into mapstruct:main Oct 2, 2022
@filiphr
filiphr deleted the 1216 branch October 2, 2022 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sjaakd sjaakd sjaakd approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Ambiguous mapping method but there is a more specific mapping

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@filiphr @sjaakd
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.