]> source.dussan.org Git - aspectj.git/commitdiff
Cope with java version becoming 9.X rather than 1.9.X
authorAndy Clement <aclement@pivotal.io>
Mon, 4 Jan 2016 20:48:59 +0000 (12:48 -0800)
committerAndy Clement <aclement@pivotal.io>
Mon, 4 Jan 2016 20:48:59 +0000 (12:48 -0800)
testing/newsrc/org/aspectj/testing/AjcTest.java
util/src/org/aspectj/util/LangUtil.java

index 57129c8532e50cf949b85bc2e2dc6079634fb792..29d3d178604949b65ed53caff4327e1e0d11fb05 100644 (file)
@@ -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;
index cf929b7b53f5f75cc6561e8053d523addaee4218..49caba6b71d34e09f2f856d4d09bf19b66045520 100644 (file)
@@ -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"