From 01c61f987baaa201d1145b0660acada5fd5691e4 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 27 Jun 2022 10:15:57 -0400 Subject: [PATCH] Add SystemUtils.IS_OS_WINDOWS_11. --- src/changes/changes.xml | 1 + .../org/apache/commons/lang3/SystemUtils.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) 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 type attribute can be add,update,fix,remove. Add ExceptionUtils.forEach(Throwable, Consumer<Throwable>). Add ExceptionUtils.stream(Throwable). Add ExceptionUtils.getRootCauseStackTraceList(Throwable). + Add SystemUtils.IS_OS_WINDOWS_11. Bump actions/cache from 2.1.4 to 3.0.4 #742, #752, #764, #833, #867. Bump actions/checkout from 2 to 3 #819, #825, #859. 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 @@ -1610,6 +1610,25 @@ public class SystemUtils { */ public static final boolean IS_OS_WINDOWS_10 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 10"); + /** + *

+ * Is {@code true} if this is Windows 11. + *

+ *

+ * The field will return {@code false} if {@code OS_NAME} is {@code null}. + *

+ *

+ * OpenJDK fixed the return value for {@code os.name} on Windows 11 to versions 8, 11, and 17: + *

+ * + * + * @since 3.13.0 + */ + public static final boolean IS_OS_WINDOWS_11 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 11"); + /** *

* Is {@code true} if this is z/OS.