langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java
changeset 36497 9c4840131512
parent 35000 952a7b4652f0
child 36526 3b41f1c69604
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Wed Mar 09 18:31:49 2016 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Thu Mar 10 08:54:29 2016 +0100
@@ -61,6 +61,7 @@
 import javax.tools.FileObject;
 import jdk.jshell.MemoryFileManager.SourceMemoryJavaFileObject;
 import jdk.jshell.ClassTracker.ClassInfo;
+import jdk.Version;
 
 /**
  * The primary interface to the compiler API.  Parsing, analysis, and
@@ -73,6 +74,7 @@
     private final MemoryFileManager fileManager;
     private final JShell state;
     private String classpath = System.getProperty("java.class.path");
+    private final static Version INITIAL_SUPPORTED_VER = Version.parse("9");
 
     TaskFactory(JShell state) {
         this.state = state;
@@ -80,7 +82,8 @@
         if (compiler == null) {
             throw new UnsupportedOperationException("Compiler not available, must be run with full JDK 9.");
         }
-        if (!System.getProperty("java.specification.version").equals("9"))  {
+        Version current = Version.parse(System.getProperty("java.specification.version"));
+        if (INITIAL_SUPPORTED_VER.compareToIgnoreOpt(current) > 0)  {
             throw new UnsupportedOperationException("Wrong compiler, must be run with full JDK 9.");
         }
         this.fileManager = new MemoryFileManager(