boolean (PsiMethod member) { PsiParameterList list = member.getParameterList(); if (list.isEmpty()) { return false; } PsiParameter parameter = list.getParameter(0); if (parameter == null) { return false; } PsiType paramType = PsiTypesUtil.getParameterType(list.getParameters(), 0, true); PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; for (PsiTypeParameter typeParameter : member.getTypeParameters()) { PsiClass[] supers = typeParameter.getSupers(); PsiType[] types = typeParameter.getSuperTypes(); if (ContainerUtil.or(supers, s -> s instanceof PsiTypeParameter && InheritanceUtil.getCircularClass(s) != null)) { types = new PsiType[]{TypeConversionUtil.erasure(types[0])}; } PsiType composite = PsiIntersectionType.createIntersection(true, types); substitutor = substitutor.put(typeParameter, PsiWildcardType.createExtends(typeParameter.getManager(), composite)); } PsiType targetType = substitutor.substitute(paramType); if (!TypeConversionUtil.areTypesAssignmentCompatible(targetType, myOldQualifiedExpression)) { return false; } if (myOldQualifiedExpression instanceof PsiLiteralExpression literalExpression && PsiTypes.nullType().equals(literalExpression.getType())) { if (NullableNotNullManager.isNotNull(parameter)) { return false; } } if (!isSmart) { return true; } PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(parameter.getType()); if (psiClass instanceof PsiTypeParameter typeParameter) { substitutor = substitutor.put(typeParameter, myOldQualifiedExpression.getType()); } PsiType returnType = member.getReturnType(); returnType = substitutor.substitute(returnType); for (PsiType type : myExpectedTypes.getValue()) { if (TypeConversionUtil.isAssignable(type, returnType)) { return true; } } return false; }