Skip to content

Commit

Permalink
Merge d91ac80 into 496eb10
Browse files Browse the repository at this point in the history
  • Loading branch information
nstdio authored Jun 13, 2020
2 parents 496eb10 + d91ac80 commit 79c07d1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/main/java/org/apache/commons/lang3/JavaVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ public enum JavaVersion {
*/
JAVA_13(13.0f, "13"),

/**
* Java 14
*
* @since 3.11
*/
JAVA_14(14.0f, "14"),

/**
* Java 15
*
* @since 3.11
*/
JAVA_15(15.0f, "15"),

/**
* The most recent java version. Mainly introduced to avoid to break when a new version of Java is used.
*/
Expand Down Expand Up @@ -224,6 +238,10 @@ static JavaVersion get(final String nom) {
return JAVA_12;
} else if ("13".equals(nom)) {
return JAVA_13;
} else if ("14".equals(nom)) {
return JAVA_14;
} else if ("15".equals(nom)) {
return JAVA_15;
}
final float v = toFloatVersion(nom);
if ((v - 1.) < 1.) { // then we need to check decimals > .9
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/org/apache/commons/lang3/JavaVersionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import static org.apache.commons.lang3.JavaVersion.JAVA_11;
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_1_1;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_2;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_3;
Expand Down Expand Up @@ -62,10 +64,12 @@ public void testGetJavaVersion() {
assertEquals(JAVA_11, get("11"), "11 failed");
assertEquals(JAVA_12, get("12"), "12 failed");
assertEquals(JAVA_13, get("13"), "13 failed");
assertEquals(JAVA_14, get("14"), "14 failed");
assertEquals(JAVA_15, get("15"), "15 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("14"), "Unhandled"); // LANG-1384
assertEquals(JAVA_RECENT, get("16"), "Unhandled"); // LANG-1384
}

@Test
Expand Down

0 comments on commit 79c07d1

Please sign in to comment.