### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java,v retrieving revision 1.30 diff -u -r1.30 FormatterCommentParser.java --- formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 7 Jan 2010 20:18:49 -0000 1.30 +++ formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 8 Feb 2010 16:54:01 -0000 @@ -416,7 +416,8 @@ int ptr = this.htmlTagsPtr; while (ptr >= 0) { if (getHtmlTagIndex(this.htmlTags[ptr--]) == JAVADOC_CODE_TAGS_ID) { - if (this.textStart == -1) this.textStart = previousPosition; + if (this.textStart == -1) this.textStart = this.inlineTagStarted ? this.inlineTagStart : previousPosition; + this.inlineTagStarted = false; return true; } } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v retrieving revision 1.47 diff -u -r1.47 FormatterCommentsBugsTest.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 21 Sep 2009 07:28:29 -0000 1.47 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 8 Feb 2010 16:54:02 -0000 @@ -4934,4 +4934,63 @@ "}\n"); } +/** + * @bug 300379: [formatter] Fup of bug 287833 + * @test Verify that the leading '{' is not deleted while formatting + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379" + */ +public void testBug300379() { + String source = + "public class X {\n" + + " /**\n" + + " *
   {@code\n" + 
+		"     * \n" + 
+		"     *   public class X {\n" + 
+		"     *   }}
\n" + + " */\n" + + " public void foo() {}\n" + + "}\n"; + + formatSource(source, + "public class X {\n" + + " /**\n" + + " *
\n" + 
+		"	 * {\n" + 
+		"	 * 	@code\n" + 
+		"	 * 	public class X {\n" + 
+		"	 * 	}\n" + 
+		"	 * }\n" + 
+		"	 * 
\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"); +} +public void testBug300379b() { + String source = + "public class X {\n" + + " /**\n" + + " *
   {@code\n" + 
+		"     * \n" + 
+		"     *   public class X {}}
\n" + + " */\n" + + " public void foo() {}\n" + + "}\n"; + + formatSource(source, + "public class X {\n" + + " /**\n" + + " *
\n" + 
+		"	 * {\n" + 
+		"	 * 	@code\n" + 
+		"	 * 	public class X {\n" + 
+		"	 * 	}\n" + 
+		"	 * }\n" + 
+		"	 * 
\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"); +} + }