Skip to content

Commit

Permalink
Add SystemUtils.IS_OS_MAC_OSX_SEQUOIA
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Nov 17, 2024
1 parent 992b190 commit 010c5d2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add IntStrams.of(int...).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ArrayUtils.containsAny(int[], int...).</action>
<action type="add" dev="ggregory" due-to="asgh, Gary Gregory">Add CalendarUtils.toLocalDate() #725.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_OS_MAC_OSX_SEQUOIA.</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.apache.commons:commons-parent from 73 to 78 #1267, #1277, #1283, #1288, #1302.</action>
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.codehaus.mojo:taglist-maven-plugin from 3.1.0 to 3.2.1 #1300.</action>
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/apache/commons/lang3/SystemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,22 @@ public class SystemUtils {
*/
public static final boolean IS_OS_MAC_OSX_SONOMA = getOsMatches("Mac OS X", "14");

/**
* The constant {@code true} if this is macOS X Sequoia.
* <p>
* The value depends on the value of the {@link #OS_NAME} and {@link #OS_VERSION} constants.
* </p>
* <p>
* The value is {@code false} if {@link #OS_NAME} or {@link #OS_VERSION} is {@code null}.
* </p>
* <p>
* This value is initialized when the class is loaded.
* </p>
*
* @since 3.18.0
*/
public static final boolean IS_OS_MAC_OSX_SEQUOIA = getOsMatches("Mac OS X", "15");

/**
* The constant {@code true} if this is FreeBSD.
* <p>
Expand Down
30 changes: 24 additions & 6 deletions src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,30 @@ public void test_IS_OS() {
assertTrue(SystemUtils.IS_OS_UNIX);
assertFalse(SystemUtils.IS_OS_ANDROID);
assertFalse(SystemUtils.IS_OS_WINDOWS);
final boolean macOsValues[] = { SystemUtils.IS_OS_MAC_OSX_BIG_SUR, SystemUtils.IS_OS_MAC_OSX_CATALINA, SystemUtils.IS_OS_MAC_OSX_CHEETAH,
SystemUtils.IS_OS_MAC_OSX_EL_CAPITAN, SystemUtils.IS_OS_MAC_OSX_HIGH_SIERRA, SystemUtils.IS_OS_MAC_OSX_JAGUAR,
SystemUtils.IS_OS_MAC_OSX_LEOPARD, SystemUtils.IS_OS_MAC_OSX_LION, SystemUtils.IS_OS_MAC_OSX_MAVERICKS, SystemUtils.IS_OS_MAC_OSX_MOJAVE,
SystemUtils.IS_OS_MAC_OSX_MONTEREY, SystemUtils.IS_OS_MAC_OSX_MOUNTAIN_LION, SystemUtils.IS_OS_MAC_OSX_PANTHER,
SystemUtils.IS_OS_MAC_OSX_PUMA, SystemUtils.IS_OS_MAC_OSX_SIERRA, SystemUtils.IS_OS_MAC_OSX_SNOW_LEOPARD, SystemUtils.IS_OS_MAC_OSX_SONOMA,
SystemUtils.IS_OS_MAC_OSX_TIGER, SystemUtils.IS_OS_MAC_OSX_VENTURA, SystemUtils.IS_OS_MAC_OSX_YOSEMITE };
// @formatter:off
final boolean macOsValues[] = {
SystemUtils.IS_OS_MAC_OSX_BIG_SUR,
SystemUtils.IS_OS_MAC_OSX_CATALINA,
SystemUtils.IS_OS_MAC_OSX_CHEETAH,
SystemUtils.IS_OS_MAC_OSX_EL_CAPITAN,
SystemUtils.IS_OS_MAC_OSX_HIGH_SIERRA,
SystemUtils.IS_OS_MAC_OSX_JAGUAR,
SystemUtils.IS_OS_MAC_OSX_LEOPARD,
SystemUtils.IS_OS_MAC_OSX_LION,
SystemUtils.IS_OS_MAC_OSX_MAVERICKS,
SystemUtils.IS_OS_MAC_OSX_MOJAVE,
SystemUtils.IS_OS_MAC_OSX_MONTEREY,
SystemUtils.IS_OS_MAC_OSX_MOUNTAIN_LION,
SystemUtils.IS_OS_MAC_OSX_PANTHER,
SystemUtils.IS_OS_MAC_OSX_PUMA,
SystemUtils.IS_OS_MAC_OSX_SEQUOIA,
SystemUtils.IS_OS_MAC_OSX_SIERRA,
SystemUtils.IS_OS_MAC_OSX_SNOW_LEOPARD,
SystemUtils.IS_OS_MAC_OSX_SONOMA,
SystemUtils.IS_OS_MAC_OSX_TIGER,
SystemUtils.IS_OS_MAC_OSX_VENTURA,
SystemUtils.IS_OS_MAC_OSX_YOSEMITE };
// @formatter:on
if (BooleanUtils.or(macOsValues)) {
// If one is true, then only one should be true.
assertTrue(BooleanUtils.xor(macOsValues));
Expand Down

0 comments on commit 010c5d2

Please sign in to comment.