PsiClass (@NotNull PsiExpression expr) { PsiClass aClass = PsiTreeUtil.getParentOfType(expr, PsiClass.class); while (aClass instanceof PsiAnonymousClass && PsiTreeUtil.isAncestor(((PsiAnonymousClass)aClass).getArgumentList(), expr, true)) { aClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class, true); } return aClass; }