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 — #2788 unmapped source properties message improved for forged methods by Zegveld · Pull Request #3522 · mapstruct/mapstruct

Conversation

@Zegveld

@Zegveld Zegveld commented Feb 8, 2024

Copy link
Copy Markdown
Contributor

updated the message for unmapped source properties to have the same structure as the unmapped target properties messages.
fixes #2788

Sorry, something went wrong.

Uh oh!

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

All reactions
Ben Zegveld Ben Zegveld
mapstruct#2788 unmapped source properties for forgedMethods now conta…
a6106d1
…ins information about the forged method.
filiphr
filiphr requested changes Feb 11, 2024
View reviewed changes

@filiphr filiphr left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main changes look OK, I've added some suggestions to reduce the duplication a bit.

I've left some comments about the test changes. I am not a fan of changing existing tests, why are we doing that? Why don't we write dedicated tests for this?

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...t/java/org/mapstruct/ap/test/accessibility/referenced/AbstractSourceTargetMapperPrivate.java Resolved

Uh oh!

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

Comment thread ...java/org/mapstruct/ap/test/accessibility/referenced/AbstractSourceTargetMapperProtected.java Resolved

Uh oh!

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

Comment thread ...rc/test/java/org/mapstruct/ap/test/accessibility/referenced/ReferencedAccessibilityTest.java Resolved

Uh oh!

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

Comment thread ...test/java/org/mapstruct/ap/test/accessibility/referenced/SourceTargetMapperDefaultOther.java Resolved

Uh oh!

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

Comment thread .../test/java/org/mapstruct/ap/test/accessibility/referenced/SourceTargetMapperDefaultSame.java Resolved

Uh oh!

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

Comment thread .../src/test/java/org/mapstruct/ap/test/accessibility/referenced/SourceTargetMapperPrivate.java Resolved

Uh oh!

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

Comment thread ...rc/test/java/org/mapstruct/ap/test/accessibility/referenced/SourceTargetMapperProtected.java Resolved

Uh oh!

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

Comment thread processor/src/main/java/org/mapstruct/ap/internal/model/BeanMappingMethod.java Resolved

Uh oh!

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

Comment thread processor/src/main/java/org/mapstruct/ap/internal/model/BeanMappingMethod.java Resolved

Uh oh!

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

@Zegveld

Zegveld commented Feb 11, 2024

Copy link
Copy Markdown
Contributor Author

main changes look OK, I've added some suggestions to reduce the duplication a bit.

I've left some comments about the test changes. I am not a fan of changing existing tests, why are we doing that? Why don't we write dedicated tests for this?

Not changing the existing test will make it less visible what is being tested by the test.
The current test class ReferencedAccessibilityTest.java should test both target and source messages, otherwise the test class is incorrectly named in my opinion.

I can split it to be more precise, so that we get separate tests for source and target. This will be obvious in the classes then.
These three categories will be visible then:

  • No messages
  • Target messages
  • Source messages
All reactions

Sorry, something went wrong.

Uh oh!

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

@Zegveld

Zegveld commented Feb 11, 2024

Copy link
Copy Markdown
Contributor Author

main changes look OK, I've added some suggestions to reduce the duplication a bit.
I've left some comments about the test changes. I am not a fan of changing existing tests, why are we doing that? Why don't we write dedicated tests for this?

Not changing the existing test will make it less visible what is being tested by the test. The current test class ReferencedAccessibilityTest.java should test both target and source messages, otherwise the test class is incorrectly named in my opinion.

I can split it to be more precise, so that we get separate tests for source and target. This will be obvious in the classes then. These three categories will be visible then:

  • No messages
  • Target messages
  • Source messages

Took another look at the code. and I think I'll alter the tests still, but do it in another way entirely.
I'm going to introduce tests for the target/source messages, and remove the current messages out of the current tests, because that does not seem to be what the test is actually about, but a side-effect which is added to those tests.

All reactions

Sorry, something went wrong.

Uh oh!

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

@filiphr

filiphr commented Feb 11, 2024

Copy link
Copy Markdown
Member

Ideally we should not touch the existing tests and add new ones for this. Or update the ones that are really testing the error messages. The ReferencedAccessibilityTest doesn't sound like the right one.

The DottedErrorMessageTest might be more correct for this. Perhaps even the two UnmappedSourceTest

All reactions

Sorry, something went wrong.

Uh oh!

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

@Zegveld

Zegveld commented Feb 11, 2024

Copy link
Copy Markdown
Contributor Author

Ideally we should not touch the existing tests and add new ones for this. Or update the ones that are really testing the error messages. The ReferencedAccessibilityTest doesn't sound like the right one.

