-
-
Notifications
You must be signed in to change notification settings - Fork 41
#226: Reference only accessible qualified methods #228
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
Conversation
filiphr
left a comment
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.
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
.../org/mapstruct/intellij/codeinsight/references/MapstructMappingQualifiedByNameReference.java
Outdated
Show resolved
Hide resolved
testData/completion/qualifiedbyname/MappingQualifiedByNameWithAllPossibleVisibilities.java
Show resolved
Hide resolved
|
Thank you for your review. Please take another look! |
filiphr
left a comment
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.
We need one more change @thunderhook in order to be compliant with what we are doing in the processor
| if ( method.hasModifierProperty( PsiModifier.PROTECTED ) ) { | ||
| return methodClass.equals( containingClass ); | ||
| } |
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.
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
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.
Yes, you're right. I got confused by the table where subclass and no modifier says N because our generated mappers are subclasses.
Fixes #226