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

(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-2 / +2 lines)
Lines 1706-1712 Link Here
1706
					isTokenStar = true;
1706
					isTokenStar = true;
1707
					lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines);
1707
					lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines);
1708
					if (lineNumber == firstLine && previousToken == SKIP_FIRST_WHITESPACE_TOKEN) {
1708
					if (lineNumber == firstLine && previousToken == SKIP_FIRST_WHITESPACE_TOKEN) {
1709
						editStart = this.scanner.getCurrentTokenStartPosition();
1709
						buffer.append(' ');
1710
					}
1710
					}
1711
					previousToken = token;
1711
					previousToken = token;
1712
					if (this.scanner.currentCharacter == '/') {
1712
					if (this.scanner.currentCharacter == '/') {
Lines 1888-1894 Link Here
1888
						printIndentationIfNecessary(replacement);
1888
						printIndentationIfNecessary(replacement);
1889
						replacement.append(BLOCK_LINE_PREFIX);
1889
						replacement.append(BLOCK_LINE_PREFIX);
1890
				    	this.column = col;
1890
				    	this.column = col;
1891
					} else {
1891
					} else if (buffer.length()==0 || buffer.charAt(0)!=' ') {
1892
						replacement.append(' ');
1892
						replacement.append(' ');
1893
					}
1893
					}
1894
				}
1894
				}
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java (+15 lines)
Lines 6146-6151 Link Here
6146
}
6146
}
6147
6147
6148
/**
6148
/**
6149
 * @bug 295825: [formatter] Commentaries are running away after formatting are used
6150
 * @test Verify that block comment stay unchanged when text starts with a star
6151
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295825"
6152
 */
6153
public void testBug295825() {
6154
	String source = 
6155
		"public class A {\n" + 
6156
		"	/* * command */\n" + 
6157
		"	void method() {\n" + 
6158
		"	}\n" + 
6159
	    "}\n";
6160
	formatSource(source);
6161
}
6162
6163
/**
6149
 * @bug 300379: [formatter] Fup of bug 287833
6164
 * @bug 300379: [formatter] Fup of bug 287833
6150
 * @test Verify that the leading '{' is not deleted while formatting
6165
 * @test Verify that the leading '{' is not deleted while formatting
6151
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379"
6166
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379"

Return to bug 295825