diff --git a/src/changes/changes.xml b/src/changes/changes.xml index e85666bce..a5229b567 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -84,6 +84,7 @@ The type attribute can be add,update,fix,remove. Add fluent-style ArraySorter. Add and use LocaleUtils.toLocale(Locale) to avoid NPEs. Add FailableShortSupplier, handy for JDBC APIs. + Add JavaVersion.JAVA_17. Enable Dependabot #587. Bump junit-jupiter from 5.6.2 to 5.7.0. diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java index b882e8ce7..0837a3917 100644 --- a/src/main/java/org/apache/commons/lang3/JavaVersion.java +++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java @@ -81,61 +81,68 @@ public enum JavaVersion { JAVA_1_9(9.0f, "9"), /** - * Java 9 + * Java 9. * * @since 3.5 */ JAVA_9(9.0f, "9"), /** - * Java 10 + * Java 10. * * @since 3.7 */ JAVA_10(10.0f, "10"), /** - * Java 11 + * Java 11. * * @since 3.8 */ JAVA_11(11.0f, "11"), /** - * Java 12 + * Java 12. * * @since 3.9 */ JAVA_12(12.0f, "12"), /** - * Java 13 + * Java 13. * * @since 3.9 */ JAVA_13(13.0f, "13"), /** - * Java 14 + * Java 14. * * @since 3.11 */ JAVA_14(14.0f, "14"), /** - * Java 15 + * Java 15. * * @since 3.11 */ JAVA_15(15.0f, "15"), /** - * Java 16 + * Java 16. * * @since 3.11 */ JAVA_16(16.0f, "16"), + /** + * Java 17. + * + * @since 3.12 + */ + JAVA_17(17.0f, "17"), + /** * The most recent java version. Mainly introduced to avoid to break when a new version of Java is used. */ @@ -251,6 +258,8 @@ public enum JavaVersion { return JAVA_15; } else if ("16".equals(nom)) { return JAVA_16; + } else if ("17".equals(nom)) { + return JAVA_17; } final float v = toFloatVersion(nom); 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 4db4bfde8..554987572 100644 --- a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java +++ b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java @@ -26,6 +26,7 @@ import static org.apache.commons.lang3.JavaVersion.JAVA_13; 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_1_1; import static org.apache.commons.lang3.JavaVersion.JAVA_1_2; import static org.apache.commons.lang3.JavaVersion.JAVA_1_3; @@ -68,10 +69,11 @@ public class JavaVersionTest { assertEquals(JAVA_14, get("14"), "14 failed"); assertEquals(JAVA_15, get("15"), "15 failed"); assertEquals(JAVA_16, get("16"), "16 failed"); + assertEquals(JAVA_17, get("17"), "17 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("17"), "Unhandled"); // LANG-1384 + assertEquals(JAVA_RECENT, get("18"), "Unhandled"); // LANG-1384 } @Test