Skip to content

Commit 5dd4c25

Browse files
committed
Use new Platform.OS API to determine the running platform
1 parent ddf0a0a commit 5dd4c25

25 files changed

+35
-41
lines changed

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2661,7 +2661,7 @@ protected IJavaVariable findVariable(IJavaStackFrame frame, String name) throws
26612661
* @return true if the local filesystem is case-sensitive, false otherwise
26622662
*/
26632663
protected boolean isFileSystemCaseSensitive() {
2664-
return Platform.OS_MACOSX.equals(Platform.getOS()) ? false : new File("a").compareTo(new File("A")) != 0; //$NON-NLS-1$ //$NON-NLS-2$
2664+
return Platform.OS.isMac() ? false : new File("a").compareTo(new File("A")) != 0; //$NON-NLS-1$ //$NON-NLS-2$
26652665
}
26662666

26672667
/**

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public AutomatedSuite() {
204204
addTest(new TestSuite(ProjectClasspathVariableTests.class));
205205

206206
//mac specific tests
207-
if(Platform.OS_MACOSX.equals(Platform.getOS())) {
207+
if (Platform.OS.isMac()) {
208208
addTest(new TestSuite(PListParserTests.class));
209209
}
210210

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ClasspathContainerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void testCanUpdate() throws CoreException {
148148
public void testLibraryCaseSensitivity() {
149149
IVMInstall def = JavaRuntime.getDefaultVMInstall();
150150
LibraryLocation[] libs = JavaRuntime.getLibraryLocations(def);
151-
boolean caseSensitive = !Platform.getOS().equals(Platform.WS_WIN32);
151+
boolean caseSensitive = !Platform.OS.isWindows();
152152
LibraryLocation[] set1 = new LibraryLocation[libs.length];
153153
LibraryLocation[] set2 = new LibraryLocation[libs.length];
154154
for (int i = 0; i < libs.length; i++) {

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleInputTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private void waitStarted() throws InterruptedException {
273273
}
274274
}
275275
assertNotNull("Console is null", fConsole);
276-
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
276+
if (Platform.OS.isMac()) {
277277
// on OSX java process writes unexpected message to stderr due to https://bugs.openjdk.java.net/browse/JDK-8022291
278278
// need to wait for the message to fully appear so it can be filtered in #lineAppended above
279279
Thread.sleep(1000L);

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EnvironmentTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.eclipse.debug.core.ILaunchManager;
2525
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
2626
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
27-
import org.eclipse.osgi.service.environment.Constants;
2827

2928
public class EnvironmentTests extends AbstractDebugTest {
3029

@@ -36,8 +35,7 @@ public EnvironmentTests(String name) {
3635
* Tests that we resolve environment variables as case insenitive on Windows.
3736
*/
3837
public void testWinOSCaseInsensitiveVariable() throws Exception {
39-
boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
40-
if (win32) {
38+
if (Platform.OS.isWindows()) {
4139
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
4240
String path1 = manager.performStringSubstitution("${env_var:pAth}");
4341
String path2 = manager.performStringSubstitution("${env_var:PaTh}");
@@ -49,8 +47,7 @@ public void testWinOSCaseInsensitiveVariable() throws Exception {
4947
* Test that we can override a variable in a case insensitive way on Windows
5048
*/
5149
public void testWinOSCaseInsensitiveOverride() throws Exception {
52-
boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
53-
if (win32) {
50+
if (Platform.OS.isWindows()) {
5451
ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
5552
ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "testWinOSCaseInsensitiveOverride");
5653
Map<String, String> override = new HashMap<>();

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/JavaOutputHelpers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class JavaOutputHelpers {
2626
* </pre>
2727
*/
2828
public static boolean isKnownExtraneousOutput(String txt) {
29-
if (!Platform.OS_MACOSX.equals(Platform.getOS())) {
29+
if (!Platform.OS.isMac()) {
3030
return false;
3131
}
3232

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void testExitValueNormal() throws Exception {
6363
* wrapped in an IProcess.
6464
*/
6565
public void testAlreadyTerminatedProcess() throws Exception {
66-
if (Platform.getOS().equals(Platform.OS_LINUX)) {
66+
if (Platform.OS.isLinux()) {
6767
return;
6868
}
6969
Process process = DebugPlugin.exec(new String[]{"java"}, null);

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void testLibraryResolver2() throws Exception {
148148
VMInstallTestsLibraryLocationResolver.isTesting = true;
149149
try {
150150
String filename = "/testfiles/test-jre/bin/test-resolver.ee";
151-
if(Platform.OS_WIN32.equals(Platform.getOS())) {
151+
if (Platform.OS.isWindows()) {
152152
filename = "/testfiles/test-jre/bin/test-resolver-win32.ee";
153153
}
154154
VMStandin vm = getEEStandin(filename);
@@ -195,7 +195,7 @@ public void testLibraryResolver4() throws Exception {
195195
VMInstallTestsLibraryLocationResolver.isTesting = true;
196196
try {
197197
String filename = "/testfiles/test-jre/bin/test-resolver2.ee";
198-
if(Platform.OS_WIN32.equals(Platform.getOS())) {
198+
if (Platform.OS.isWindows()) {
199199
filename = "/testfiles/test-jre/bin/test-resolver-win32-2.ee";
200200
}
201201
VMStandin vm = getEEStandin(filename);

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SyntheticVariableTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void testEvaluateMethodParameter_DeepInTwoNestedClasses() throws Exceptio
9999
}
100100

101101
public void testCompleteMethodParameter_DeepInTwoNestedClasses() throws Exception {
102-
if (Platform.getOS().equals(Platform.OS_MACOSX)) {
102+
if (Platform.OS.isMac()) {
103103
return;
104104
}
105105
addClasses();

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongClassPathTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
*******************************************************************************/
1414
package org.eclipse.jdt.debug.tests.launching;
1515

16-
import static org.hamcrest.CoreMatchers.equalTo;
1716
import static org.junit.Assume.assumeFalse;
18-
import static org.junit.Assume.assumeThat;
1917
import static org.junit.Assume.assumeTrue;
2018

2119
import java.io.File;
@@ -77,7 +75,7 @@ public static Test suite() {
7775
suite.addTest(new LongClassPathTests("testVeryLongClasspathWithClasspathOnlyJar"));
7876
if (JavaProjectHelper.isJava9Compatible()) {
7977
suite.addTest(new LongClassPathTests("testVeryLongClasspathWithArgumentFile"));
80-
} else if (Platform.getOS().equals(Platform.OS_WIN32)) {
78+
} else if (Platform.OS.isWindows()) {
8179
suite.addTest(new LongClassPathTests("testVeryLongClasspathWithEnvironmentVariable"));
8280
}
8381
return suite;
@@ -129,7 +127,7 @@ public void testVeryLongClasspathWithClasspathOnlyJar() throws Exception {
129127
resumeAndExit(thread);
130128

131129
// Then
132-
if (!Platform.getOS().equals(Platform.OS_WIN32)) {
130+
if (!Platform.OS.isWindows()) {
133131
// On windows, temp file deletion may fail
134132
assertFalse(tempFile.exists());
135133
}
@@ -161,7 +159,7 @@ public void testVeryLongClasspathWithArgumentFile() throws Exception {
161159
resumeAndExit(thread);
162160

163161
// Then
164-
if (!Platform.getOS().equals(Platform.OS_WIN32)) {
162+
if (!Platform.OS.isWindows()) {
165163
// On windows, temp file deletion may fail
166164
assertFalse(tempFile.exists());
167165
}
@@ -171,7 +169,7 @@ public void testVeryLongClasspathWithArgumentFile() throws Exception {
171169
* On Windows, for JVM < 9, the CLASSPATH env variable is used if classpath is too long
172170
*/
173171
public void testVeryLongClasspathWithEnvironmentVariable() throws Exception {
174-
assumeThat(Platform.getOS(), equalTo(Platform.OS_WIN32));
172+
assumeTrue("Not on Windows", Platform.OS.isWindows());
175173

176174
// Given
177175
javaProject = createJavaProjectClone("testVeryLongClasspath", CLASSPATH_PROJECT_CONTENT_PATH.toString(), JavaProjectHelper.JAVA_SE_1_6_EE_NAME, true);

0 commit comments

Comments
 (0)