3131import org .eclipse .jdt .core .dom .ASTNode ;
3232import org .eclipse .jdt .core .dom .Annotation ;
3333import org .eclipse .jdt .core .dom .AnnotationTypeMemberDeclaration ;
34+ import org .eclipse .jdt .core .dom .ConstructorInvocation ;
3435import org .eclipse .jdt .core .dom .Expression ;
3536import org .eclipse .jdt .core .dom .ExpressionMethodReference ;
3637import org .eclipse .jdt .core .dom .IBinding ;
@@ -645,6 +646,13 @@ protected int resolveLevel(MethodInvocation messageSend) {
645646 return resolveLevelForNodeWithMethodBinding (messageSend , invocationBinding , initialReceiverType , false , false );
646647 }
647648
649+ private List <Expression > arguments (ASTNode node ) {
650+ return (List <Expression >)
651+ (node instanceof MethodInvocation method ? method .arguments () :
652+ node instanceof ConstructorInvocation constr ? constr .arguments () :
653+ List .of ());
654+ }
655+
648656 protected int resolveLevelForNodeWithMethodBinding (ASTNode messageSend ,
649657 IMethodBinding invocationBinding , ITypeBinding initialReceiverType ,
650658 boolean skipVerif , boolean nullParamsForSubTypeCheck ) {
@@ -669,6 +677,16 @@ protected int resolveLevelForNodeWithMethodBinding(ASTNode messageSend,
669677 invocationOrDeclarationBinding = declarationBinding ;
670678 }
671679
680+ if (invocationBinding .getParameterTypes ().length == arguments (messageSend ).size ()) {
681+ for (int i = 0 ; i < invocationBinding .getParameterTypes ().length ; i ++) {
682+ var source = arguments (messageSend ).get (i ).resolveTypeBinding ();
683+ var resolved = invocationBinding .getParameterTypes ()[i ];
684+ if (source != null && !source .isAssignmentCompatible (resolved )) {
685+ return INACCURATE_MATCH ;
686+ }
687+ }
688+ }
689+
672690 int invocOrDeclLevel = invocationLevel == IMPOSSIBLE_MATCH ? declarationLevel : invocationLevel ;
673691 // receiver type
674692 if (this .pattern .declaringSimpleName == null && this .pattern .declaringQualification == null ) {
0 commit comments