PsiClass[] (@NotNull PsiClass aClass) { if (!aClass.isValid()) return PsiClass.EMPTY_ARRAY; if (aClass.isInterface()) return PsiClass.EMPTY_ARRAY; ArrayList<PsiClass> superClasses = new ArrayList<>(); while (!CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) { PsiClass aClass1 = aClass; PsiClass[] superTypes = aClass1.getSupers(); PsiClass superType = null; for (PsiClass type : superTypes) { if (!type.isInterface()) { superType = type; break; } } if (superType == null) break; if (superClasses.contains(superType)) break; superClasses.add(superType); aClass = superType; } return superClasses.toArray(PsiClass.EMPTY_ARRAY); }