Skip to content

Commit 010c5d2

Browse files
committed
Add SystemUtils.IS_OS_MAC_OSX_SEQUOIA
1 parent 992b190 commit 010c5d2

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The <action> type attribute can be add,update,fix,remove.
7575
<action type="add" dev="ggregory" due-to="Gary Gregory">Add IntStrams.of(int...).</action>
7676
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ArrayUtils.containsAny(int[], int...).</action>
7777
<action type="add" dev="ggregory" due-to="asgh, Gary Gregory">Add CalendarUtils.toLocalDate() #725.</action>
78+
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_OS_MAC_OSX_SEQUOIA.</action>
7879
<!-- UPDATE -->
7980
<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>
8081
<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>

src/main/java/org/apache/commons/lang3/SystemUtils.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,22 @@ public class SystemUtils {
15591559
*/
15601560
public static final boolean IS_OS_MAC_OSX_SONOMA = getOsMatches("Mac OS X", "14");
15611561

1562+
/**
1563+
* The constant {@code true} if this is macOS X Sequoia.
1564+
* <p>
1565+
* The value depends on the value of the {@link #OS_NAME} and {@link #OS_VERSION} constants.
1566+
* </p>
1567+
* <p>
1568+
* The value is {@code false} if {@link #OS_NAME} or {@link #OS_VERSION} is {@code null}.
1569+
* </p>
1570+
* <p>
1571+
* This value is initialized when the class is loaded.
1572+
* </p>
1573+
*
1574+
* @since 3.18.0
1575+
*/
1576+
public static final boolean IS_OS_MAC_OSX_SEQUOIA = getOsMatches("Mac OS X", "15");
1577+
15621578
/**
15631579
* The constant {@code true} if this is FreeBSD.
15641580
* <p>

src/test/java/org/apache/commons/lang3/SystemUtilsTest.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,30 @@ public void test_IS_OS() {
169169
assertTrue(SystemUtils.IS_OS_UNIX);
170170
assertFalse(SystemUtils.IS_OS_ANDROID);
171171
assertFalse(SystemUtils.IS_OS_WINDOWS);
172-
final boolean macOsValues[] = { SystemUtils.IS_OS_MAC_OSX_BIG_SUR, SystemUtils.IS_OS_MAC_OSX_CATALINA, SystemUtils.IS_OS_MAC_OSX_CHEETAH,
173-
SystemUtils.IS_OS_MAC_OSX_EL_CAPITAN, SystemUtils.IS_OS_MAC_OSX_HIGH_SIERRA, SystemUtils.IS_OS_MAC_OSX_JAGUAR,
174-
SystemUtils.IS_OS_MAC_OSX_LEOPARD, SystemUtils.IS_OS_MAC_OSX_LION, SystemUtils.IS_OS_MAC_OSX_MAVERICKS, SystemUtils.IS_OS_MAC_OSX_MOJAVE,
175-
SystemUtils.IS_OS_MAC_OSX_MONTEREY, SystemUtils.IS_OS_MAC_OSX_MOUNTAIN_LION, SystemUtils.IS_OS_MAC_OSX_PANTHER,
176-
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,
177-
SystemUtils.IS_OS_MAC_OSX_TIGER, SystemUtils.IS_OS_MAC_OSX_VENTURA, SystemUtils.IS_OS_MAC_OSX_YOSEMITE };
172+
// @formatter:off
173+
final boolean macOsValues[] = {
174+
SystemUtils.IS_OS_MAC_OSX_BIG_SUR,
175+
SystemUtils.IS_OS_MAC_OSX_CATALINA,
176+
SystemUtils.IS_OS_MAC_OSX_CHEETAH,
177+
SystemUtils.IS_OS_MAC_OSX_EL_CAPITAN,
178+
SystemUtils.IS_OS_MAC_OSX_HIGH_SIERRA,
179+
SystemUtils.IS_OS_MAC_OSX_JAGUAR,
180+
SystemUtils.IS_OS_MAC_OSX_LEOPARD,
181+
SystemUtils.IS_OS_MAC_OSX_LION,
182+
SystemUtils.IS_OS_MAC_OSX_MAVERICKS,
183+
SystemUtils.IS_OS_MAC_OSX_MOJAVE,
184+
SystemUtils.IS_OS_MAC_OSX_MONTEREY,
185+
SystemUtils.IS_OS_MAC_OSX_MOUNTAIN_LION,
186+
SystemUtils.IS_OS_MAC_OSX_PANTHER,
187+
SystemUtils.IS_OS_MAC_OSX_PUMA,
188+
SystemUtils.IS_OS_MAC_OSX_SEQUOIA,
189+
SystemUtils.IS_OS_MAC_OSX_SIERRA,
190+
SystemUtils.IS_OS_MAC_OSX_SNOW_LEOPARD,
191+
SystemUtils.IS_OS_MAC_OSX_SONOMA,
192+
SystemUtils.IS_OS_MAC_OSX_TIGER,
193+
SystemUtils.IS_OS_MAC_OSX_VENTURA,
194+
SystemUtils.IS_OS_MAC_OSX_YOSEMITE };
195+
// @formatter:on
178196
if (BooleanUtils.or(macOsValues)) {
179197
// If one is true, then only one should be true.
180198
assertTrue(BooleanUtils.xor(macOsValues));

0 commit comments

Comments
 (0)