PsiType (@NotNull PsiClassType classType) { if (classType instanceof PsiCorrectedClassType) { return myResolveScope.equals(classType.getResolveScope()) ? classType : visitClassType(((PsiCorrectedClassType)classType).myDelegate); } PsiClassType alreadyComputed = myResultMap.get(classType); if (alreadyComputed != null) { return alreadyComputed; } final PsiClassType.ClassResolveResult classResolveResult = classType.resolveGenerics(); final PsiClass psiClass = classResolveResult.getElement(); final PsiSubstitutor substitutor = classResolveResult.getSubstitutor(); if (psiClass == null) return classType; if (psiClass instanceof LightClass) return classType; PsiUtilCore.ensureValid(psiClass); final PsiClass mappedClass = PsiSuperMethodUtil.correctClassByScope(psiClass, myResolveScope); if (mappedClass == null) return classType; PsiClassType mappedType = new PsiCorrectedClassType(classType.getLanguageLevel(), classType, new CorrectedResolveResult(psiClass, mappedClass, substitutor, classResolveResult)); myResultMap.put(classType, mappedType); return mappedType; }