Skip to content

Commit 4118d43

Browse files
committed
feat(core): Evaluate platform checks only once
1 parent 72bf94f commit 4118d43

File tree

1 file changed

+9
-3
lines changed
  • core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/util

1 file changed

+9
-3
lines changed

core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/util/PlatformUtil.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ public class PlatformUtil {
4242

4343
public static final String UNQUALIFIED = "qualifier";
4444

45+
// Delay platform checks by using an inner constants class
46+
private static class OS {
47+
private static final boolean OSX = Platform.OS_MACOSX.equals(Platform.getOS());
48+
private static final boolean WIN11 = System.getProperty("os.name").equals("Windows 11");
49+
}
50+
4551
private PlatformUtil() {
52+
// Prevent instantiation
4653
}
4754

4855
/**
@@ -174,15 +181,14 @@ public static Path toAbsolutePathBundleEntry(Class<?> contextClass, String path)
174181
* @return
175182
*/
176183
public static boolean isOSX() {
177-
return Platform.OS_MACOSX.equals(Platform.getOS());
184+
return OS.OSX;
178185
}
179186

180187
/**
181188
* Returns <code>true</code> if the underlying system is a Windows 11, <code>false</code> otherwise.
182189
* @return
183190
*/
184191
public static boolean isWindows11() {
185-
return System.getProperty("os.name").equals("Windows 11");
192+
return OS.WIN11;
186193
}
187-
188194
}

0 commit comments

Comments
 (0)