View | Details | Raw Unified | Return to bug 300379
Collapse All | Expand All

(-)formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java (-1 / +2 lines)
Lines 416-422 Link Here
416
		int ptr = this.htmlTagsPtr;
416
		int ptr = this.htmlTagsPtr;
417
   		while (ptr >= 0) {
417
   		while (ptr >= 0) {
418
			if (getHtmlTagIndex(this.htmlTags[ptr--]) == JAVADOC_CODE_TAGS_ID) {
418
			if (getHtmlTagIndex(this.htmlTags[ptr--]) == JAVADOC_CODE_TAGS_ID) {
419
				if (this.textStart == -1) this.textStart = previousPosition;
419
				if (this.textStart == -1) this.textStart = this.inlineTagStarted ? this.inlineTagStart : previousPosition;
420
				this.inlineTagStarted = false;
420
				return true;
421
				return true;
421
			}
422
			}
422
		}
423
		}
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java (+59 lines)
Lines 4934-4937 Link Here
4934
	    "}\n");
4934
	    "}\n");
4935
}
4935
}
4936
4936
4937
/**
4938
 * @bug 300379: [formatter] Fup of bug 287833
4939
 * @test Verify that the leading '{' is not deleted while formatting
4940
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379"
4941
 */
4942
public void testBug300379() {
4943
	String source = 
4944
		"public class X {\n" + 
4945
		"    /**\n" + 
4946
		"     * <pre>   {@code\n" + 
4947
		"     * \n" + 
4948
		"     *   public class X {\n" + 
4949
		"     *   }}</pre>\n" + 
4950
		"     */\n" + 
4951
		"    public void foo() {}\n" + 
4952
	    "}\n";
4953
	    
4954
	formatSource(source, 
4955
		"public class X {\n" + 
4956
		"	/**\n" + 
4957
		"	 * <pre>\n" + 
4958
		"	 * {\n" + 
4959
		"	 * 	&#064;code\n" + 
4960
		"	 * 	public class X {\n" + 
4961
		"	 * 	}\n" + 
4962
		"	 * }\n" + 
4963
		"	 * </pre>\n" + 
4964
		"	 */\n" + 
4965
		"	public void foo() {\n" + 
4966
		"	}\n" + 
4967
	    "}\n");
4968
}
4969
public void testBug300379b() {
4970
	String source = 
4971
		"public class X {\n" + 
4972
		"    /**\n" + 
4973
		"     * <pre>   {@code\n" + 
4974
		"     * \n" + 
4975
		"     *   public class X {}}</pre>\n" + 
4976
		"     */\n" + 
4977
		"    public void foo() {}\n" + 
4978
	    "}\n";
4979
	    
4980
	formatSource(source, 
4981
		"public class X {\n" + 
4982
		"	/**\n" + 
4983
		"	 * <pre>\n" + 
4984
		"	 * {\n" + 
4985
		"	 * 	&#064;code\n" + 
4986
		"	 * 	public class X {\n" + 
4987
		"	 * 	}\n" + 
4988
		"	 * }\n" + 
4989
		"	 * </pre>\n" + 
4990
		"	 */\n" + 
4991
		"	public void foo() {\n" + 
4992
		"	}\n" + 
4993
	    "}\n");
4994
}
4995
4937
}
4996
}

Return to bug 300379