Add SystemUtils.IS_OS_WINDOWS_11. master
authorGary Gregory <garydgregory@gmail.com>
Mon, 27 Jun 2022 14:15:57 +0000 (10:15 -0400)
committerGary Gregory <garydgregory@gmail.com>
Mon, 27 Jun 2022 14:15:57 +0000 (10:15 -0400)
src/changes/changes.xml
src/main/java/org/apache/commons/lang3/SystemUtils.java

index 0946e7e6834ebc900ef1cfacf7c660436a71c307..4dcfedc183714df05674065b622c242553d040e5 100644 (file)
@@ -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>
index a3e936409442e4ae919a80c26bacbf873313db28..7ba80be87029a80d6158ccde77f2585ca628cbcb 100644 (file)
@@ -1610,6 +1610,25 @@ public class SystemUtils {
      */
     public static final boolean IS_OS_WINDOWS_10 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 10");
 
+    /**
+     * <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.