Add JavaVersion enum constants for Java 16.

Tested with:
openjdk version "16-ea" 2021-03-16
OpenJDK Runtime Environment (build 16-ea+2-35)
OpenJDK 64-Bit Server VM (build 16-ea+2-35, mixed mode, sharing)
This commit is contained in:
Gary Gregory 2020-06-24 10:53:55 -04:00
parent c10c62ed73
commit 05803b0d58
3 changed files with 13 additions and 1 deletions

View File

@ -76,6 +76,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1558" type="update" dev="ggregory" due-to="XenoAmess">Simplify if as some conditions are covered by others #543.</action>
<action issue="LANG-1528" type="fix" dev="ggregory" due-to="Edwin Delgado H">StringUtils.replaceEachRepeatedly gives IllegalStateException #505.</action>
<action issue="LANG-1570" type="add" dev="ggregory" due-to="Edgar Asatryan">Add JavaVersion enum constants for Java 14 and 15. #553.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add JavaVersion enum constants for Java 16.</action>
<action issue="LANG-1556" type="add" dev="ggregory" due-to="XenoAmess">Use Java 8 lambdas and Map operations.</action>
<action issue="LANG-1565" type="add" dev="ggregory" due-to="XenoAmess">Change removeLastFieldSeparator to use endsWith #550.</action>
<action issue="LANG-1557" type="add" dev="ggregory" due-to="XenoAmess, Gary Gregory">Change a Pattern to a static final field, for not letting it compile each time the function invoked. #542.</action>

View File

@ -129,6 +129,13 @@ public enum JavaVersion {
*/
JAVA_15(15.0f, "15"),
/**
* Java 16
*
* @since 3.11
*/
JAVA_16(16.0f, "16"),
/**
* The most recent java version. Mainly introduced to avoid to break when a new version of Java is used.
*/
@ -242,6 +249,8 @@ public enum JavaVersion {
return JAVA_14;
} else if ("15".equals(nom)) {
return JAVA_15;
} else if ("16".equals(nom)) {
return JAVA_16;
}
final float v = toFloatVersion(nom);
if ((v - 1.) < 1.) { // then we need to check decimals > .9

View File

@ -25,6 +25,7 @@ import static org.apache.commons.lang3.JavaVersion.JAVA_12;
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_1_1;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_2;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_3;
@ -66,10 +67,11 @@ public class JavaVersionTest {
assertEquals(JAVA_13, get("13"), "13 failed");
assertEquals(JAVA_14, get("14"), "14 failed");
assertEquals(JAVA_15, get("15"), "15 failed");
assertEquals(JAVA_16, get("16"), "16 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("16"), "Unhandled"); // LANG-1384
assertEquals(JAVA_RECENT, get("17"), "Unhandled"); // LANG-1384
}
@Test