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
/**
	 * Returns the reference indentation to use for this line.
	 * 
	 * @return The reference indentation for this line
	 */
	protected final String getIndentation() {
		return fIndentation;
	}
	/*
	 * @see org.eclipse.jdt.internal.ui.text.comment.CommentLine#getStartLinePrefix()
	 */
	protected String getStartingPrefix() {
		return MULTI_COMMENT_START_PREFIX;
	}
	/*
	 * @see org.eclipse.jdt.internal.ui.text.comment.CommentLine#scanLine(int)
	 */
	protected void scanLine(final int line) {
		final CommentRegion parent= getParent();
		final String start= getStartingPrefix().trim();
		final String end= getEndingPrefix().trim();
		final String content= getContentPrefix().trim();
		final int lines= parent.getSize();
		final CommentRange range= getFirst();
		int offset= 0;
		int postfix= 0;
		String text= parent.getText(range.getOffset(), range.getLength());
		if (line == 0) {
			offset= text.indexOf(start);
			if (offset >= 0) {