langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellToolBuilder.java
author rfield
Tue, 11 Apr 2017 17:26:52 -0700
changeset 44683 610dc2b48954
parent 42843 a8d83044a192
permissions -rw-r--r--
8178023: jshell tool: crash with ugly message on attempt to add non-existant module path Reviewed-by: jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     1
/*
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     4
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    10
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    15
 * accompanied this code).
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    16
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    20
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    23
 * questions.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    24
 */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    25
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    26
package jdk.internal.jshell.tool;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    27
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    28
import java.io.InputStream;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    29
import java.io.PrintStream;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    30
import java.util.Locale;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    31
import java.util.Map;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    32
import java.util.Objects;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    33
import java.util.Set;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    34
import java.util.prefs.BackingStoreException;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    35
import java.util.prefs.Preferences;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    36
import jdk.jshell.tool.JavaShellToolBuilder;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    37
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    38
/**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    39
 * Builder for programmatically building the jshell tool.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    40
 */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    41
public class JShellToolBuilder implements JavaShellToolBuilder {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    42
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    43
    private static final String PREFERENCES_NODE = "tool/JShell";
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    44
    private InputStream cmdIn = System.in;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    45
    private InputStream userIn = null;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    46
    private PrintStream cmdOut = System.out;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    47
    private PrintStream console = System.out;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    48
    private PrintStream userOut = System.out;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    49
    private PrintStream cmdErr = System.err;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    50
    private PrintStream userErr = System.err;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    51
    private PersistentStorage prefs = null;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    52
    private Map<String, String> vars = null;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    53
    private Locale locale = Locale.getDefault();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    54
    private boolean capturePrompt = false;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    55
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    56
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    57
     * Set the input channels.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    58
     * Default, if not set, {@code in(System.in, null)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    59
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    60
     * @param cmdIn source of command input
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    61
     * @param userIn source of input for running user code, or {@code null} to
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    62
     * be extracted from cmdIn
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    63
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    64
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    65
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    66
    public JavaShellToolBuilder in(InputStream cmdIn, InputStream userIn) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    67
        this.cmdIn = cmdIn;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    68
        this.userIn = userIn;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    69
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    70
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    71
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    72
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    73
     * Set the output channels. Same as {@code out(output, output, output)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    74
     * Default, if not set, {@code out(System.out)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    75
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    76
     * @param output destination of command feedback, console interaction, and
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    77
     * user code output
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    78
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    79
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    80
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    81
    public JavaShellToolBuilder out(PrintStream output) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    82
        this.cmdOut = output;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    83
        this.console = output;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    84
        this.userOut = output;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    85
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    86
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    87
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    88
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    89
     * Set the output channels.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    90
     * Default, if not set, {@code out(System.out, System.out, System.out)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    91
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    92
     * @param cmdOut destination of command feedback including error messages
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    93
     * for users
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    94
     * @param console destination of console interaction
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    95
     * @param userOut destination of user code output.  For example, user snippet
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    96
     * {@code System.out.println("Hello")} when executed {@code Hello} goes to
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    97
     * userOut.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    98
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    99
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   100
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   101
    public JavaShellToolBuilder out(PrintStream cmdOut, PrintStream console, PrintStream userOut) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   102
        this.cmdOut = cmdOut;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   103
        this.console = console;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   104
        this.userOut = userOut;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   105
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   106
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   107
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   108
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   109
     * Set the error channels. Same as {@code err(error, error)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   110
     * Default, if not set, {@code err(System.err)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   111
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   112
     * @param error destination of tool errors, and
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   113
     * user code errors
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   114
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   115
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   116
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   117
    public JavaShellToolBuilder err(PrintStream error) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   118
        this.cmdErr = error;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   119
        this.userErr = error;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   120
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   121
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   122
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   123
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   124
     * Set the error channels.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   125
     * Default, if not set, {@code err(System.err, System.err, System.err)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   126
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   127
     * @param cmdErr destination of tool start-up and fatal errors
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   128
     * @param userErr destination of user code error output.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   129
     * For example, user snippet  {@code System.err.println("Oops")}
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   130
     * when executed {@code Oops} goes to userErr.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   131
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   132
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   133
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   134
    public JavaShellToolBuilder err(PrintStream cmdErr, PrintStream userErr) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   135
        this.cmdErr = cmdErr;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   136
        this.userErr = userErr;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   137
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   138
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   139
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   140
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   141
     * Set the storage mechanism for persistent information which includes
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   142
     * input history and retained settings. Default if not set is the
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   143
     * tool's standard persistence mechanism.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   144
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   145
     * @param prefs an instance of {@link java.util.prefs.Preferences} that
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   146
     * is used to retrieve and store persistent information
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   147
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   148
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   149
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   150
    public JavaShellToolBuilder persistence(Preferences prefs) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   151
        this.prefs = new PreferencesStorage(prefs);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   152
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   153
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   154
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   155
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   156
     * Set the storage mechanism for persistent information which includes
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   157
     * input history and retained settings.   Default if not set is the
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   158
     * tool's standard persistence mechanism.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   159
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   160
     * @param prefsMap  an instance of {@link java.util.Map} that
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   161
     * is used to retrieve and store persistent information
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   162
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   163
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   164
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   165
    public JavaShellToolBuilder persistence(Map<String, String> prefsMap) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   166
        this.prefs = new MapStorage(prefsMap);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   167
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   168
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   169
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   170
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   171
     * Set the source for environment variables.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   172
     * Default, if not set, {@code env(System.getenv())}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   173
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   174
     * @param vars the Map of environment variable names to values
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   175
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   176
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   177
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   178
    public JavaShellToolBuilder env(Map<String, String> vars) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   179
        this.vars = vars;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   180
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   181
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   182
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   183
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   184
     * Set the locale.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   185
     * Default, if not set, {@code locale(Locale.getDefault())}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   186
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   187
     * @param locale the locale
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   188
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   189
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   190
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   191
    public JavaShellToolBuilder locale(Locale locale) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   192
        this.locale = locale;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   193
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   194
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   195
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   196
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   197
     * Set if the special command capturing prompt override should be used.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   198
     * Default, if not set, {@code promptCapture(false)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   199
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   200
     * @param capture if {@code true}, basic prompt is the {@code ENQ}
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   201
     * character and continuation prompt is the {@code ACK} character.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   202
     * If false, prompts are as set with set-up or user {@code /set} commands.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   203
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   204
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   205
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   206
    public JavaShellToolBuilder promptCapture(boolean capture) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   207
        this.capturePrompt = capture;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   208
        return this;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   209
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   210
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   211
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   212
     * Create a tool instance for testing. Not in JavaShellToolBuilder.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   213
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   214
     * @return the tool instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   215
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   216
    public JShellTool rawTool() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   217
        if (prefs == null) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   218
            prefs = new PreferencesStorage(Preferences.userRoot().node(PREFERENCES_NODE));
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   219
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   220
        if (vars == null) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   221
            vars = System.getenv();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   222
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   223
        JShellTool sh = new JShellTool(cmdIn, cmdOut, cmdErr, console, userIn,
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   224
                userOut, userErr, prefs, vars, locale);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   225
        sh.testPrompt = capturePrompt;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   226
        return sh;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   227
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   228
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   229
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   230
     * Run an instance of the Java shell tool as configured by the other methods
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   231
     * in this interface.  This call is not destructive, more than one call of
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   232
     * this method may be made from a configured builder.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   233
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   234
     * @param arguments the command-line arguments (including options), if any
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   235
     * @throws Exception an unexpected fatal exception
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   236
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   237
    @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   238
    public void run(String... arguments) throws Exception {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   239
        rawTool().start(arguments);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   240
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   241
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   242
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   243
     * Persistence stored in Preferences.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   244
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   245
    private static class PreferencesStorage implements PersistentStorage {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   246
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   247
        final Preferences p;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   248
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   249
        PreferencesStorage(Preferences p) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   250
            this.p = p;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   251
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   252
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   253
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   254
        public void clear() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   255
            try {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   256
                p.clear();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   257
            } catch (BackingStoreException ex) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   258
                throw new IllegalStateException(ex);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   259
            }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   260
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   261
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   262
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   263
        public String[] keys() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   264
            try {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   265
                return p.keys();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   266
            } catch (BackingStoreException ex) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   267
                throw new IllegalStateException(ex);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   268
            }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   269
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   270
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   271
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   272
        public String get(String key) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   273
            return p.get(key, null);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   274
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   275
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   276
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   277
        public void put(String key, String value) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   278
            p.put(key, value);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   279
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   280
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   281
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   282
        public void remove(String key) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   283
            p.remove(key);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   284
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   285
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   286
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   287
        public void flush() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   288
            try {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   289
                p.flush();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   290
            } catch (BackingStoreException ex) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   291
                throw new IllegalStateException(ex);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   292
            }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   293
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   294
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   295
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   296
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   297
     * Persistence stored in a Map.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   298
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   299
    private static class MapStorage implements PersistentStorage {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   300
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   301
        final Map<String, String> map;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   302
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   303
        MapStorage(Map<String, String> map) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   304
            this.map = map;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   305
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   306
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   307
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   308
        public void clear() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   309
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   310
            try {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   311
                map.clear();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   312
            } catch (UnsupportedOperationException ex) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   313
                throw new IllegalStateException(ex);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   314
            }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   315
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   316
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   317
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   318
        public String[] keys() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   319
            Set<String> ks = map.keySet();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   320
            return ks.toArray(new String[ks.size()]);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   321
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   322
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   323
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   324
        public String get(String key) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   325
            Objects.requireNonNull(key);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   326
            return map.get(key);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   327
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   328
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   329
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   330
        public void put(String key, String value) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   331
            Objects.requireNonNull(key);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   332
            Objects.requireNonNull(value);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   333
            map.put(key, value);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   334
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   335
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   336
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   337
        public void remove(String key) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   338
            Objects.requireNonNull(key);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   339
            map.remove(key);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   340
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   341
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   342
        @Override
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   343
        public void flush() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   344
            // no-op always up-to-date
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   345
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   346
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   347
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   348
}