Add SystemUtils.IS_JAVA_20
This commit is contained in:
parent
18e772ca54
commit
fee35ddc14
|
@ -178,6 +178,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
<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>
|
||||
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_JAVA_19.</action>
|
||||
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_JAVA_20.</action>
|
||||
<action issue="LANG-1627" type="add" dev="ggregory" due-to="Alberto Scotto, Avijit Chakraborty, Steve Bosman, Bruno P. Kinoshita, Gary Gregory">Add ArrayUtils.oneHot().</action>
|
||||
<action issue="LANG-1662" type="add" dev="ggregory" due-to="Daniel Augusto Veronezi Salvador, Gary Gregory, Bruno P. Kinoshita">Let ReflectionToStringBuilder only reflect given field names #849.</action>
|
||||
<action type="add" dev="ggregory" due-to="Gary Gregory">Add Streams.of(Enumeration<E>).</action>
|
||||
|
|
|
@ -1084,6 +1084,19 @@ public class SystemUtils {
|
|||
*/
|
||||
public static final boolean IS_JAVA_19 = getJavaVersionMatches("19");
|
||||
|
||||
/**
|
||||
* Is {@code true} if this is Java version 20 (also 20.x versions).
|
||||
* <p>
|
||||
* The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
|
||||
* </p>
|
||||
* <p>
|
||||
* This value is initialized when the class is loaded.
|
||||
* </p>
|
||||
*
|
||||
* @since 3.13.0
|
||||
*/
|
||||
public static final boolean IS_JAVA_20 = getJavaVersionMatches("20");
|
||||
|
||||
// Operating system checks
|
||||
// -----------------------------------------------------------------------
|
||||
// These MUST be declared after those above as they depend on the
|
||||
|
|
|
@ -77,6 +77,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("1.8")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -98,6 +99,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("9")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -119,6 +121,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("10")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -140,6 +143,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("11")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -161,6 +165,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("12")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -182,6 +187,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("13")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -203,6 +209,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("14")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -224,6 +231,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("15")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -245,6 +253,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("16")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -266,6 +275,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("17")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -287,6 +297,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertTrue(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("18")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -308,6 +319,7 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertTrue(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("19")) {
|
||||
assertFalse(SystemUtils.IS_JAVA_1_1);
|
||||
assertFalse(SystemUtils.IS_JAVA_1_2);
|
||||
|
@ -329,6 +341,29 @@ public class SystemUtilsTest extends AbstractLangTest {
|
|||
assertFalse(SystemUtils.IS_JAVA_17);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertTrue(SystemUtils.IS_JAVA_19);
|
||||
assertFalse(SystemUtils.IS_JAVA_20);
|
||||
} else if (javaVersion.startsWith("20")) {
|
||||
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);
|
||||
assertFalse(SystemUtils.IS_JAVA_18);
|
||||
assertFalse(SystemUtils.IS_JAVA_19);
|
||||
assertTrue(SystemUtils.IS_JAVA_20);
|
||||
} else {
|
||||
System.out.println("Can't test IS_JAVA value: " + javaVersion);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue