Skip to content

Conversation

@thunderhook
Copy link
Contributor

Fixes #226

Copy link
Member

@filiphr filiphr left a comment

Choose a reason for hiding this comment

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

Thanks @thunderhook. I've left some comments. It needs a bit more work.

Additionally, while reviewing it, I think that I realized that qualifiers on super types are not taken into consideration.

e.g. if we have

@Mapper
interface CarMapper extends BaseMapper {
    //...
}

I think that we need to do getAllMethods instead of doing getMethods

@thunderhook
Copy link
Contributor Author

Thank you for your review. Please take another look!

Copy link
Member

@filiphr filiphr left a comment

Choose a reason for hiding this comment

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

We need one more change @thunderhook in order to be compliant with what we are doing in the processor

Comment on lines 139 to 141
if ( method.hasModifierProperty( PsiModifier.PROTECTED ) ) {
return methodClass.equals( containingClass );
}
Copy link
Member

Choose a reason for hiding this comment

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

This is not correct. If a method is protected then it is also available if the 2 classes are in the same package. See https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

e.g. samePackageModifierProtected should also be picked up in the tests. I think we should remove this check here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're right. I got confused by the table where subclass and no modifier says N because our generated mappers are subclasses.

@filiphr filiphr merged commit e99789c into main Jun 14, 2025
13 checks passed
@filiphr filiphr deleted the 226 branch June 14, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

References of qualifiedByName work for protected methods that are not accessible by mapstruct

3 participants