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/JavaDocRegion.java
/**
	 * Marks tag ranges in this javadoc region.
	 * 
	 * @param tags
	 *                  The tags which confine the attributed ranges
	 * @param key
	 *                  The key of the attribute to set when an attributed range has
	 *                  been recognized
	 * @param include
	 *                  <code>true</code> iff end tags in this attributed range
	 *                  should be attributed too, <code>false</code> otherwise
	 */
	protected final void markTagRanges(final String[] tags, final int key, final boolean include) {
		int level= 0;
		int count= 0;
		String token= null;
		CommentRange current= null;
		for (int index= 0; index < tags.length; index++) {
			level= 0;
			for (final Iterator iterator= getRanges().iterator(); iterator.hasNext();) {
				current= (CommentRange)iterator.next();
				count= current.getLength();
				if (count > 0) {
					token= getText(current.getOffset(), current.getLength());
					level= current.markRange(token, tags[index], level, key, include);
				}
			}
		}
	}
}