The DottedErrorMessageTest might be more correct for this. Perhaps even the two UnmappedSourceTest

Indeed the DottedErrorMessageTest does sound like the correct location. I didn't find that one earlier, because the text Mapping from property is not present in that test, instead it has it in a static variable Mapping from "+ PROPERTY.

I do feel like changing ReferencedAccessibilityTest so that the message is not part of it anymore is the right call, because it is using a side-effect to test behavior while that should be explicitly tested.
(I could do that in a separate PR though, easy enough to separate.)

All reactions

Sorry, something went wrong.

Uh oh!

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

Ben Zegveld Ben Zegveld
mapstruct#2788 Removed incorrect test location.
31045a0
@filiphr

filiphr commented Feb 11, 2024

Copy link
Copy Markdown
Member

I do feel like changing ReferencedAccessibilityTest so that the message is not part of it anymore is the right call, because it is using a side-effect to test behavior while that should be explicitly tested.

I am not sure that I am following. What is wrong with that test? The test is properly showing that private methods are not going to be picked up by MapStruct and thus lead to the default warning.

All reactions

Sorry, something went wrong.

Uh oh!

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

Ben Zegveld added 2 commits February 11, 2024 12:54
Ben Zegveld Ben Zegveld
mapstruct#2788 introduced tests at DottedErrorMessageTest. (1/2 due t…
b05359e
…o renames)
Ben Zegveld Ben Zegveld
mapstruct#2788 introduced tests at DottedErrorMessageTest. (2/2 due t…
41110bb
…o renames)
@Zegveld

Zegveld commented Feb 11, 2024

Copy link
Copy Markdown
Contributor Author

I do feel like changing ReferencedAccessibilityTest so that the message is not part of it anymore is the right call, because it is using a side-effect to test behavior while that should be explicitly tested.

I am not sure that I am following. What is wrong with that test? The test is properly showing that private methods are not going to be picked up by MapStruct and thus lead to the default warning.

default settings is in my opinion not something that the test should know of. If at some point in time the default setting changes, a lot of tests need to be fixed because they assumed that default settings would never change.

But it is something that can be discussed outside of this PR.

All reactions

Sorry, something went wrong.

Uh oh!

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

Ben Zegveld Ben Zegveld
mapstruct#2788 fixed line length and UnmappableTarget's still assume …
efa7d79
…source properties are by default ignored.
@filiphr

filiphr commented Feb 11, 2024

Copy link
Copy Markdown
Member

default settings is in my opinion not something that the test should know of. If at some point in time the default setting changes, a lot of tests need to be fixed because they assumed that default settings would never change.

We can agree to disagree about this. In my opinion it is totally OK for a lot of tests to fail if we change a default, this also means that users will be affected by this and it is a good signal that something is not OK.
In any case I do agree we can discuss this outside of this PR. Let me know when you are done with this so that I can give it another pass.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Zegveld Zegveld mentioned this pull request Feb 11, 2024
Alternative for the ReferencedAccessibilityTest #3525
Open
Zegveld and others added 3 commits February 11, 2024 13:11
@Zegveld @filiphr
Update processor/src/main/java/org/mapstruct/ap/internal/model/BeanMa…
275c840
…ppingMethod.java

Co-authored-by: Filip Hrisafov <[email protected]>
@Zegveld @filiphr
Update processor/src/main/java/org/mapstruct/ap/internal/model/BeanMa…
11a1e14
…ppingMethod.java

Co-authored-by: Filip Hrisafov <[email protected]>
Ben Zegveld Ben Zegveld
mapstruct#2788 added issuekey annotations
394cb01
@Zegveld

Zegveld commented Feb 11, 2024

Copy link
Copy Markdown
Contributor Author

I've accepted your suggestions for the production code, and rewritten the tests to be a part of DottedErrorMessageTest.
This did result in changing the target tests there, because otherwise they would be hard to distinguish from eachother.

Should be good for another pass.

All reactions

Sorry, something went wrong.

Uh oh!

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

filiphr
filiphr approved these changes Feb 11, 2024
View reviewed changes
@filiphr

filiphr commented Feb 11, 2024

Copy link
Copy Markdown
Member

This did result in changing the target tests there, because otherwise they

Yea those are fine since those are around testing the messages we are adapting now. Will merge once CI is green

All reactions

Sorry, something went wrong.

Uh oh!

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

@filiphr
filiphr merged commit bb1cd63 into mapstruct:main Feb 11, 2024
@Zegveld
Zegveld deleted the feature/2788 branch February 11, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@filiphr filiphr filiphr 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.

Improve error messages for auto generated mappings

Uh oh!

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

2 participants

@Zegveld @filiphr
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.