@SuppressWarnings({"MethodWithMultipleLoops"}) public String toString() { StringBuffer sb = new StringBuffer(); sb.append('{'); boolean first = true; for (Map.Entry<RelativePosition, List<Comment>> entry : commentsMap.entrySet()) { if (!first) { sb.append(", "); first = false; } sb.append("[").append(entry.getKey()).append(" -> "); for (Comment comment : entry.getValue()) { sb.append(',').append(comment.getText()); } sb.append("]"); } sb.append('}'); return sb.toString(); }
/** * Returns the preceding immediate comment */ static String getPrecedingImmediateCommentText(CompilationInfo cinfo, Tree tree) { List<Comment> comments = cinfo.getTreeUtilities().getComments(tree, true); return comments.size() > 0 ? comments.get(comments.size()-1).getText() : null; }
String body = comment.getText(); boolean rawBody = body.length() == 0 || body.charAt(0) != '/'; LinkedList<CommentLine> lines = new LinkedList<CommentLine>(); if (comment.pos() > 0 && comment.endPos() < diffContext.origText.length() && diffContext.origText.substring(comment.pos() - 1, comment.endPos()).contentEquals("\n" + comment.getText())) { if (out.lastBlankLines == 0 && !preceding) newline();
copyTo(localPointer, localPointer = oldTreeStartPos); printer.print(newC.getText()); newC = safeNext(newIter); firstNewCommentPrinted = true;