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

(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-1 / +1 lines)
Lines 1223-1229 Link Here
1223
	private void printBlockComment(boolean isJavadoc) {
1223
	private void printBlockComment(boolean isJavadoc) {
1224
		int currentTokenStartPosition = this.scanner.getCurrentTokenStartPosition();
1224
		int currentTokenStartPosition = this.scanner.getCurrentTokenStartPosition();
1225
		int currentTokenEndPosition = this.scanner.getCurrentTokenEndPosition() + 1;
1225
		int currentTokenEndPosition = this.scanner.getCurrentTokenEndPosition() + 1;
1226
		boolean includesBlockComments = includesBlockComments();
1226
		boolean includesBlockComments = !isJavadoc && includesBlockComments();
1227
1227
1228
		this.scanner.resetTo(currentTokenStartPosition, currentTokenEndPosition - 1);
1228
		this.scanner.resetTo(currentTokenStartPosition, currentTokenEndPosition - 1);
1229
		int currentCharacter;
1229
		int currentCharacter;
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java (+69 lines)
Lines 4426-4429 Link Here
4426
	);
4426
	);
4427
}
4427
}
4428
4428
4429
/**
4430
 * @bug 267658: [formatter] Javadoc comments may be still formatted as block comments
4431
 * @test Ensure that javadoc comment are formatted as block comment with certain
4432
 * 	options configuration
4433
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=267658"
4434
 */
4435
public void testBug267658() throws JavaModelException {
4436
	this.formatterPrefs.comment_format_javadoc_comment = false;
4437
	this.formatterPrefs.comment_format_block_comment = true;
4438
	this.formatterPrefs.comment_format_line_comment = false;
4439
	String source = 
4440
		"/**\n" + 
4441
		" * Test for\n" + 
4442
		" * bug 267658\n" + 
4443
		" */\n" + 
4444
		"package javadoc;\n" + 
4445
		"\n" + 
4446
		"/**\n" + 
4447
		" * Test for\n" + 
4448
		" * bug 267658\n" + 
4449
		" */\n" + 
4450
		"public class Test {\n" + 
4451
		"/**\n" + 
4452
		" * Test for\n" + 
4453
		" * bug 267658\n" + 
4454
		" */\n" + 
4455
		"int field;\n" + 
4456
		"}\n";
4457
	formatSource(source,
4458
		"/**\n" + 
4459
		" * Test for\n" + 
4460
		" * bug 267658\n" + 
4461
		" */\n" + 
4462
		"package javadoc;\n" + 
4463
		"\n" + 
4464
		"/**\n" + 
4465
		" * Test for\n" + 
4466
		" * bug 267658\n" + 
4467
		" */\n" + 
4468
		"public class Test {\n" + 
4469
		"	/**\n" + 
4470
		"	 * Test for\n" + 
4471
		"	 * bug 267658\n" + 
4472
		"	 */\n" + 
4473
		"	int field;\n" + 
4474
		"}\n"
4475
	);
4476
}
4477
public void testBug267658b() throws JavaModelException {
4478
	this.formatterPrefs.comment_format_javadoc_comment = false;
4479
	this.formatterPrefs.comment_format_block_comment = true;
4480
	this.formatterPrefs.comment_format_line_comment = false;
4481
	String source = 
4482
		"public class Test {\n" + 
4483
		"/**\n" + 
4484
		" * @test bug\n" + 
4485
		" */\n" + 
4486
		"int field;\n" + 
4487
		"}\n";
4488
	formatSource(source,
4489
		"public class Test {\n" + 
4490
		"	/**\n" + 
4491
		"	 * @test bug\n" + 
4492
		"	 */\n" + 
4493
		"	int field;\n" + 
4494
		"}\n"
4495
	);
4496
}
4497
4429
}
4498
}

Return to bug 267658