### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java,v retrieving revision 1.236 diff -u -r1.236 CodeFormatterVisitor.java --- formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 3 Sep 2010 15:44:26 -0000 1.236 +++ formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 9 Nov 2010 14:21:32 -0000 @@ -2041,6 +2041,11 @@ do { try { for (int i = startIndex, max = members.length; i < max; i++) { + while (isNextToken(TerminalTokens.TokenNameSEMICOLON)) { + this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon); + this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); + } + this.scribe.printNewLine(); ASTNode member = members[i]; if (member instanceof FieldDeclaration) { isChunkStart = memberAlignment.checkChunkStart(Alignment.CHUNK_FIELD, i, this.scribe.scanner.currentPosition); #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java,v retrieving revision 1.261 diff -u -r1.261 FormatterRegressionTests.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 3 Sep 2010 15:41:01 -0000 1.261 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 9 Nov 2010 14:21:32 -0000 @@ -61,8 +61,8 @@ Map formatterOptions; static { -// TESTS_NUMBERS = new int[] { 723 }; -// TESTS_RANGE = new int[] { 715, -1 }; +// TESTS_NUMBERS = new int[] { 730 }; + TESTS_RANGE = new int[] { 730, -1 }; } public static Test suite() { return buildModelTestSuite(FormatterRegressionTests.class); @@ -10892,7 +10892,7 @@ "}\n" ); } -public void testONLY_729() { +public void test729() { this.formatterPrefs = null; String profilePath = getResource("profiles", "b308000.xml"); this.formatterOptions = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(profilePath, "b308000"); @@ -10918,5 +10918,67 @@ "}\n" ); } - +public void test730() { + this.formatterPrefs = null; + this.formatterOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + String source = "enum Fail1 {A;;{}}"; + formatSource( + source, + "enum Fail1 {\n" + + " A;\n" + + " ;\n" + + " {\n" + + " }\n" + + "}" + ); +} +public void test731() { + this.formatterPrefs = null; + this.formatterOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + String source = "enum Fail2 {A,B;;{}}"; + formatSource( + source, + "enum Fail2 {\n" + + " A, B;\n" + + " ;\n" + + " {\n" + + " }\n" + + "}" + ); +} +public void test732() { + this.formatterPrefs = null; + this.formatterOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + String source = "enum Fail3 {A;;public void foo() {}}"; + formatSource( + source, + "enum Fail3 {\n" + + " A;\n" + + " ;\n" + + " public void foo() {\n" + + " }\n" + + "}" + ); +} +public void test733() { + this.formatterPrefs = null; + this.formatterOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + this.formatterOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + String source = "enum Fail4 {A;;public int i = 0;}"; + formatSource( + source, + "enum Fail4 {\n" + + " A;\n" + + " ;\n" + + " public int i = 0;\n" + + "}" + ); +} }