### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java,v retrieving revision 1.29 diff -u -r1.29 FormatterBugsTests.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 6 May 2010 11:11:17 -0000 1.29 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 6 May 2010 15:14:31 -0000 @@ -5673,6 +5673,44 @@ } /** + * @bug 298844: [formatter] New lines in empty method body wrong behavior + * @test Verify that comment is well indented inside empty constructor and method + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=298844" + */ +public void testBug298844a() { + this.formatterPrefs.insert_new_line_in_empty_method_body = false; + String source = + "public class X01 {\n" + + "public X01() {\n" + + "// TODO Auto-generated constructor stub\n" + + "}\n" + + "}\n"; + formatSource(source, + "public class X01 {\n" + + " public X01() {\n" + + " // TODO Auto-generated constructor stub\n" + + " }\n" + + "}\n" + ); +} +public void testBug298844b() { + this.formatterPrefs.insert_new_line_in_empty_method_body = false; + String source = + "public class X02 {\n" + + "public void foo() {\n" + + " // TODO Auto-generated constructor stub\n" + + "}\n" + + "}\n"; + formatSource(source, + "public class X02 {\n" + + " public void foo() {\n" + + " // TODO Auto-generated constructor stub\n" + + " }\n" + + "}\n" + ); +} + +/** * @bug 302123: [formatter] AssertionFailedException occurs while formatting a source containing the specific javadoc comment... * @test Verify that no exception occurs while formatting source including the specific comment * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=302123"