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
}
			if (index - offset > 0) {
				result= new CommentRange(begin + offset, index - offset);
				result.setAttribute(attribute);
				parent.append(result);
				offset= index;
			}
		}
	}
	/**
	 * Removes all leading and trailing occurrences from <code>line</code>.
	 * 
	 * @param line
	 *                  The string to remove the occurrences of <code>trimmable</code>
	 * @param trimmable
	 *                  The string to remove from <code>line</code>
	 * @return The region of the trimmed substring within <code>line</code>
	 */
	protected final IRegion trimLine(final String line, final String trimmable) {
		final int trim= trimmable.length();
		int offset= 0;
		int length= line.length() - trim;
		while (line.startsWith(trimmable, offset))
			offset += trim;
		while (line.startsWith(trimmable, length))
			length -= trim;
		return new Region(offset, length + trim);
	}
}