PsiClass (PsiClass aClass) { PsiClass current = aClass; while (current != null) { PsiClassType[] supers = current.getExtendsListTypes(); if (supers.length == 0) { return current; } PsiClass base = supers[0].resolve(); if (base != null) { current = base; } else { return current; } } return null; }