### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v retrieving revision 1.202 diff -u -r1.202 Scribe.java --- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 19 Mar 2010 09:04:36 -0000 1.202 +++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 22 Mar 2010 16:07:23 -0000 @@ -1706,7 +1706,7 @@ isTokenStar = true; lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); if (lineNumber == firstLine && previousToken == SKIP_FIRST_WHITESPACE_TOKEN) { - editStart = this.scanner.getCurrentTokenStartPosition(); + buffer.append(' '); } previousToken = token; if (this.scanner.currentCharacter == '/') { @@ -1888,7 +1888,7 @@ printIndentationIfNecessary(replacement); replacement.append(BLOCK_LINE_PREFIX); this.column = col; - } else { + } else if (buffer.length()==0 || buffer.charAt(0)!=' ') { replacement.append(' '); } } #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.61 diff -u -r1.61 FormatterCommentsBugsTest.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 19 Mar 2010 09:04:29 -0000 1.61 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 22 Mar 2010 16:07:25 -0000 @@ -6146,6 +6146,21 @@ } /** + * @bug 295825: [formatter] Commentaries are running away after formatting are used + * @test Verify that block comment stay unchanged when text starts with a star + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295825" + */ +public void testBug295825() { + String source = + "public class A {\n" + + " /* * command */\n" + + " void method() {\n" + + " }\n" + + "}\n"; + formatSource(source); +} + +/** * @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"