Index: src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java,v retrieving revision 1.164 diff -u -r1.164 FormatterRegressionTests.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 15 Jun 2005 14:54:33 -0000 1.164 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 22 Jun 2005 14:11:10 -0000 @@ -62,7 +62,7 @@ return suite; } junit.framework.TestSuite suite = new Suite(FormatterRegressionTests.class.getName()); - suite.addTest(new FormatterRegressionTests("test583")); //$NON-NLS-1$ + suite.addTest(new FormatterRegressionTests("test584")); //$NON-NLS-1$ return suite; } @@ -8175,4 +8175,27 @@ JavaCore.setOptions(javaCoreOptions); } } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=101230 + public void test584() { + Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); + DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); + Hashtable javaCoreOptions = JavaCore.getOptions(); + try { + Hashtable newJavaCoreOptions = JavaCore.getOptions(); + newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + JavaCore.setOptions(newJavaCoreOptions); + + Map compilerOptions = new HashMap(); + compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions); + runTest(codeFormatter, "test584", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$ + } finally { + JavaCore.setOptions(javaCoreOptions); + } + } } Index: workspace/Formatter/test584/A_in.java =================================================================== RCS file: workspace/Formatter/test584/A_in.java diff -N workspace/Formatter/test584/A_in.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/Formatter/test584/A_in.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,6 @@ +public class X { + public static void main(String[] args) { + if(true) throw new RuntimeException("X"); + loop: System.out.println("X"); + } + } Index: workspace/Formatter/test584/A_out.java =================================================================== RCS file: workspace/Formatter/test584/A_out.java diff -N workspace/Formatter/test584/A_out.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/Formatter/test584/A_out.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,7 @@ +public class X { + public static void main(String[] args) { + if (true) + throw new RuntimeException("X"); + loop: System.out.println("X"); + } +}