@Override
  public void apply(Editor editor, AbstractBasicJavaSmartEnterProcessor processor, @NotNull ASTNode astNode) throws IncorrectOperationException {
    if (!(
      BasicJavaAstTreeUtil.is(astNode, BASIC_ARRAY_INITIALIZER_EXPRESSION) ||
      BasicJavaAstTreeUtil.is(astNode, BASIC_ANNOTATION_ARRAY_INITIALIZER))) {
      return;
    }
    ASTNode child = astNode.getFirstChildNode();
    if (!child.getElementType().equals(JavaTokenType.LBRACE)) return;
    PsiElement psi = BasicJavaAstTreeUtil.toPsi(astNode);
    if (psi == null) {
      return;
    }
    if (!EnterAfterUnmatchedBraceHandler.isAfterUnmatchedLBrace(editor, child.getTextRange().getEndOffset(),
                                                                psi.getContainingFile().getFileType())) {
      return;
    }
    ASTNode anchor = BasicJavaAstTreeUtil.findChildByType(astNode, TokenType.ERROR_ELEMENT);
    if (anchor == null) {
      PsiElement last = PsiTreeUtil.getDeepestVisibleLast(psi);
      while (last != null && last.getNode().getElementType().equals(JavaTokenType.RBRACE)) {
        last = PsiTreeUtil.prevCodeLeaf(last);
      }
      if (last != null && PsiTreeUtil.isAncestor(psi, last, true)) {
        anchor = last.getNode();
      }
    }
    int endOffset = (anchor != null ? anchor : astNode).getTextRange().getEndOffset();
    editor.getDocument().insertString(endOffset, "}");
  }
@Override
  public void apply(Editor editor, AbstractBasicJavaSmartEnterProcessor processor, @NotNull ASTNode astNode)