Add SystemUtils.IS_JAVA_18
This commit is contained in:
parent
6001ae8a0c
commit
e5e8ba0906
|
@ -153,6 +153,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
<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>
|
||||
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_JAVA_17.</action>
|
||||
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_JAVA_18.</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>
|
||||
|
|
|
@ -1070,6 +1070,16 @@ public class SystemUtils {
|
|||
*/
|
||||
public static final boolean IS_JAVA_17 = getJavaVersionMatches("17");
|
||||
|
||||
/**
|
||||
* Is {@code true} if this is Java version 18 (also 18.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_18 = getJavaVersionMatches("18");
|
||||
|
||||
// Operating system checks
|
||||
// -----------------------------------------------------------------------
|
||||
// These MUST be declared after those above as they depend on the
|
||||
|
|
|
@ -75,6 +75,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("1.8")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -94,6 +95,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("9")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -113,6 +115,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("10")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -132,6 +135,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("11")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -151,6 +155,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("12")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -170,6 +175,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("13")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -189,6 +195,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("14")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -208,6 +215,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("15")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -227,6 +235,7 @@ public class SystemUtilsTest {
|
|||
assertTrue(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("16")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -246,6 +255,7 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertTrue(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("17")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -265,6 +275,27 @@ public class SystemUtilsTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_15);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertTrue(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
} else if (javaVersion.startsWith("18")) {
|
||||
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);
|
||||
assertFalse(SystemUtils.IS_JAVA_16);
|
||||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertTrue(SystemUtils.IS_JAVA_18);
|
||||
} else {
|
||||
System.out.println("Can't test IS_JAVA value: " + javaVersion);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue