diff options
author | Andy Clement <aclement@pivotal.io> | 2016-01-04 12:48:59 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2016-01-04 12:48:59 -0800 |
commit | 9de03491abb6af7f7539674a05044b917805c066 (patch) | |
tree | 04cc1fdffd375bbafaa43bdb6d1159c0cb705a42 /util | |
parent | cfe754597f1d872497a84ef9a14200936f858e57 (diff) | |
download | aspectj-9de03491abb6af7f7539674a05044b917805c066.tar.gz aspectj-9de03491abb6af7f7539674a05044b917805c066.zip |
Cope with java version becoming 9.X rather than 1.9.X
Diffstat (limited to 'util')
-rw-r--r-- | util/src/org/aspectj/util/LangUtil.java | 21 |
1 files changed, 15 insertions, 6 deletions
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" |