View | Details | Raw Unified | Return to bug 101247 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java (-1 / +24 lines)
Lines 62-68 Link Here
62
			return suite;
62
			return suite;
63
		}
63
		}
64
		junit.framework.TestSuite suite = new Suite(FormatterRegressionTests.class.getName());
64
		junit.framework.TestSuite suite = new Suite(FormatterRegressionTests.class.getName());
65
		suite.addTest(new FormatterRegressionTests("test583"));  //$NON-NLS-1$
65
		suite.addTest(new FormatterRegressionTests("test584"));  //$NON-NLS-1$
66
		return suite;
66
		return suite;
67
	}
67
	}
68
68
Lines 8175-8178 Link Here
8175
			JavaCore.setOptions(javaCoreOptions);
8175
			JavaCore.setOptions(javaCoreOptions);
8176
		}
8176
		}
8177
	}
8177
	}
8178
	
8179
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=101230
8180
	public void test584() {
8181
		Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
8182
		DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
8183
		Hashtable javaCoreOptions = JavaCore.getOptions();
8184
		try {
8185
			Hashtable newJavaCoreOptions = JavaCore.getOptions();
8186
			newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
8187
			newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
8188
			newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
8189
			JavaCore.setOptions(newJavaCoreOptions);
8190
		
8191
			Map compilerOptions = new HashMap();
8192
			compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
8193
			compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
8194
			compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);		
8195
			DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
8196
			runTest(codeFormatter, "test584", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
8197
		} finally {
8198
			JavaCore.setOptions(javaCoreOptions);
8199
		}
8200
	}
8178
}
8201
}
(-)workspace/Formatter/test584/A_in.java (+6 lines)
Added Link Here
1
public class X {
2
  public static void main(String[] args) {
3
    if(true) throw new RuntimeException("X");
4
      loop: System.out.println("X");
5
    }
6
  }
(-)workspace/Formatter/test584/A_out.java (+7 lines)
Added Link Here
1
public class X {
2
	public static void main(String[] args) {
3
		if (true)
4
			throw new RuntimeException("X");
5
		loop: System.out.println("X");
6
	}
7
}

Return to bug 101247