boolean (final PsiMethod method, PsiType expectedType) { final PsiTypeParameter[] typeParameters = method.getTypeParameters(); if (typeParameters.length == 0) return false; final Set<PsiTypeParameter> set = Set.of(typeParameters); for (final PsiParameter parameter : method.getParameterList().getParameters()) { if (PsiTypesUtil.mentionsTypeParameters(parameter.getType(), set)) return false; } PsiSubstitutor substitutor = calculateMethodReturnTypeSubstitutor(method, expectedType); for (PsiTypeParameter parameter : typeParameters) { if (!TypeConversionUtil.typeParameterErasure(parameter).equals(substitutor.substitute(parameter))) { return true; } } return false; }