PsiSubstitutor (@NotNull PsiSubstitutor substitutor, @NotNull PsiMethod method, @Nullable PsiElement resolveContext) { final PsiTypeParameter[] typeParameters = method.getTypeParameters(); if (myTypeArguments != null && myTypeArguments.length == typeParameters.length) { for (int i = 0; i < typeParameters.length; i++) { PsiTypeParameter typeParameter = typeParameters[i]; final PsiType typeArgument = myTypeArguments[i]; substitutor = substitutor.put(typeParameter, typeArgument); } return substitutor; } if (myArgumentTypes != null && method.hasTypeParameters()) { PsiType[] argTypes = myArgumentTypes; if (method instanceof GrGdkMethod) { //type inference should be performed from static method argTypes = ArrayUtil.prepend(myThisType.getValue(), argTypes); method = ((GrGdkMethod)method).getStaticMethod(); LOG.assertTrue(method.isValid()); } return inferMethodTypeParameters(method, substitutor, typeParameters, argTypes); } return substitutor; }