boolean (@NotNull PsiElement psiElement, @Nullable PsiClass containingClass) { for (PsiElement element = psiElement;element != null;element = element.getParent()) { if (element instanceof PsiClass) { boolean innerClass = !psiElement.getManager().areElementsEquivalent(element, containingClass); if (innerClass) { if (element instanceof PsiAnonymousClass) { if (PsiTreeUtil.isAncestor(((PsiAnonymousClass)element).getArgumentList(), psiElement, false)) { continue; } return !insideClassInitialization(containingClass, (PsiClass)element); } PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(psiElement, PsiLambdaExpression.class); return lambdaExpression == null || !insideClassInitialization(containingClass, (PsiClass)element); } return false; } } return false; }