aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Gregory <garydgregory@gmail.com>2022-06-27 10:15:57 -0400
committerGary Gregory <garydgregory@gmail.com>2022-06-27 10:15:57 -0400
commit01c61f987baaa201d1145b0660acada5fd5691e4 (patch)
treefe39eeb214db2acb6e9e38ae9a19d0c003583dd0
parent1bad88dbc3c18e5a430a087162e7a80cd446d5d7 (diff)
downloadapache-commons-lang-01c61f987baaa201d1145b0660acada5fd5691e4.tar.gz
Add SystemUtils.IS_OS_WINDOWS_11.
-rw-r--r--src/changes/changes.xml1
-rw-r--r--src/main/java/org/apache/commons/lang3/SystemUtils.java19
2 files changed, 20 insertions, 0 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0946e7e68..4dcfedc18 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -150,6 +150,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ExceptionUtils.forEach(Throwable, Consumer&lt;Throwable&gt;).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ExceptionUtils.stream(Throwable).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ExceptionUtils.getRootCauseStackTraceList(Throwable).</action>
+ <action type="add" dev="ggregory" due-to="Will Herrmann, Gary Gregory, Roland Kreuzer">Add SystemUtils.IS_OS_WINDOWS_11.</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot, XenoAmess, Gary Gregory">Bump actions/cache from 2.1.4 to 3.0.4 #742, #752, #764, #833, #867.</action>
<action type="update" dev="ggregory" due-to="Dependabot">Bump actions/checkout from 2 to 3 #819, #825, #859.</action>
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index a3e936409..7ba80be87 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1612,6 +1612,25 @@ public class SystemUtils {
/**
* <p>
+ * Is {@code true} if this is Windows 11.
+ * </p>
+ * <p>
+ * The field will return {@code false} if {@code OS_NAME} is {@code null}.
+ * </p>
+ * <p>
+ * OpenJDK fixed the return value for {@code os.name} on Windows 11 to versions 8, 11, and 17:
+ * </p>
+ * <ul>
+ * <li>Affects Java versions 7u321, 8u311, 11.0.13-oracle, 17.0.1: https://bugs.openjdk.org/browse/JDK-8274737</li>
+ * <li>Fixed in OpenJDK commit https://github.com/openjdk/jdk/commit/97ea9dd2f24f9f1fb9b9345a4202a825ee28e014</li>
+ * </ul>
+ *
+ * @since 3.13.0
+ */
+ public static final boolean IS_OS_WINDOWS_11 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 11");
+
+ /**
+ * <p>
* Is {@code true} if this is z/OS.
* </p>
* <p>