4141
4242import static com .intellij .codeInsight .AnnotationUtil .findAnnotation ;
4343import static com .intellij .codeInsight .AnnotationUtil .getBooleanAttributeValue ;
44+ import static org .mapstruct .intellij .inspection .inheritance .InheritConfigurationUtils .findInheritedTargetProperties ;
4445import static org .mapstruct .intellij .util .MapstructAnnotationUtils .addMappingAnnotation ;
4546import static org .mapstruct .intellij .util .MapstructAnnotationUtils .getUnmappedTargetPolicy ;
4647import static org .mapstruct .intellij .util .MapstructUtil .isInheritInverseConfiguration ;
5051import static org .mapstruct .intellij .util .TargetUtils .findAllDefinedMappingTargets ;
5152import static org .mapstruct .intellij .util .TargetUtils .findAllSourcePropertiesForCurrentTarget ;
5253import static org .mapstruct .intellij .util .TargetUtils .findAllTargetProperties ;
53- import static org .mapstruct .intellij .util .TargetUtils .findInheritedTargetProperties ;
5454import static org .mapstruct .intellij .util .TargetUtils .getRelevantType ;
5555
5656/**
@@ -78,6 +78,10 @@ private MyJavaElementVisitor(ProblemsHolder holder, MapStructVersion mapStructVe
7878 public void visitMethod (PsiMethod method ) {
7979 super .visitMethod ( method );
8080
81+ if ( !MapstructUtil .isMapper ( method .getContainingClass () ) ) {
82+ return ;
83+ }
84+
8185 PsiType targetType = getTargetType ( method );
8286 if ( targetType == null ) {
8387 return ;
@@ -86,12 +90,12 @@ public void visitMethod(PsiMethod method) {
8690 if ( isBeanMappingIgnoreByDefault ( method ) ) {
8791 return ;
8892 }
93+
8994 ReportingPolicy reportingPolicy = getUnmappedTargetPolicy ( method );
9095 if (reportingPolicy == ReportingPolicy .IGNORE ) {
9196 return ;
9297 }
9398
94-
9599 Set <String > allTargetProperties = findAllTargetProperties ( targetType , mapStructVersion , method );
96100
97101 // find and remove all defined mapping targets
@@ -204,6 +208,7 @@ private static PsiType getTargetType(PsiMethod method) {
204208 }
205209 return getRelevantType ( method );
206210 }
211+
207212 }
208213
209214 private static class UnmappedTargetPropertyFix extends LocalQuickFixOnPsiElement {
0 commit comments