This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 010c5d26330c4e381e5a598fed700241667ad532 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Nov 17 09:03:51 2024 -0500 Add SystemUtils.IS_OS_MAC_OSX_SEQUOIA --- src/changes/changes.xml | 1 + .../java/org/apache/commons/lang3/SystemUtils.java | 16 ++++++++++++ .../org/apache/commons/lang3/SystemUtilsTest.java | 30 +++++++++++++++++----- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9aa435655..6b3f56358 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -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> diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java index bece441e2..8d26d67fd 100644 --- a/src/main/java/org/apache/commons/lang3/SystemUtils.java +++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java @@ -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> diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java index fa12ffab3..b8b0948ea 100644 --- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java @@ -169,12 +169,30 @@ public class SystemUtilsTest extends AbstractLangTest { 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));