test/langtools/jdk/jshell/ToolTabSnippetTest.java
author rfield
Thu, 07 Dec 2017 13:23:18 -0800
changeset 48275 b2190c70a1ac
parent 47518 783d04ecccc3
child 50338 1d5694c1aa03
permissions -rw-r--r--
8192863: jshell tool: /<id><tab> gives "No such command" Reviewed-by: jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     1
/*
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     4
 *
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     8
 *
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    13
 * accompanied this code).
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    14
 *
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    18
 *
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    21
 * questions.
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    22
 */
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    23
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    24
/**
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    25
 * @test
47518
prr
parents: 47517 47484
diff changeset
    26
 * @bug 8177076 8185426 8189595 8188072
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    27
 * @modules
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    28
 *     jdk.compiler/com.sun.tools.javac.api
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    29
 *     jdk.compiler/com.sun.tools.javac.main
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
    30
 *     jdk.jshell/jdk.internal.jshell.tool
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    31
 *     jdk.jshell/jdk.internal.jshell.tool.resources:open
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    32
 *     jdk.jshell/jdk.jshell:open
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    33
 * @library /tools/lib
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    34
 * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
44570
7fec4e13a5cf 8178077: jshell tool: crash on ctrl-up or ctrl-down
jlahoda
parents: 44459
diff changeset
    35
 * @build Compiler UITesting
46185
f4c981fc7818 8182270: JShell API: Tools need snippet information without evaluating snippet
rfield
parents: 44811
diff changeset
    36
 * @build ToolTabSnippetTest
f4c981fc7818 8182270: JShell API: Tools need snippet information without evaluating snippet
rfield
parents: 44811
diff changeset
    37
 * @run testng/timeout=300 ToolTabSnippetTest
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    38
 */
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    39
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    40
import java.io.IOException;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    41
import java.lang.reflect.Field;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    42
import java.nio.file.Files;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    43
import java.nio.file.Path;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    44
import java.nio.file.Paths;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    45
import java.util.Arrays;
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
    46
import java.util.concurrent.CountDownLatch;
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    47
import java.util.jar.JarEntry;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    48
import java.util.jar.JarOutputStream;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    49
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
    50
import jdk.internal.jshell.tool.ConsoleIOContextTestSupport;
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    51
import org.testng.annotations.Test;
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    52
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    53
@Test
46185
f4c981fc7818 8182270: JShell API: Tools need snippet information without evaluating snippet
rfield
parents: 44811
diff changeset
    54
public class ToolTabSnippetTest extends UITesting {
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    55
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    56
    public void testExpression() throws Exception {
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    57
        Path classes = prepareZip();
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    58
        doRunTest((inputSink, out) -> {
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    59
            inputSink.write("/env -class-path " + classes.toString() + "\n");
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    60
            waitOutput(out, resource("jshell.msg.set.restore") + "\n\u0005");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    61
            inputSink.write("import jshelltest.*;\n");
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    62
            waitOutput(out, "\n\u0005");
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    63
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    64
            //-> <tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    65
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    66
            waitOutput(out, getMessage("jshell.console.completion.all.completions.number", "[0-9]+"));
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    67
            inputSink.write(TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    68
            waitOutput(out, ".*String.*StringBuilder.*" +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    69
                            REDRAW_PROMPT + "");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    70
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    71
            //new JShellTes<tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    72
            inputSink.write("new JShellTes" + TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    73
            waitOutput(out, "t\nJShellTest\\(      JShellTestAux\\(   " +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    74
                            REDRAW_PROMPT + "new JShellTest");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    75
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    76
            //new JShellTest<tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    77
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    78
            waitOutput(out, "JShellTest\\(      JShellTestAux\\(   \n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    79
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    80
                            resource("jshell.console.completion.current.signatures") + "\n" +
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    81
                            "jshelltest.JShellTest\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    82
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    83
                            resource("jshell.console.see.documentation") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    84
                            REDRAW_PROMPT + "new JShellTest");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    85
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    86
            waitOutput(out, "jshelltest.JShellTest\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    87
                            "JShellTest 0" +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    88
                            REDRAW_PROMPT + "new JShellTest");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    89
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    90
            waitOutput(out, "JShellTest\\(      JShellTestAux\\(   \n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    91
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    92
                            resource("jshell.console.completion.current.signatures") + "\n" +
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    93
                            "jshelltest.JShellTest\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    94
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    95
                            resource("jshell.console.see.documentation") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    96
                            REDRAW_PROMPT + "new JShellTest");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    97
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
    98
            //new JShellTest(<tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
    99
            inputSink.write("(" + TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   100
            waitOutput(out, "\\(\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   101
                            resource("jshell.console.completion.current.signatures") + "\n" +
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   102
                            "JShellTest\\(String str\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   103
                            "JShellTest\\(String str, int i\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   104
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   105
                            resource("jshell.console.see.documentation") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   106
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   107
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   108
            waitOutput(out, "JShellTest\\(String str\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   109
                            "JShellTest 1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   110
                            "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   111
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   112
                            resource("jshell.console.see.next.page") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   113
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   114
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   115
            waitOutput(out, "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   116
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   117
                            resource("jshell.console.see.next.javadoc") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   118
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   119
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   120
            waitOutput(out, "JShellTest\\(String str, int i\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   121
                            "JShellTest 2\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   122
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   123
                            getMessage("jshell.console.completion.all.completions.number", "[0-9]+") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   124
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   125
            inputSink.write(TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   126
            waitOutput(out, ".*String.*StringBuilder.*" +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   127
                            REDRAW_PROMPT + "new JShellTest\\(");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   128
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   129
            inputSink.write(INTERRUPT + "String str = \"\";\nnew JShellTest(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   130
            waitOutput(out, PROMPT + "new JShellTest\\(");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   131
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   132
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   133
            waitOutput(out, "\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   134
                            "str   \n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   135
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   136
                            resource("jshell.console.completion.current.signatures") + "\n" +
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   137
                            "JShellTest\\(String str\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   138
                            "JShellTest\\(String str, int i\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   139
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   140
                            resource("jshell.console.see.documentation") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   141
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   142
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   143
            waitOutput(out, "JShellTest\\(String str\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   144
                            "JShellTest 1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   145
                            "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   146
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   147
                            resource("jshell.console.see.next.page") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   148
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   149
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   150
            waitOutput(out, "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   151
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   152
                            resource("jshell.console.see.next.javadoc") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   153
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   154
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   155
            waitOutput(out, "JShellTest\\(String str, int i\\)\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   156
                            "JShellTest 2\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   157
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   158
                            getMessage("jshell.console.completion.all.completions.number", "[0-9]+") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   159
                            REDRAW_PROMPT + "new JShellTest\\(");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   160
            inputSink.write(TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   161
            waitOutput(out, ".*String.*StringBuilder.*" +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   162
                            REDRAW_PROMPT + "new JShellTest\\(");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   163
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   164
            inputSink.write(INTERRUPT + "JShellTest t = new JShellTest" + TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   165
            waitOutput(out, PROMPT + "JShellTest t = new JShellTest\n" +
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   166
                            "JShellTest\\(   \n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   167
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   168
                            resource("jshell.console.completion.current.signatures") + "\n" +
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   169
                            "jshelltest.JShellTest\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   170
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   171
                            resource("jshell.console.completion.all.completions") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   172
                            REDRAW_PROMPT + "JShellTest t = new JShellTest");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   173
            inputSink.write(TAB);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   174
            waitOutput(out, "JShellTest\\(      JShellTestAux\\(   \n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   175
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   176
                            resource("jshell.console.see.documentation") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   177
                            REDRAW_PROMPT + "JShellTest t = new JShellTest");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   178
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   179
            inputSink.write(INTERRUPT + "JShellTest t = new " + TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   180
            waitOutput(out, PROMPT + "JShellTest t = new \n" +
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   181
                            "JShellTest\\(   \n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   182
                            "\n" +
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   183
                            getMessage("jshell.console.completion.all.completions.number", "[0-9]+") +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   184
                            REDRAW_PROMPT + "JShellTest t = new ");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   185
            inputSink.write(TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   186
            waitOutput(out, ".*String.*StringBuilder.*" +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   187
                            REDRAW_PROMPT + "JShellTest t = new ");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   188
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   189
            inputSink.write(INTERRUPT + "class JShelX{}\n");
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   190
            inputSink.write("new JShel" + TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   191
            waitOutput(out, PROMPT + "new JShel\n" +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   192
                            "JShelX\\(\\)         JShellTest\\(      JShellTestAux\\(   " +
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   193
                            REDRAW_PROMPT + "new JShel");
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   194
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   195
            //no crash:
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   196
            inputSink.write(INTERRUPT + "new Stringbuil" + TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   197
            waitOutput(out, PROMPT + "new Stringbuil" + BELL);
47517
b5ad886110b3 8188072: JShell: NPE in SourceCodeAnalysis.completionSuggestions()
rfield
parents: 47216
diff changeset
   198
b5ad886110b3 8188072: JShell: NPE in SourceCodeAnalysis.completionSuggestions()
rfield
parents: 47216
diff changeset
   199
            //no crash: 8188072
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   200
            inputSink.write(INTERRUPT + "for (int:" + TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   201
            waitOutput(out, PROMPT + "for \\(int:" + BELL);
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   202
        });
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   203
    }
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   204
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   205
    public void testCleaningCompletionTODO() throws Exception {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   206
        doRunTest((inputSink, out) -> {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   207
            CountDownLatch testCompleteComputationStarted = new CountDownLatch(1);
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   208
            CountDownLatch testCompleteComputationContinue = new CountDownLatch(1);
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   209
            ConsoleIOContextTestSupport.IMPL = new ConsoleIOContextTestSupport() {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   210
                @Override
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   211
                protected void willComputeCompletionCallback() {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   212
                    if (testCompleteComputationStarted != null) {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   213
                        testCompleteComputationStarted.countDown();
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   214
                    }
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   215
                    if (testCompleteComputationContinue != null) {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   216
                        try {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   217
                            testCompleteComputationContinue.await();
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   218
                        } catch (InterruptedException ex) {
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   219
                            throw new IllegalStateException(ex);
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   220
                        }
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   221
                    }
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   222
                }
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   223
            };
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   224
            //-> <tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   225
            inputSink.write(TAB);
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   226
            testCompleteComputationStarted.await();
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   227
            //-> <tab><tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   228
            inputSink.write(TAB + TAB);
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   229
            testCompleteComputationContinue.countDown();
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   230
            waitOutput(out, PROMPT);
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   231
            //-> <tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   232
            inputSink.write(TAB);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   233
            waitOutput(out, PROMPT);
47050
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   234
            ConsoleIOContextTestSupport.IMPL = null;
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   235
        });
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   236
    }
72ec64aeaa57 8185426: Jshell crashing on autocompletion
jlahoda
parents: 46185
diff changeset
   237
47484
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   238
    public void testNoRepeat() throws Exception {
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   239
        doRunTest((inputSink, out) -> {
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   240
            inputSink.write("String xyzAA;\n");
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   241
            waitOutput(out, PROMPT);
47484
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   242
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   243
            //xyz<tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   244
            inputSink.write("String s = xyz" + TAB);
47484
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   245
            waitOutput(out, "^String s = xyzAA");
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   246
            inputSink.write(".");
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   247
            waitOutput(out, "^\\.");
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   248
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   249
            inputSink.write(INTERRUPT);
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   250
            waitOutput(out, PROMPT);
47484
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   251
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   252
            inputSink.write("double xyzAB;\n");
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   253
            waitOutput(out, PROMPT);
47484
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   254
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   255
            //xyz<tab>
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   256
            inputSink.write("String s = xyz" + TAB);
47484
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   257
            String allCompletions =
48275
b2190c70a1ac 8192863: jshell tool: /<id><tab> gives "No such command"
rfield
parents: 47518
diff changeset
   258
                    resource("jshell.console.completion.all.completions");
47484
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   259
            waitOutput(out, ".*xyzAA.*" + allCompletions + ".*\u0005String s = xyzA");
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   260
        });
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   261
    }
d0cb66d8cbf1 8189595: jshell tool: line redrawn on each completion
jlahoda
parents: 47216
diff changeset
   262
44459
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   263
    private Path prepareZip() {
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   264
        String clazz1 =
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   265
                "package jshelltest;\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   266
                "/**JShellTest 0" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   267
                " */\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   268
                "public class JShellTest {\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   269
                "    /**JShellTest 1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   270
                "     * <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   271
                "     * <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   272
                "     * <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1 <p>1\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   273
                "     */\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   274
                "    public JShellTest(String str) {}\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   275
                "    /**JShellTest 2" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   276
                "     */\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   277
                "    public JShellTest(String str, int i) {}\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   278
                "}\n";
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   279
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   280
        String clazz2 =
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   281
                "package jshelltest;\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   282
                "/**JShellTestAux 0" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   283
                " */\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   284
                "public class JShellTestAux {\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   285
                "    /**JShellTest 1" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   286
                "     */\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   287
                "    public JShellTestAux(String str) { }\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   288
                "    /**JShellTest 2" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   289
                "     */\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   290
                "    public JShellTestAux(String str, int i) { }\n" +
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   291
                "}\n";
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   292
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   293
        Path srcZip = Paths.get("src.zip");
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   294
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   295
        try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(srcZip))) {
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   296
            out.putNextEntry(new JarEntry("jshelltest/JShellTest.java"));
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   297
            out.write(clazz1.getBytes());
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   298
            out.putNextEntry(new JarEntry("jshelltest/JShellTestAux.java"));
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   299
            out.write(clazz2.getBytes());
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   300
        } catch (IOException ex) {
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   301
            throw new IllegalStateException(ex);
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   302
        }
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   303
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   304
        compiler.compile(clazz1, clazz2);
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   305
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   306
        try {
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   307
            Field availableSources = Class.forName("jdk.jshell.SourceCodeAnalysisImpl").getDeclaredField("availableSourcesOverride");
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   308
            availableSources.setAccessible(true);
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   309
            availableSources.set(null, Arrays.asList(srcZip));
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   310
        } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | ClassNotFoundException ex) {
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   311
            throw new IllegalStateException(ex);
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   312
        }
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   313
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   314
        return compiler.getClassDir();
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   315
    }
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   316
    //where:
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   317
        private final Compiler compiler = new Compiler();
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   318
5224425af378 8177076: jshell tool: usability of completion
jlahoda
parents:
diff changeset
   319
}