Skip to content

Commit 01c61f9

Browse files
committed
Add SystemUtils.IS_OS_WINDOWS_11.
1 parent 1bad88d commit 01c61f9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/changes/changes.xml

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ The <action> type attribute can be add,update,fix,remove.
150150
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ExceptionUtils.forEach(Throwable, Consumer&lt;Throwable&gt;).</action>
151151
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ExceptionUtils.stream(Throwable).</action>
152152
<action type="add" dev="ggregory" due-to="Gary Gregory">Add ExceptionUtils.getRootCauseStackTraceList(Throwable).</action>
153+
<action type="add" dev="ggregory" due-to="Will Herrmann, Gary Gregory, Roland Kreuzer">Add SystemUtils.IS_OS_WINDOWS_11.</action>
153154
<!-- UPDATE -->
154155
<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>
155156
<action type="update" dev="ggregory" due-to="Dependabot">Bump actions/checkout from 2 to 3 #819, #825, #859.</action>

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

+19
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,25 @@ public class SystemUtils {
16101610
*/
16111611
public static final boolean IS_OS_WINDOWS_10 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 10");
16121612

1613+
/**
1614+
* <p>
1615+
* Is {@code true} if this is Windows 11.
1616+
* </p>
1617+
* <p>
1618+
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
1619+
* </p>
1620+
* <p>
1621+
* OpenJDK fixed the return value for {@code os.name} on Windows 11 to versions 8, 11, and 17:
1622+
* </p>
1623+
* <ul>
1624+
* <li>Affects Java versions 7u321, 8u311, 11.0.13-oracle, 17.0.1: https://bugs.openjdk.org/browse/JDK-8274737</li>
1625+
* <li>Fixed in OpenJDK commit https://github.com/openjdk/jdk/commit/97ea9dd2f24f9f1fb9b9345a4202a825ee28e014</li>
1626+
* </ul>
1627+
*
1628+
* @since 3.13.0
1629+
*/
1630+
public static final boolean IS_OS_WINDOWS_11 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 11");
1631+
16131632
/**
16141633
* <p>
16151634
* Is {@code true} if this is z/OS.

0 commit comments

Comments
 (0)