boolean (@NotNull PsiClass aClass) { while (true) { if (aClass.hasModifierProperty(PsiModifier.PRIVATE)) { return false; } PsiElement parent = aClass.getParent(); if (parent == null || parent instanceof PsiDeclarationStatement) { return false; } if (parent instanceof PsiJavaFile) { return true; } aClass = (PsiClass)parent; } }