JavaResolveResult (@NotNull PsiFile containingFile) { PsiTypeElement[] typeElements = myRefParameterList == null ? PsiTypeElement.EMPTY_ARRAY : myRefParameterList.getTypeParameterElements(); PsiElement resolve = resolveElement(containingFile); if (resolve == null) return null; if (resolve instanceof PsiClass) { Map<PsiTypeParameter, PsiType> substitutionMap = new HashMap<>(); int index = 0; for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable((PsiClass)resolve)) { if (index >= typeElements.length) { substitutionMap.put(parameter, null); } else { substitutionMap.put(parameter, typeElements[index].getType()); } index++; } collectOuterClassTypeArgs((PsiClass)resolve, myCanonicalText, substitutionMap); return new CandidateInfo(resolve, PsiSubstitutor.createSubstitutor(substitutionMap)); } else { return new CandidateInfo(resolve, PsiSubstitutor.EMPTY); } }