PsiSubstitutor (final PsiMethod method, final PsiMethodCallExpression callExpr, boolean forCompletion) { final PsiResolveHelper helper = JavaPsiFacade.getInstance(method.getProject()).getResolveHelper(); final PsiParameter[] parameters = method.getParameterList().getParameters(); PsiExpression[] args = callExpr.getArgumentList().getExpressions(); PsiSubstitutor result = PsiSubstitutor.EMPTY; for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(method.getContainingClass())) { PsiType type = helper.inferTypeForMethodTypeParameter(typeParameter, parameters, args, PsiSubstitutor.EMPTY, callExpr.getParent(), forCompletion ? CompletionParameterTypeInferencePolicy.INSTANCE : DefaultParameterTypeInferencePolicy.INSTANCE); if (PsiTypes.nullType().equals(type)) return null; result = result.put(typeParameter, type); } return result; }