Skip to content

Commit

Permalink
🎂 remove upper bound of java version
Browse files Browse the repository at this point in the history
  • Loading branch information
teras committed Dec 3, 2022
1 parent 26d4003 commit 1e2c79b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cmbuild
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public class Config {

public final static String MIN_JAVA_VERSION = "1.8";
public final static String MIN_JAVA_VERSION_FULL = "1.8.0_111";
public final static String MAX_JAVA_VERSION = "15";
public final static String JAVA_RANGE = "(" + MIN_JAVA_VERSION + " up to " + MAX_JAVA_VERSION + ")";

public final static String CMPLUGIN_MAVEN_PLUGIN_SIGNATURE = "cmplugin-maven-plugin";

}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static boolean isJavaValid(String version) {

if (given.isEmpty())
return false;
if (given.get(0) > req.get(0) && given.get(0) <= Integer.parseInt(Config.MAX_JAVA_VERSION))
if (given.get(0) > req.get(0))
return true;
if (given.size() < 2)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ public class SystemDependentTest {
@SuppressWarnings({"ResultOfMethodCallIgnored", "ConstantConditions"})
@Test
public void testIsJavaOld() {
// Future proof methods
Integer.parseInt(Config.MAX_JAVA_VERSION); //make sure it's just a number;
if (Config.MAX_JAVA_VERSION.startsWith("1."))
Integer.parseInt(Config.MAX_JAVA_VERSION.substring(2));
else
Integer.parseInt(Config.MAX_JAVA_VERSION);
assertEquals(4, TextUtils.listOfInts(Config.MIN_JAVA_VERSION_FULL).size());

int current = Integer.parseInt(Config.MAX_JAVA_VERSION);
// Future-proof methods

assertFalse(SystemDependent.isJavaValid("1.0"));
assertFalse(SystemDependent.isJavaValid("1.1"));
Expand All @@ -40,9 +32,6 @@ public void testIsJavaOld() {
assertTrue(SystemDependent.isJavaValid("10.0"));
assertTrue(SystemDependent.isJavaValid("11.0"));
assertTrue(SystemDependent.isJavaValid(Config.MIN_JAVA_VERSION_FULL));
assertTrue(SystemDependent.isJavaValid(Config.MAX_JAVA_VERSION + ".0"));
assertTrue(SystemDependent.isJavaValid(Config.MIN_JAVA_VERSION + ".1"));
assertTrue(SystemDependent.isJavaValid(current + ".0"));
assertFalse(SystemDependent.isJavaValid((current + 1) + ".0"));
}
}

0 comments on commit 1e2c79b

Please sign in to comment.