diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 8662fbe77..20d1e45ef 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -119,6 +119,7 @@ The type attribute can be add,update,fix,remove. Add Processor.Type.AARCH_64. Add Processor.isAarch64(). Update ArchUtils.getProcessor(String) for "aarch64". + Add JavaVersion.JAVA_18. Bump spotbugs-maven-plugin from 4.2.0 to 4.5.0.0 #735, #808, #822, #834. Bump actions/cache from v2.1.4 to v2.1.7 #742, #752, #764, #833. diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java index 61665125d..9e8908f72 100644 --- a/src/main/java/org/apache/commons/lang3/JavaVersion.java +++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java @@ -143,6 +143,13 @@ public enum JavaVersion { */ JAVA_17(17.0f, "17"), + /** + * Java 18. + * + * @since 3.13.0 + */ + JAVA_18(18.0f, "18"), + /** * The most recent java version. Mainly introduced to avoid to break when a new version of Java is used. */ @@ -260,6 +267,8 @@ public enum JavaVersion { return JAVA_16; case "17": return JAVA_17; + case "18": + return JAVA_18; default: final float v = toFloatVersion(versionStr); if ((v - 1.) < 1.) { // then we need to check decimals > .9 diff --git a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java index 554987572..b8f6b4069 100644 --- a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java +++ b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java @@ -27,6 +27,7 @@ import static org.apache.commons.lang3.JavaVersion.JAVA_14; import static org.apache.commons.lang3.JavaVersion.JAVA_15; import static org.apache.commons.lang3.JavaVersion.JAVA_16; import static org.apache.commons.lang3.JavaVersion.JAVA_17; +import static org.apache.commons.lang3.JavaVersion.JAVA_18; import static org.apache.commons.lang3.JavaVersion.JAVA_1_1; import static org.apache.commons.lang3.JavaVersion.JAVA_1_2; import static org.apache.commons.lang3.JavaVersion.JAVA_1_3; @@ -70,10 +71,11 @@ public class JavaVersionTest { assertEquals(JAVA_15, get("15"), "15 failed"); assertEquals(JAVA_16, get("16"), "16 failed"); assertEquals(JAVA_17, get("17"), "17 failed"); + assertEquals(JAVA_18, get("18"), "18 failed"); assertEquals(JAVA_RECENT, get("1.10"), "1.10 failed"); // assertNull("2.10 unexpectedly worked", get("2.10")); assertEquals(get("1.5"), getJavaVersion("1.5"), "Wrapper method failed"); - assertEquals(JAVA_RECENT, get("18"), "Unhandled"); // LANG-1384 + assertEquals(JAVA_RECENT, get("19"), "Unhandled"); // LANG-1384 } @Test