List<PsiType> (PsiElement context, PsiTypeParameterListOwner paramOwner, Iterable<? extends PsiTypeParameter> typeParams, PsiClassType expectedType) { if (paramOwner instanceof PsiClass) { return GenericsUtil.getExpectedTypeArguments(context, (PsiClass)paramOwner, typeParams, expectedType); } PsiSubstitutor substitutor = SmartCompletionDecorator.calculateMethodReturnTypeSubstitutor((PsiMethod)paramOwner, expectedType); return ContainerUtil.map(typeParams, substitutor::substitute); }