Add JavaVersion for Java 18 since a release candidate is available.

This commit is contained in:
Gary Gregory 2022-02-24 06:48:59 -05:00
parent cd10cfd51f
commit 2777d6784e
3 changed files with 13 additions and 1 deletions

View File

@ -119,6 +119,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add Processor.Type.AARCH_64.</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add Processor.Type.AARCH_64.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add Processor.isAarch64().</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add Processor.isAarch64().</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Update ArchUtils.getProcessor(String) for "aarch64".</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Update ArchUtils.getProcessor(String) for "aarch64".</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add JavaVersion.JAVA_18.</action>
<!-- UPDATE --> <!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump spotbugs-maven-plugin from 4.2.0 to 4.5.0.0 #735, #808, #822, #834.</action> <action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump spotbugs-maven-plugin from 4.2.0 to 4.5.0.0 #735, #808, #822, #834.</action>
<action type="update" dev="ggregory" due-to="Dependabot, XenoAmess">Bump actions/cache from v2.1.4 to v2.1.7 #742, #752, #764, #833.</action> <action type="update" dev="ggregory" due-to="Dependabot, XenoAmess">Bump actions/cache from v2.1.4 to v2.1.7 #742, #752, #764, #833.</action>

View File

@ -143,6 +143,13 @@ public enum JavaVersion {
*/ */
JAVA_17(17.0f, "17"), 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. * 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; return JAVA_16;
case "17": case "17":
return JAVA_17; return JAVA_17;
case "18":
return JAVA_18;
default: default:
final float v = toFloatVersion(versionStr); final float v = toFloatVersion(versionStr);
if ((v - 1.) < 1.) { // then we need to check decimals > .9 if ((v - 1.) < 1.) { // then we need to check decimals > .9

View File

@ -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_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_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_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;
@ -70,10 +71,11 @@ public class JavaVersionTest {
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_17, get("17"), "17 failed");
assertEquals(JAVA_18, get("18"), "18 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("18"), "Unhandled"); // LANG-1384 assertEquals(JAVA_RECENT, get("19"), "Unhandled"); // LANG-1384
} }
@Test @Test