Bug 44035 [formatting] Error in formatting parts of java code snippets in comment
This is for build I20030930. The Java code formatter options are set to Format java code snippets. Taking the following comment: /** * The following is a Java snipet. * * <pre> * while ((size = availableSize(stream, size)) > 0) { * System.out.println("available"); * } * </pre> */ public void test() { } And trying to format it here is what we got: /** * The following is a Java snipet. * * <pre> * while ((size = availableSize(stream, size)) > 0) { * System.out.println("available"); } * </pre> */ public void test() { }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/comment/MultiCommentLine.java
public static final String MULTI_COMMENT_START_PREFIX= "/* "; 
	
	private String fIndentation= ""; 
	/**
	 * Creates a new multi-line comment line.
	 * 
	 * @param region
	 *                  Comment region to create the line for
	 */
	protected MultiCommentLine(final CommentRegion region) {
		super(region);
	}
	/*
	 * @see org.eclipse.jdt.internal.ui.text.comment.CommentLine#adapt(org.eclipse.jdt.internal.ui.text.comment.CommentLine)
	 */
	protected void adapt(final CommentLine previous) {
		if (!hasAttribute(COMMENT_ROOT) && !hasAttribute(COMMENT_PARAMETER) && !previous.hasAttribute(COMMENT_BLANKLINE))
			fIndentation= previous.getIndentation();
	}
	/*
	 * @see org.eclipse.jdt.internal.ui.text.comment.CommentLine#append(org.eclipse.jdt.internal.ui.text.comment.CommentRange)
	 */
	protected void append(final CommentRange range) {
		final MultiCommentRegion parent= (MultiCommentRegion)getParent();
		if (range.hasAttribute(COMMENT_PARAMETER))
			setAttribute(COMMENT_PARAMETER);
		else if (range.hasAttribute(COMMENT_ROOT))
			setAttribute(COMMENT_ROOT);
		else if (range.hasAttribute(COMMENT_BLANKLINE))