String (@NotNull String indent) { final String prefix; if (myFormatter.getSettings().JD_LEADING_ASTERISKS_ARE_ENABLED) { prefix = indent + " * "; } else { prefix = indent; } StringBuilder sb = new StringBuilder(); if (!isNull(myDescription)) { sb.append(myFormatter.getParser().formatJDTagDescription(myDescription, prefix)); if (myFormatter.getSettings().JD_ADD_BLANK_AFTER_DESCRIPTION) { sb.append(prefix); sb.append('\n'); } } generateSpecial(prefix, sb); final String continuationPrefix = prefix + javadocContinuationIndent(); if (!isNull(myUnknownList) && myFormatter.getSettings().JD_KEEP_INVALID_TAGS) { for (String aUnknownList : myUnknownList) { sb.append(myFormatter.getParser().formatJDTagDescription(aUnknownList, prefix, continuationPrefix)); } } if (!isNull(mySeeAlsoList)) { JDTag tag = JDTag.SEE; for (String aSeeAlsoList : mySeeAlsoList) { StringBuilder tagDescription = myFormatter.getParser() .formatJDTagDescription(aSeeAlsoList, prefix + tag.getWithEndWhitespace(), continuationPrefix); sb.append(tagDescription); } } if (!isNull(mySinceList)) { JDTag tag = JDTag.SINCE; for (String since : mySinceList) { StringBuilder tagDescription = myFormatter.getParser() .formatJDTagDescription(since, prefix + tag.getWithEndWhitespace(), continuationPrefix); sb.append(tagDescription); } } if (myDeprecated != null) { JDTag tag = JDTag.DEPRECATED; StringBuilder tagDescription = myFormatter.getParser() .formatJDTagDescription(myDeprecated, prefix + tag.getWithEndWhitespace(), continuationPrefix); sb.append(tagDescription); } if (sb.length() > prefix.length()) { // if it ends with a blank line delete that int nlen = sb.length() - prefix.length() - 1; if (sb.substring(nlen, sb.length()).equals(prefix + "\n")) { sb.delete(nlen, sb.length()); } } else if (sb.length() == 0 && !StringUtil.isEmpty(myEndLine)) { sb.append(prefix).append('\n'); } if (myMultiLineComment && myFormatter.getSettings().JD_DO_NOT_WRAP_ONE_LINE_COMMENTS || !myFormatter.getSettings().JD_DO_NOT_WRAP_ONE_LINE_COMMENTS || sb.indexOf("\n") != sb.length() - 1) // If comment has become multiline after formatting - it must be shown as multiline. // Last symbol is always '\n', so we need to check if there is one more LF symbol before it. { sb.insert(0, myFirstLine + '\n'); sb.append(indent); } else { sb.replace(0, prefix.length(), myFirstLine + " "); sb.deleteCharAt(sb.length()-1); } sb.append(' ').append(myEndLine); return sb.toString(); }