boolean (@NotNull PsiElement leaf) { PsiElement prevLeaf = PsiTreeUtil.prevVisibleLeaf(leaf); // lambda if (prevLeaf != null && prevLeaf.getNode().getElementType() == JavaTokenType.ARROW) return true; // anonymous class ParentAwareTokenSet stopAt = ParentAwareTokenSet.orSet(MEMBER_SET, ParentAwareTokenSet.create(BASIC_CODE_BLOCK)); if (BasicJavaAstTreeUtil.getParentOfType(prevLeaf, BASIC_NEW_EXPRESSION, true, stopAt) != null) return true; // local class if (prevLeaf != null && prevLeaf.getParent() != null && BasicJavaAstTreeUtil.is(prevLeaf.getNode(), JavaTokenType.IDENTIFIER) && BasicJavaAstTreeUtil.is(prevLeaf.getParent().getNode(), CLASS_SET)) { return true; } // local record if (prevLeaf != null && prevLeaf.getParent() != null && prevLeaf.getNode().getElementType() == JavaTokenType.RPARENTH && BasicJavaAstTreeUtil.is(prevLeaf.getParent().getNode(), BASIC_RECORD_HEADER)) { return true; } return false; }