You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/04/01 15:53:27 UTC

[commons-lang] branch master updated (944d6e10a -> fee35ddc1)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


    from 944d6e10a Refactor and add RegExUtils.dotAll() and dotAllMatcher()
     new 18e772ca5 Add SystemUtils.IS_JAVA_19
     new fee35ddc1 Add SystemUtils.IS_JAVA_20

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                            |  2 +
 .../java/org/apache/commons/lang3/SystemUtils.java | 26 +++++++++
 .../org/apache/commons/lang3/SystemUtilsTest.java  | 68 ++++++++++++++++++++++
 3 files changed, 96 insertions(+)


[commons-lang] 02/02: Add SystemUtils.IS_JAVA_20

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit fee35ddc141a65a4956290864598e825214c4cff
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Apr 1 11:53:21 2023 -0400

    Add SystemUtils.IS_JAVA_20
---
 src/changes/changes.xml                            |  1 +
 .../java/org/apache/commons/lang3/SystemUtils.java | 13 ++++++++
 .../org/apache/commons/lang3/SystemUtilsTest.java  | 35 ++++++++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 421e44b2c..a94d53885 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -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&lt;E&gt;).</action>
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 95d936ec0..fb945b59c 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -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
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index f62379c3e..f903682de 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -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);
         }


[commons-lang] 01/02: Add SystemUtils.IS_JAVA_19

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 18e772ca54dda9eee10b15b235b5b4710d232777
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Apr 1 11:48:25 2023 -0400

    Add SystemUtils.IS_JAVA_19
---
 src/changes/changes.xml                            |  1 +
 .../java/org/apache/commons/lang3/SystemUtils.java | 13 +++++++++
 .../org/apache/commons/lang3/SystemUtilsTest.java  | 33 ++++++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4e7c2ea42..421e44b2c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -177,6 +177,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_JAVA_16.</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>
+    <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_JAVA_19.</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&lt;E&gt;).</action>
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 85a2bb443..95d936ec0 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1071,6 +1071,19 @@ public class SystemUtils {
      */
     public static final boolean IS_JAVA_18 = getJavaVersionMatches("18");
 
+    /**
+     * Is {@code true} if this is Java version 19 (also 19.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_19 = getJavaVersionMatches("19");
+
     // 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 753de4dab..f62379c3e 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -76,6 +76,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("1.8")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -96,6 +97,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("9")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -116,6 +118,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("10")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -136,6 +139,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("11")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -156,6 +160,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("12")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -176,6 +181,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("13")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -196,6 +202,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("14")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -216,6 +223,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("15")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -236,6 +244,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("16")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -256,6 +265,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertTrue(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("17")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -276,6 +286,7 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertTrue(SystemUtils.IS_JAVA_17);
             assertFalse(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
         } else if (javaVersion.startsWith("18")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -296,6 +307,28 @@ public class SystemUtilsTest extends AbstractLangTest {
             assertFalse(SystemUtils.IS_JAVA_16);
             assertFalse(SystemUtils.IS_JAVA_17);
             assertTrue(SystemUtils.IS_JAVA_18);
+            assertFalse(SystemUtils.IS_JAVA_19);
+        } else if (javaVersion.startsWith("19")) {
+            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);
+            assertTrue(SystemUtils.IS_JAVA_19);
         } else {
             System.out.println("Can't test IS_JAVA value: " + javaVersion);
         }