String (@NotNull PsiComment comment) { if (comment instanceof PsiDocComment docComment) { final StringBuilder result = new StringBuilder(); for (PsiElement element : docComment.getDescriptionElements()) { result.append(element.getText()); } return result.toString(); } else { final IElementType type = comment.getTokenType(); final String text = comment.getText(); return (type == JavaTokenType.END_OF_LINE_COMMENT) ? StringUtil.trimStart(text, "//") : StringUtil.trimEnd(text.substring(2), "*/"); } }