瀏覽代碼

Cope with java version becoming 9.X rather than 1.9.X

tags/V1_9_0_BETA4
Andy Clement 8 年之前
父節點
當前提交
9de03491ab
共有 2 個文件被更改,包括 16 次插入7 次删除
  1. 1
    1
      testing/newsrc/org/aspectj/testing/AjcTest.java
  2. 15
    6
      util/src/org/aspectj/util/LangUtil.java

+ 1
- 1
testing/newsrc/org/aspectj/testing/AjcTest.java 查看文件

@@ -47,7 +47,7 @@ public class AjcTest {
is16VMOrGreater = true;
is17VMOrGreater = true;
is18VMOrGreater = true;
} else if (vm.startsWith("1.9")) {
} else if (vm.startsWith("1.9") || vm.startsWith("9")) {
is15VMOrGreater = true;
is16VMOrGreater = true;
is17VMOrGreater = true;

+ 15
- 6
util/src/org/aspectj/util/LangUtil.java 查看文件

@@ -71,12 +71,17 @@ public class LangUtil {
.printStackTrace(System.err);
vmVersion = 1.5;
} else {
try {
String versionString = vm.substring(0, 3);
Double temp = new Double(Double.parseDouble(versionString));
vmVersion = temp.doubleValue();
} catch (Exception e) {
vmVersion = 1.4;
if (vm.startsWith("9")) {
// JDK 9 beta 99 starts using 9-ea as the version string.
vmVersion = 1.9;
} else {
try {
String versionString = vm.substring(0, 3);
Double temp = new Double(Double.parseDouble(versionString));
vmVersion = temp.doubleValue();
} catch (Exception e) {
vmVersion = 1.4;
}
}
}
} catch (Throwable t) {
@@ -110,6 +115,10 @@ public class LangUtil {
public static boolean is18VMOrGreater() {
return 1.8 <= vmVersion;
}
public static boolean is19VMOrGreater() {
return 1.9 <= vmVersion;
}

/**
* Shorthand for "if null, throw IllegalArgumentException"

Loading…
取消
儲存