boolean (@NotNull PsiCallExpression call1, @NotNull PsiCallExpression call2) { final PsiReferenceParameterList patternParameterList = call1.getTypeArgumentList(); final PsiTypeElement[] patternTypeElements = patternParameterList.getTypeParameterElements(); if (patternTypeElements.length == 0) { return true; } PsiReferenceParameterList matchedParameterList = call2.getTypeArgumentList(); if (matchedParameterList.getFirstChild() == null && myMatchingVisitor.getMatchContext().getOptions().isLooseMatching()) { // check inferred type parameters final JavaResolveResult resolveResult = call2.resolveMethodGenerics(); final PsiMethod targetMethod = (PsiMethod)resolveResult.getElement(); if (targetMethod == null) { return false; } final PsiTypeParameterList typeParameterList = targetMethod.getTypeParameterList(); if (typeParameterList == null) { return false; } final PsiTypeParameter[] typeParameters = typeParameterList.getTypeParameters(); final PsiSubstitutor substitutor = resolveResult.getSubstitutor(); matchedParameterList = (PsiReferenceParameterList)matchedParameterList.copy(); for (final PsiTypeParameter typeParameter : typeParameters) { final PsiType type = substitutor.substitute(typeParameter); if (type == null) { return false; } final PsiTypeElement matchedTypeElement = JavaPsiFacade.getElementFactory(call1.getProject()).createTypeElement(type); matchedParameterList.add(matchedTypeElement); } } final PsiTypeElement[] matchedTypeElements = matchedParameterList.getTypeParameterElements(); return myMatchingVisitor.matchSequentially(patternTypeElements, matchedTypeElements); }