GrDocComment (@NotNull GrDocCommentOwner owner, @Nullable GrDocComment comment) { GrDocComment docComment = owner.getDocComment(); if (docComment != null) { if (comment == null) { docComment.delete(); return null; } else { PsiElement added = docComment.replace(comment); assert added instanceof GrDocComment; return (GrDocComment)added; } } else { if (comment == null) return null; PsiElement parent = owner.getParent(); ASTNode node = owner.getNode(); parent.getNode().addLeaf(GroovyTokenTypes.mNLS, "\n ", node); PsiElement added = parent.addBefore(comment, owner); assert added instanceof GrDocComment; return (GrDocComment)added; } }