boolean (@NotNull PsiClass psiClass) { PsiElement parent = psiClass.getParent(); if (parent instanceof PsiDeclarationStatement && parent.getParent() instanceof PsiCodeBlock) { return true; } if (parent instanceof PsiClass) { return isLocalOrAnonymousClass((PsiClass)parent); } return false; }