List<PsiClass> (PsiTypeElement typeElement) { PsiElement typeParent = typeElement.getParent(); if (typeParent instanceof PsiReferenceParameterList) { int index = Arrays.asList(((PsiReferenceParameterList)typeParent).getTypeParameterElements()).indexOf(typeElement); PsiElement listParent = typeParent.getParent(); if (index >= 0 && listParent instanceof PsiJavaCodeReferenceElement) { PsiElement target = ((PsiJavaCodeReferenceElement)listParent).resolve(); if (target instanceof PsiClass) { PsiTypeParameter[] typeParameters = ((PsiClass)target).getTypeParameters(); if (index < typeParameters.length) { return ContainerUtil.mapNotNull(typeParameters[index].getExtendsListTypes(), PsiUtil::resolveClassInType); } } } } return Collections.emptyList(); }