PsiClass (PsiClass aClass) { PsiClass outerClass = aClass; while (true) { final PsiClass containingClass = getContainingClass(outerClass); if (containingClass != null) { outerClass = containingClass; } else { return outerClass; } } }