### 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.161 diff -u -r1.161 Scribe.java --- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 27 Feb 2009 16:25:36 -0000 1.161 +++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 9 Mar 2009 16:11:49 -0000 @@ -1223,7 +1223,7 @@ private void printBlockComment(boolean isJavadoc) { int currentTokenStartPosition = this.scanner.getCurrentTokenStartPosition(); int currentTokenEndPosition = this.scanner.getCurrentTokenEndPosition() + 1; - boolean includesBlockComments = includesBlockComments(); + boolean includesBlockComments = !isJavadoc && includesBlockComments(); this.scanner.resetTo(currentTokenStartPosition, currentTokenEndPosition - 1); int currentCharacter; #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.37 diff -u -r1.37 FormatterCommentsBugsTest.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 27 Feb 2009 14:58:07 -0000 1.37 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 9 Mar 2009 16:11:51 -0000 @@ -4426,4 +4426,73 @@ ); } +/** + * @bug 267658: [formatter] Javadoc comments may be still formatted as block comments + * @test Ensure that javadoc comment are formatted as block comment with certain + * options configuration + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=267658" + */ +public void testBug267658() throws JavaModelException { + this.formatterPrefs.comment_format_javadoc_comment = false; + this.formatterPrefs.comment_format_block_comment = true; + this.formatterPrefs.comment_format_line_comment = false; + String source = + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "package javadoc;\n" + + "\n" + + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "public class Test {\n" + + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "int field;\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "package javadoc;\n" + + "\n" + + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "public class Test {\n" + + " /**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + " int field;\n" + + "}\n" + ); +} +public void testBug267658b() throws JavaModelException { + this.formatterPrefs.comment_format_javadoc_comment = false; + this.formatterPrefs.comment_format_block_comment = true; + this.formatterPrefs.comment_format_line_comment = false; + String source = + "public class Test {\n" + + "/**\n" + + " * @test bug\n" + + " */\n" + + "int field;\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + " /**\n" + + " * @test bug\n" + + " */\n" + + " int field;\n" + + "}\n" + ); +} + }