summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2017-09-25 22:12:41 -0700
committerAndy Clement <aclement@pivotal.io>2017-09-25 22:12:41 -0700
commiteae468d794cf215e05ec80d7be7d09a88e18ebe9 (patch)
tree7853036d5110863a880d75cf8e1847dd82e296f8
parent6d6738cfece6328027916681e67e54225531db38 (diff)
downloadaspectj-eae468d794cf215e05ec80d7be7d09a88e18ebe9.tar.gz
aspectj-eae468d794cf215e05ec80d7be7d09a88e18ebe9.zip
Make the 1.8 slightly more tolerant of Java 9
-rw-r--r--util/src/org/aspectj/util/LangUtil.java31
1 files changed, 25 insertions, 6 deletions
diff --git a/util/src/org/aspectj/util/LangUtil.java b/util/src/org/aspectj/util/LangUtil.java
index 1d832508b..0f19124a9 100644
--- a/util/src/org/aspectj/util/LangUtil.java
+++ b/util/src/org/aspectj/util/LangUtil.java
@@ -38,6 +38,8 @@ public class LangUtil {
public static final String EOL;
+ public static final String JRT_FS = "jrt-fs.jar";
+
private static double vmVersion;
static {
@@ -71,12 +73,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 +117,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"
@@ -1447,5 +1458,13 @@ public class LangUtil {
}
} // class Thrown
}
+
+ public static String getJrtFsFilePath() {
+ return getJavaHome() + File.separator + "lib" + File.separator + JRT_FS;
+ }
+
+ public static String getJavaHome() {
+ return System.getProperty("java.home");
+ }
}