aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2016-01-04 12:48:59 -0800
committerAndy Clement <aclement@pivotal.io>2016-01-04 12:48:59 -0800
commit9de03491abb6af7f7539674a05044b917805c066 (patch)
tree04cc1fdffd375bbafaa43bdb6d1159c0cb705a42
parentcfe754597f1d872497a84ef9a14200936f858e57 (diff)
downloadaspectj-9de03491abb6af7f7539674a05044b917805c066.tar.gz
aspectj-9de03491abb6af7f7539674a05044b917805c066.zip
Cope with java version becoming 9.X rather than 1.9.X
-rw-r--r--testing/newsrc/org/aspectj/testing/AjcTest.java2
-rw-r--r--util/src/org/aspectj/util/LangUtil.java21
2 files changed, 16 insertions, 7 deletions
diff --git a/testing/newsrc/org/aspectj/testing/AjcTest.java b/testing/newsrc/org/aspectj/testing/AjcTest.java
index 57129c853..29d3d1786 100644
--- a/testing/newsrc/org/aspectj/testing/AjcTest.java
+++ b/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;
diff --git a/util/src/org/aspectj/util/LangUtil.java b/util/src/org/aspectj/util/LangUtil.java
index cf929b7b5..49caba6b7 100644
--- a/util/src/org/aspectj/util/LangUtil.java
+++ b/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"