Add JavaVersion.JAVA_17 now that Java 17-ea is out.

This commit is contained in:
Gary Gregory 2021-01-01 13:44:01 -05:00
parent a36b59c6f8
commit 876543f6cc
3 changed files with 21 additions and 9 deletions

View File

@ -84,6 +84,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add fluent-style ArraySorter.</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add fluent-style ArraySorter.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add and use LocaleUtils.toLocale(Locale) to avoid NPEs.</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add and use LocaleUtils.toLocale(Locale) to avoid NPEs.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add FailableShortSupplier, handy for JDBC APIs.</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add FailableShortSupplier, handy for JDBC APIs.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add JavaVersion.JAVA_17.</action>
<!-- UPDATES --> <!-- UPDATES -->
<action type="update" dev="ggregory" due-to="Gary Gregory">Enable Dependabot #587.</action> <action type="update" dev="ggregory" due-to="Gary Gregory">Enable Dependabot #587.</action>
<action type="update" dev="chtompki">Bump junit-jupiter from 5.6.2 to 5.7.0.</action> <action type="update" dev="chtompki">Bump junit-jupiter from 5.6.2 to 5.7.0.</action>

View File

@ -81,61 +81,68 @@ public enum JavaVersion {
JAVA_1_9(9.0f, "9"), JAVA_1_9(9.0f, "9"),
/** /**
* Java 9 * Java 9.
* *
* @since 3.5 * @since 3.5
*/ */
JAVA_9(9.0f, "9"), JAVA_9(9.0f, "9"),
/** /**
* Java 10 * Java 10.
* *
* @since 3.7 * @since 3.7
*/ */
JAVA_10(10.0f, "10"), JAVA_10(10.0f, "10"),
/** /**
* Java 11 * Java 11.
* *
* @since 3.8 * @since 3.8
*/ */
JAVA_11(11.0f, "11"), JAVA_11(11.0f, "11"),
/** /**
* Java 12 * Java 12.
* *
* @since 3.9 * @since 3.9
*/ */
JAVA_12(12.0f, "12"), JAVA_12(12.0f, "12"),
/** /**
* Java 13 * Java 13.
* *
* @since 3.9 * @since 3.9
*/ */
JAVA_13(13.0f, "13"), JAVA_13(13.0f, "13"),
/** /**
* Java 14 * Java 14.
* *
* @since 3.11 * @since 3.11
*/ */
JAVA_14(14.0f, "14"), JAVA_14(14.0f, "14"),
/** /**
* Java 15 * Java 15.
* *
* @since 3.11 * @since 3.11
*/ */
JAVA_15(15.0f, "15"), JAVA_15(15.0f, "15"),
/** /**
* Java 16 * Java 16.
* *
* @since 3.11 * @since 3.11
*/ */
JAVA_16(16.0f, "16"), 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. * 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; return JAVA_15;
} else if ("16".equals(nom)) { } else if ("16".equals(nom)) {
return JAVA_16; return JAVA_16;
} else if ("17".equals(nom)) {
return JAVA_17;
} }
final float v = toFloatVersion(nom); final float v = toFloatVersion(nom);
if ((v - 1.) < 1.) { // then we need to check decimals > .9 if ((v - 1.) < 1.) { // then we need to check decimals > .9

View File

@ -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_14;
import static org.apache.commons.lang3.JavaVersion.JAVA_15; 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_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_1;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_2; import static org.apache.commons.lang3.JavaVersion.JAVA_1_2;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_3; 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_14, get("14"), "14 failed");
assertEquals(JAVA_15, get("15"), "15 failed"); assertEquals(JAVA_15, get("15"), "15 failed");
assertEquals(JAVA_16, get("16"), "16 failed"); assertEquals(JAVA_16, get("16"), "16 failed");
assertEquals(JAVA_17, get("17"), "17 failed");
assertEquals(JAVA_RECENT, get("1.10"), "1.10 failed"); assertEquals(JAVA_RECENT, get("1.10"), "1.10 failed");
// assertNull("2.10 unexpectedly worked", get("2.10")); // assertNull("2.10 unexpectedly worked", get("2.10"));
assertEquals(get("1.5"), getJavaVersion("1.5"), "Wrapper method failed"); 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 @Test