langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java
changeset 37644 33cf53901cac
parent 37004 ff77b7986967
child 37745 4b6b59f8e327
equal deleted inserted replaced
37643:626e07816dce 37644:33cf53901cac
    75  */
    75  */
    76 public class JShell implements AutoCloseable {
    76 public class JShell implements AutoCloseable {
    77 
    77 
    78     final SnippetMaps maps;
    78     final SnippetMaps maps;
    79     final KeyMap keyMap;
    79     final KeyMap keyMap;
       
    80     final OuterWrapMap outerMap;
    80     final TaskFactory taskFactory;
    81     final TaskFactory taskFactory;
    81     final InputStream in;
    82     final InputStream in;
    82     final PrintStream out;
    83     final PrintStream out;
    83     final PrintStream err;
    84     final PrintStream err;
    84     final Supplier<String> tempVariableNameGenerator;
    85     final Supplier<String> tempVariableNameGenerator;
   104         this.err = b.err;
   105         this.err = b.err;
   105         this.tempVariableNameGenerator = b.tempVariableNameGenerator;
   106         this.tempVariableNameGenerator = b.tempVariableNameGenerator;
   106         this.idGenerator = b.idGenerator;
   107         this.idGenerator = b.idGenerator;
   107 
   108 
   108         this.maps = new SnippetMaps(this);
   109         this.maps = new SnippetMaps(this);
   109         maps.setPackageName("REPL");
       
   110         this.keyMap = new KeyMap(this);
   110         this.keyMap = new KeyMap(this);
       
   111         this.outerMap = new OuterWrapMap(this);
   111         this.taskFactory = new TaskFactory(this);
   112         this.taskFactory = new TaskFactory(this);
   112         this.eval = new Eval(this);
   113         this.eval = new Eval(this);
   113         this.classTracker = new ClassTracker(this);
   114         this.classTracker = new ClassTracker(this);
   114     }
   115     }
   115 
   116 
   561         checkValidSnippet(snippet);
   562         checkValidSnippet(snippet);
   562         if (snippet.status() != Status.VALID) {
   563         if (snippet.status() != Status.VALID) {
   563             throw new IllegalArgumentException(
   564             throw new IllegalArgumentException(
   564                     messageFormat("jshell.exc.var.not.valid",  snippet, snippet.status()));
   565                     messageFormat("jshell.exc.var.not.valid",  snippet, snippet.status()));
   565         }
   566         }
   566         String value = executionControl().commandVarValue(maps.classFullName(snippet), snippet.name());
   567         String value = executionControl().commandVarValue(snippet.classFullName(), snippet.name());
   567         return expunge(value);
   568         return expunge(value);
   568     }
   569     }
   569 
   570 
   570     /**
   571     /**
   571      * Register a callback to be called when the Status of a snippet changes.
   572      * Register a callback to be called when the Status of a snippet changes.