PsiType (@NotNull PsiClassType psiType, Set<PsiClass> processed) { PsiClass aClass = psiType.resolve(); if (aClass instanceof PsiTypeParameter) { PsiClassType[] types = aClass.getExtendsListTypes(); List<PsiType> result = new ArrayList<>(); for (PsiClassType type : types) { PsiClass resolved = type.resolve(); if (resolved != null && processed.add(resolved)) { PsiClassType classType = JavaPsiFacade.getElementFactory(aClass.getProject()).createType(resolved); result.add(normalizeClassType(classType, processed)); } } if (!result.isEmpty()) { return PsiIntersectionType.createIntersection(true, result.toArray(PsiType.EMPTY_ARRAY)); } return PsiType.getJavaLangObject(aClass.getManager(), aClass.getResolveScope()); } return psiType.rawType(); }