Add SystemUtils.IS_JAVA_16.
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ea9ea39..ae1ea41 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -81,6 +81,7 @@
<action type="add" dev="ggregory" due-to="Gary Gregory">Add UncheckedTimeoutException.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add UncheckedInterruptedException.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add TimeZones.GMT.</action>
+ <action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_JAVA_16.</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump spotbugs-maven-plugin from 4.2.0 to 4.2.3 #735.</action>
<action type="update" dev="ggregory" due-to="Dependabot, XenoAmess">Bump Bump actions/cache from v2.1.4 to v2.1.6 #742, #752, #764.</action>
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 2a92a8d..5e4a9c1 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1050,6 +1050,16 @@
*/
public static final boolean IS_JAVA_15 = getJavaVersionMatches("15");
+ /**
+ * Is {@code true} if this is Java version 16 (also 16.x versions).
+ * <p>
+ * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
+ * </p>
+ *
+ * @since 3.13.0
+ */
+ public static final boolean IS_JAVA_16 = getJavaVersionMatches("16");
+
// Operating system checks
// -----------------------------------------------------------------------
// These MUST be declared after those above as they depend on the
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index eea7ae0..3c4ca25 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -73,6 +73,7 @@
assertFalse(SystemUtils.IS_JAVA_13);
assertFalse(SystemUtils.IS_JAVA_14);
assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("1.8")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -90,6 +91,7 @@
assertFalse(SystemUtils.IS_JAVA_13);
assertFalse(SystemUtils.IS_JAVA_14);
assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("9")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -107,6 +109,7 @@
assertFalse(SystemUtils.IS_JAVA_13);
assertFalse(SystemUtils.IS_JAVA_14);
assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("10")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -124,6 +127,7 @@
assertFalse(SystemUtils.IS_JAVA_13);
assertFalse(SystemUtils.IS_JAVA_14);
assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("11")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -141,6 +145,7 @@
assertFalse(SystemUtils.IS_JAVA_13);
assertFalse(SystemUtils.IS_JAVA_14);
assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("12")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -156,6 +161,9 @@
assertFalse(SystemUtils.IS_JAVA_11);
assertTrue(SystemUtils.IS_JAVA_12);
assertFalse(SystemUtils.IS_JAVA_13);
+ assertFalse(SystemUtils.IS_JAVA_14);
+ assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("13")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -173,6 +181,7 @@
assertTrue(SystemUtils.IS_JAVA_13);
assertFalse(SystemUtils.IS_JAVA_14);
assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("14")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -190,6 +199,7 @@
assertFalse(SystemUtils.IS_JAVA_13);
assertTrue(SystemUtils.IS_JAVA_14);
assertFalse(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
} else if (javaVersion.startsWith("15")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -207,6 +217,25 @@
assertFalse(SystemUtils.IS_JAVA_13);
assertFalse(SystemUtils.IS_JAVA_14);
assertTrue(SystemUtils.IS_JAVA_15);
+ assertFalse(SystemUtils.IS_JAVA_16);
+ } else if (javaVersion.startsWith("16")) {
+ assertFalse(SystemUtils.IS_JAVA_1_1);
+ assertFalse(SystemUtils.IS_JAVA_1_2);
+ assertFalse(SystemUtils.IS_JAVA_1_3);
+ assertFalse(SystemUtils.IS_JAVA_1_4);
+ assertFalse(SystemUtils.IS_JAVA_1_5);
+ assertFalse(SystemUtils.IS_JAVA_1_6);
+ assertFalse(SystemUtils.IS_JAVA_1_7);
+ assertFalse(SystemUtils.IS_JAVA_1_8);
+ assertFalse(SystemUtils.IS_JAVA_1_9);
+ assertFalse(SystemUtils.IS_JAVA_9);
+ assertFalse(SystemUtils.IS_JAVA_10);
+ assertFalse(SystemUtils.IS_JAVA_11);
+ assertFalse(SystemUtils.IS_JAVA_12);
+ assertFalse(SystemUtils.IS_JAVA_13);
+ assertFalse(SystemUtils.IS_JAVA_14);
+ assertFalse(SystemUtils.IS_JAVA_15);
+ assertTrue(SystemUtils.IS_JAVA_16);
} else {
System.out.println("Can't test IS_JAVA value: " + javaVersion);
}