changeset 3147:38910274fc6f

Merge
author lana
date Mon, 30 Nov 2015 13:27:57 -0800
parents 40339b2680ab 853c77f8193c
children d2713a6edc13
files test/tools/javac/diags/examples/DiamondRedundantArgs1.java test/tools/javac/generics/diamond/7002837/T7002837.out test/tools/javac/generics/diamond/neg/T8078473.out test/tools/javac/generics/diamond/neg/T8078473_2.out
diffstat 32 files changed, 421 insertions(+), 413 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Mon Nov 30 13:27:57 2015 -0800
@@ -241,8 +241,6 @@
                 }
                 for (Type t : inferredArgs) {
                     if (!types.isSameType(t, explicitArgs.head)) {
-                        log.warning(oldTree.clazz, "diamond.redundant.args.1",
-                                oldTree.clazz.type, newTree.clazz.type);
                         return;
                     }
                     explicitArgs = explicitArgs.tail;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Mon Nov 30 13:27:57 2015 -0800
@@ -931,7 +931,7 @@
         private JCExpression makeReceiver(VarSymbol rcvr) {
             if (rcvr == null) return null;
             JCExpression rcvrExpr = make.Ident(rcvr);
-            Type rcvrType = tree.sym.enclClass().type;
+            Type rcvrType = tree.ownerAccessible ? tree.sym.enclClass().type : tree.expr.type;
             if (rcvrType == syms.arrayClass.type) {
                 // Map the receiver type to the actually type, not just "array"
                 rcvrType = tree.getQualifierExpression().type;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Sun Nov 29 11:00:10 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Nov 30 13:27:57 2015 -0800
@@ -1669,12 +1669,6 @@
 compiler.warn.diamond.redundant.args=\
     Redundant type arguments in new expression (use diamond operator instead).
 
-# 0: type, 1: list of type
-compiler.warn.diamond.redundant.args.1=\
-    Redundant type arguments in new expression (use diamond operator instead).\n\
-    explicit: {0}\n\
-    inferred: {1}
-
 compiler.warn.potential.lambda.found=\
     This anonymous inner class creation can be turned into a lambda expression.
 
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Mon Nov 30 13:27:57 2015 -0800
@@ -97,8 +97,8 @@
 public class JShellTool {
 
     private static final Pattern LINEBREAK = Pattern.compile("\\R");
-    private static final Pattern HISTORY_ALL_FILENAME = Pattern.compile(
-            "((?<cmd>(all|history))(\\z|\\p{javaWhitespace}+))?(?<filename>.*)");
+    private static final Pattern HISTORY_ALL_START_FILENAME = Pattern.compile(
+            "((?<cmd>(all|history|start))(\\z|\\p{javaWhitespace}+))?(?<filename>.*)");
 
     final InputStream cmdin;
     final PrintStream cmdout;
@@ -504,15 +504,30 @@
             arg = cmd.substring(idx + 1).trim();
             cmd = cmd.substring(0, idx);
         }
-        Command command = commands.get(cmd);
-        if (command == null || command.kind == CommandKind.HELP_ONLY) {
+        Command[] candidates = findCommand(cmd, c -> c.kind != CommandKind.HELP_ONLY);
+        if (candidates.length == 0) {
             hard("No such command: %s", cmd);
             fluff("Type /help for help.");
+        } else if (candidates.length == 1) {
+            candidates[0].run.accept(arg);
         } else {
-            command.run.accept(arg);
+            hard("Command: %s is ambiguous: %s", cmd, Arrays.stream(candidates).map(c -> c.command).collect(Collectors.joining(", ")));
+            fluff("Type /help for help.");
         }
     }
 
+    private Command[] findCommand(String cmd, Predicate<Command> filter) {
+        Command exact = commands.get(cmd);
+        if (exact != null)
+            return new Command[] {exact};
+
+        return commands.values()
+                       .stream()
+                       .filter(filter)
+                       .filter(command -> command.command.startsWith(cmd))
+                       .toArray(size -> new Command[size]);
+    }
+
     private static Path toPathResolvingUserHome(String pathString) {
         if (pathString.replace(File.separatorChar, '/').startsWith("~/"))
             return Paths.get(System.getProperty("user.home"), pathString.substring(2));
@@ -521,19 +536,19 @@
     }
 
     static final class Command {
-        public final String[] aliases;
+        public final String command;
         public final String params;
         public final String description;
         public final Consumer<String> run;
         public final CompletionProvider completions;
         public final CommandKind kind;
 
-        public Command(String command, String alias, String params, String description, Consumer<String> run, CompletionProvider completions) {
-            this(command, alias, params, description, run, completions, CommandKind.NORMAL);
+        public Command(String command, String params, String description, Consumer<String> run, CompletionProvider completions) {
+            this(command, params, description, run, completions, CommandKind.NORMAL);
         }
 
-        public Command(String command, String alias, String params, String description, Consumer<String> run, CompletionProvider completions, CommandKind kind) {
-            this.aliases = alias != null ? new String[] {command, alias} : new String[] {command};
+        public Command(String command, String params, String description, Consumer<String> run, CompletionProvider completions, CommandKind kind) {
+            this.command = command;
             this.params = params;
             this.description = description;
             this.run = run;
@@ -582,9 +597,7 @@
     private static final CompletionProvider FILE_COMPLETION_PROVIDER = fileCompletions(p -> true);
     private final Map<String, Command> commands = new LinkedHashMap<>();
     private void registerCommand(Command cmd) {
-        for (String str : cmd.aliases) {
-            commands.put(str, cmd);
-        }
+        commands.put(cmd.command, cmd);
     }
     private static CompletionProvider fileCompletions(Predicate<Path> accept) {
         return (code, cursor, anchor) -> {
@@ -632,7 +645,7 @@
     }
 
     private static CompletionProvider saveCompletion() {
-        CompletionProvider keyCompletion = new FixedCompletionProvider("all ", "history ");
+        CompletionProvider keyCompletion = new FixedCompletionProvider("all ", "history ", "start ");
         return (code, cursor, anchor) -> {
             List<Suggestion> result = new ArrayList<>();
             int space = code.indexOf(' ');
@@ -648,75 +661,78 @@
     // Table of commands -- with command forms, argument kinds, help message, implementation, ...
 
     {
-        registerCommand(new Command("/list", "/l", "[all]", "list the source you have typed",
+        registerCommand(new Command("/list", "[all]", "list the source you have typed",
                                     arg -> cmdList(arg),
                                     new FixedCompletionProvider("all")));
-        registerCommand(new Command("/seteditor", null, "<executable>", "set the external editor command to use",
+        registerCommand(new Command("/seteditor", "<executable>", "set the external editor command to use",
                                     arg -> cmdSetEditor(arg),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/edit", "/e", "<name or id>", "edit a source entry referenced by name or id",
+        registerCommand(new Command("/edit", "<name or id>", "edit a source entry referenced by name or id",
                                     arg -> cmdEdit(arg),
                                     editCompletion()));
-        registerCommand(new Command("/drop", "/d", "<name or id>", "delete a source entry referenced by name or id",
+        registerCommand(new Command("/drop", "<name or id>", "delete a source entry referenced by name or id",
                                     arg -> cmdDrop(arg),
                                     editCompletion()));
-        registerCommand(new Command("/save", "/s", "[all|history] <file>", "save the source you have typed",
+        registerCommand(new Command("/save", "[all|history|start] <file>", "save: <none> - current source;\n" +
+                                                                           "      all - source including overwritten, failed, and start-up code;\n" +
+                                                                           "      history - editing history;\n" +
+                                                                           "      start - default start-up definitions",
                                     arg -> cmdSave(arg),
                                     saveCompletion()));
-        registerCommand(new Command("/open", "/o", "<file>", "open a file as source input",
+        registerCommand(new Command("/open", "<file>", "open a file as source input",
                                     arg -> cmdOpen(arg),
                                     FILE_COMPLETION_PROVIDER));
-        registerCommand(new Command("/vars", "/v", null, "list the declared variables and their values",
+        registerCommand(new Command("/vars", null, "list the declared variables and their values",
                                     arg -> cmdVars(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/methods", "/m", null, "list the declared methods and their signatures",
+        registerCommand(new Command("/methods", null, "list the declared methods and their signatures",
                                     arg -> cmdMethods(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/classes", "/c", null, "list the declared classes",
+        registerCommand(new Command("/classes", null, "list the declared classes",
                                     arg -> cmdClasses(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/imports", "/i", null, "list the imported items",
+        registerCommand(new Command("/imports", null, "list the imported items",
                                     arg -> cmdImports(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/exit", "/x", null, "exit the REPL",
+        registerCommand(new Command("/exit", null, "exit the REPL",
                                     arg -> cmdExit(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/reset", "/r", null, "reset everything in the REPL",
+        registerCommand(new Command("/reset", null, "reset everything in the REPL",
                                     arg -> cmdReset(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/feedback", "/f", "<level>", "feedback information: off, concise, normal, verbose, default, or ?",
+        registerCommand(new Command("/feedback", "<level>", "feedback information: off, concise, normal, verbose, default, or ?",
                                     arg -> cmdFeedback(arg),
                                     new FixedCompletionProvider("off", "concise", "normal", "verbose", "default", "?")));
-        registerCommand(new Command("/prompt", "/p", null, "toggle display of a prompt",
+        registerCommand(new Command("/prompt", null, "toggle display of a prompt",
                                     arg -> cmdPrompt(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/classpath", "/cp", "<path>", "add a path to the classpath",
+        registerCommand(new Command("/classpath", "<path>", "add a path to the classpath",
                                     arg -> cmdClasspath(arg),
                                     classPathCompletion()));
-        registerCommand(new Command("/history", "/h", null, "history of what you have typed",
+        registerCommand(new Command("/history", null, "history of what you have typed",
                                     arg -> cmdHistory(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/setstart", null, "<file>", "read file and set as the new start-up definitions",
+        registerCommand(new Command("/setstart", "<file>", "read file and set as the new start-up definitions",
                                     arg -> cmdSetStart(arg),
                                     FILE_COMPLETION_PROVIDER));
-        registerCommand(new Command("/savestart", null, "<file>", "save the default start-up definitions to the file",
-                                    arg -> cmdSaveStart(arg),
-                                    FILE_COMPLETION_PROVIDER));
-        registerCommand(new Command("/debug", "/db", "", "toggle debugging of the REPL",
+        registerCommand(new Command("/debug", "", "toggle debugging of the REPL",
                                     arg -> cmdDebug(arg),
                                     EMPTY_COMPLETION_PROVIDER,
                                     CommandKind.HIDDEN));
-        registerCommand(new Command("/help", "/?", "", "this help message",
+        registerCommand(new Command("/help", "", "this help message",
                                     arg -> cmdHelp(),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/!", null, "", "re-run last snippet",
+        registerCommand(new Command("/?", "", "this help message",
+                                    arg -> cmdHelp(),
+                                    EMPTY_COMPLETION_PROVIDER));
+        registerCommand(new Command("/!", "", "re-run last snippet",
                                     arg -> cmdUseHistoryEntry(-1),
                                     EMPTY_COMPLETION_PROVIDER));
-        registerCommand(new Command("/<n>", null, "", "re-run n-th snippet",
+        registerCommand(new Command("/<n>", "", "re-run n-th snippet",
                                     arg -> { throw new IllegalStateException(); },
                                     EMPTY_COMPLETION_PROVIDER,
                                     CommandKind.HELP_ONLY));
-        registerCommand(new Command("/-<n>", null, "", "re-run n-th previous snippet",
+        registerCommand(new Command("/-<n>", "", "re-run n-th previous snippet",
                                     arg -> { throw new IllegalStateException(); },
                                     EMPTY_COMPLETION_PROVIDER,
                                     CommandKind.HELP_ONLY));
@@ -732,16 +748,16 @@
                              .stream()
                              .distinct()
                              .filter(cmd -> cmd.kind != CommandKind.HIDDEN && cmd.kind != CommandKind.HELP_ONLY)
-                             .map(cmd -> cmd.aliases[0])
+                             .map(cmd -> cmd.command)
                              .filter(key -> key.startsWith(prefix))
                              .map(key -> new Suggestion(key + " ", false));
             anchor[0] = 0;
         } else {
             String arg = prefix.substring(space + 1);
             String cmd = prefix.substring(0, space);
-            Command command = commands.get(cmd);
-            if (command != null) {
-                result = command.completions.completionSuggestions(arg, cursor - space, anchor).stream();
+            Command[] candidates = findCommand(cmd, c -> true);
+            if (candidates.length == 1) {
+                result = candidates[0].completions.completionSuggestions(arg, cursor - space, anchor).stream();
                 anchor[0] += space + 1;
             } else {
                 result = Stream.empty();
@@ -885,12 +901,7 @@
             if (cmd.kind == CommandKind.HIDDEN)
                 continue;
             StringBuilder synopsis = new StringBuilder();
-            if (cmd.aliases.length > 1) {
-                synopsis.append(String.format("%-3s or ", cmd.aliases[1]));
-            } else {
-                synopsis.append("       ");
-            }
-            synopsis.append(cmd.aliases[0]);
+            synopsis.append(cmd.command);
             if (cmd.params != null)
                 synopsis.append(" ").append(cmd.params);
             synopsis2Description.put(synopsis.toString(), cmd.description);
@@ -901,7 +912,9 @@
         for (Entry<String, String> e : synopsis2Description.entrySet()) {
             cmdout.print(String.format("%-" + synopsisLen + "s", e.getKey()));
             cmdout.print(" -- ");
-            cmdout.println(e.getValue());
+            String indentedNewLine = System.getProperty("line.separator") +
+                                     String.format("%-" + (synopsisLen + 4) + "s", "");
+            cmdout.println(e.getValue().replace("\n", indentedNewLine));
         }
         cmdout.println();
         cmdout.println("Supported shortcuts include:");
@@ -1141,13 +1154,14 @@
     }
 
     private void cmdSave(String arg_filename) {
-        Matcher mat = HISTORY_ALL_FILENAME.matcher(arg_filename);
+        Matcher mat = HISTORY_ALL_START_FILENAME.matcher(arg_filename);
         if (!mat.find()) {
             hard("Malformed argument to the /save command: %s", arg_filename);
             return;
         }
         boolean useHistory = false;
         boolean saveAll = false;
+        boolean saveStart = false;
         String cmd = mat.group("cmd");
         if (cmd != null) switch (cmd) {
             case "all":
@@ -1156,6 +1170,9 @@
             case "history":
                 useHistory = true;
                 break;
+            case "start":
+                saveStart = true;
+                break;
         }
         String filename = mat.group("filename");
         if (filename == null ||filename.isEmpty()) {
@@ -1170,6 +1187,8 @@
                     writer.write(s);
                     writer.write("\n");
                 }
+            } else if (saveStart) {
+                writer.append(DEFAULT_STARTUP);
             } else {
                 for (Snippet sn : state.snippets()) {
                     if (saveAll || notInStartUp(sn)) {
@@ -1203,22 +1222,6 @@
         }
     }
 
-    private void cmdSaveStart(String filename) {
-        if (filename.isEmpty()) {
-            hard("The /savestart command requires a filename argument.");
-        } else {
-            try {
-                Files.write(toPathResolvingUserHome(filename), DEFAULT_STARTUP.getBytes());
-            } catch (AccessDeniedException e) {
-                hard("File '%s' for /savestart is not accessible.", filename);
-            } catch (NoSuchFileException e) {
-                hard("File '%s' for /savestart cannot be located.", filename);
-            } catch (Exception e) {
-                hard("Exception while saving default startup file: %s", e);
-            }
-        }
-    }
-
     private void cmdVars() {
         for (VarSnippet vk : state.variables()) {
             String val = state.status(vk) == Status.VALID
--- a/test/jdk/jshell/CommandCompletionTest.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/jdk/jshell/CommandCompletionTest.java	Mon Nov 30 13:27:57 2015 -0800
@@ -100,9 +100,9 @@
 
     public void testSave() throws IOException {
         Compiler compiler = new Compiler();
-        assertCompletion("/s|", false, "/save ", "/savestart ", "/seteditor ", "/setstart ");
+        assertCompletion("/s|", false, "/save ", "/seteditor ", "/setstart ");
         List<String> p1 = listFiles(Paths.get(""));
-        Collections.addAll(p1, "all ", "history ");
+        Collections.addAll(p1, "all ", "history ", "start ");
         FileSystems.getDefault().getRootDirectories().forEach(s -> p1.add(s.toString()));
         Collections.sort(p1);
         assertCompletion("/save |", false, p1.toArray(new String[p1.size()]));
--- a/test/jdk/jshell/ToolBasicTest.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/jdk/jshell/ToolBasicTest.java	Mon Nov 30 13:27:57 2015 -0800
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8143037
  * @summary Tests for Basic tests for REPL tool
  * @ignore 8139873
  * @library /tools/lib
@@ -124,28 +125,28 @@
                     interrupt,
                     (a) -> assertCommand(a, "int a\u0003", ""),
                     (a) -> assertCommand(a, "int a = 2 + 2\u0003", ""),
-                    (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
+                    (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                     (a) -> evaluateExpression(a, "int", "2", "2"),
-                    (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
+                    (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                     (a) -> assertCommand(a, "void f() {", ""),
                     (a) -> assertCommand(a, "int q = 10;" + s, ""),
                     interrupt,
                     (a) -> assertCommand(a, "void f() {}\u0003", ""),
-                    (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
+                    (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                     (a) -> assertMethod(a, "int f() { return 0; }", "()int", "f"),
-                    (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
+                    (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                     (a) -> assertCommand(a, "class A {" + s, ""),
                     interrupt,
                     (a) -> assertCommand(a, "class A {}\u0003", ""),
-                    (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
+                    (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
                     (a) -> assertClass(a, "interface A {}", "interface", "A"),
-                    (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
+                    (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
                     (a) -> assertCommand(a, "import java.util.stream." + s, ""),
                     interrupt,
                     (a) -> assertCommand(a, "import java.util.stream.\u0003", ""),
-                    (a) -> assertCommandCheckOutput(a, "/i", assertImports()),
+                    (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
                     (a) -> assertImport(a, "import java.util.stream.Stream", "", "java.util.stream.Stream"),
-                    (a) -> assertCommandCheckOutput(a, "/i", assertImports())
+                    (a) -> assertCommandCheckOutput(a, "/imports", assertImports())
             );
         }
     }
@@ -265,10 +266,10 @@
 
     public void testDebug() {
         test(
-                (a) -> assertCommand(a, "/db", "|  Debugging on\n"),
+                (a) -> assertCommand(a, "/deb", "|  Debugging on\n"),
                 (a) -> assertCommand(a, "/debug", "|  Debugging off\n"),
                 (a) -> assertCommand(a, "/debug", "|  Debugging on\n"),
-                (a) -> assertCommand(a, "/db", "|  Debugging off\n")
+                (a) -> assertCommand(a, "/deb", "|  Debugging off\n")
         );
     }
 
@@ -295,106 +296,70 @@
 
     public void defineVariables() {
         test(
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
                 (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 (a) -> assertVariable(a, "int", "a"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
                 (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 (a) -> assertVariable(a, "double", "a", "1", "1.0"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
                 (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 (a) -> evaluateExpression(a, "double", "2 * a", "2.0"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
                 (a) -> assertCommandCheckOutput(a, "/vars", assertVariables())
         );
     }
 
     public void defineMethods() {
         test(
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
                 (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 (a) -> assertMethod(a, "int f() { return 0; }", "()int", "f"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
                 (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 (a) -> assertMethod(a, "void f(int a) { g(); }", "(int)void", "f"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
                 (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 (a) -> assertMethod(a, "void g() {}", "()void", "g"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
                 (a) -> assertCommandCheckOutput(a, "/methods", assertMethods())
         );
     }
 
     public void defineClasses() {
         test(
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
                 (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
                 (a) -> assertClass(a, "class A { }", "class", "A"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
                 (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
                 (a) -> assertClass(a, "interface A { }", "interface", "A"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
                 (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
                 (a) -> assertClass(a, "enum A { }", "enum", "A"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
                 (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
                 (a) -> assertClass(a, "@interface A { }", "@interface", "A"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
                 (a) -> assertCommandCheckOutput(a, "/classes", assertClasses())
         );
     }
 
     public void defineImports() {
         test(
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/i", assertImports()),
                 (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
                 (a) -> assertImport(a, "import java.util.stream.Stream;", "", "java.util.stream.Stream"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/i", assertImports()),
                 (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
                 (a) -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/i", assertImports()),
                 (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
                 (a) -> assertImport(a, "import static java.lang.Math.PI;", "static", "java.lang.Math.PI"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/i", assertImports()),
                 (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
                 (a) -> assertImport(a, "import static java.lang.Math.*;", "static", "java.lang.Math.*"),
-                (a) -> assertCommandCheckOutput(a, "/l", assertList()),
                 (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/i", assertImports()),
                 (a) -> assertCommandCheckOutput(a, "/imports", assertImports())
         );
     }
@@ -405,7 +370,7 @@
         compiler.compile(outDir, "package pkg; public class A { public String toString() { return \"A\"; } }");
         Path classpath = compiler.getPath(outDir);
         test(
-                (a) -> assertCommand(a, "/cp " + classpath, String.format("|  Path %s added to classpath\n", classpath)),
+                (a) -> assertCommand(a, "/classpath " + classpath, String.format("|  Path %s added to classpath\n", classpath)),
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"A\"")
         );
         test(new String[] { "-cp", classpath.toString() },
@@ -471,20 +436,20 @@
     public void testReset() {
         test(
                 (a) -> assertReset(a, "/r"),
-                (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 (a) -> assertVariable(a, "int", "x"),
-                (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 (a) -> assertMethod(a, "void f() { }", "()void", "f"),
-                (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 (a) -> assertClass(a, "class A { }", "class", "A"),
-                (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
+                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
                 (a) -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
-                (a) -> assertCommandCheckOutput(a, "/i", assertImports()),
+                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
                 (a) -> assertReset(a, "/reset"),
-                (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
-                (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
-                (a) -> assertCommandCheckOutput(a, "/c", assertClasses()),
-                (a) -> assertCommandCheckOutput(a, "/i", assertImports())
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                (a) -> assertCommandCheckOutput(a, "/imports", assertImports())
         );
     }
 
@@ -508,11 +473,11 @@
                         loadClass(a, "class A { public String toString() { return \"A\"; } }",
                                 "class", "A");
                         loadImport(a, "import java.util.stream.*;", "", "java.util.stream.*");
-                        assertCommandCheckOutput(a, "/c", assertClasses());
+                        assertCommandCheckOutput(a, "/classes", assertClasses());
                     },
-                    (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
-                    (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
-                    (a) -> assertCommandCheckOutput(a, "/i", assertImports())
+                    (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                    (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                    (a) -> assertCommandCheckOutput(a, "/imports", assertImports())
             );
             Path unknown = compiler.getPath("UNKNOWN.repl");
             test(
@@ -531,15 +496,13 @@
                 "int a;",
                 "class A { public String toString() { return \"A\"; } }"
         );
-        for (String s : new String[]{"/s", "/save"}) {
-            test(
-                    (a) -> assertVariable(a, "int", "a"),
-                    (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"),
-                    (a) -> assertCommand(a, s + " " + path.toString(), "")
-            );
-            assertEquals(Files.readAllLines(path), list);
-        }
-        for (String s : new String[]{"/s", "/save"}) {
+        test(
+                (a) -> assertVariable(a, "int", "a"),
+                (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"),
+                (a) -> assertCommand(a, "/save " + path.toString(), "")
+        );
+        assertEquals(Files.readAllLines(path), list);
+        {
             List<String> output = new ArrayList<>();
             test(
                     (a) -> assertCommand(a, "int a;", null),
@@ -550,24 +513,22 @@
                                     .map(str -> str.substring(str.indexOf(':') + 2))
                                     .filter(str -> !str.startsWith("/"))
                                     .collect(Collectors.toList()))),
-                    (a) -> assertCommand(a, s + " all " + path.toString(), "")
+                    (a) -> assertCommand(a, "/save all " + path.toString(), "")
             );
             assertEquals(Files.readAllLines(path), output);
         }
-        for (String s : new String[]{"/s", "/save"}) {
-            List<String> output = new ArrayList<>();
-            test(
-                    (a) -> assertVariable(a, "int", "a"),
-                    (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"),
-                    (a) -> assertCommandCheckOutput(a, "/h", (out) ->
-                            output.addAll(Stream.of(out.split("\n"))
-                                    .filter(str -> !str.isEmpty())
-                                    .collect(Collectors.toList()))),
-                    (a) -> assertCommand(a, s + " history " + path.toString(), "")
-            );
-            output.add(s + " history " + path.toString());
-            assertEquals(Files.readAllLines(path), output);
-        }
+        List<String> output = new ArrayList<>();
+        test(
+                (a) -> assertVariable(a, "int", "a"),
+                (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"),
+                (a) -> assertCommandCheckOutput(a, "/history", (out) ->
+                        output.addAll(Stream.of(out.split("\n"))
+                                .filter(str -> !str.isEmpty())
+                                .collect(Collectors.toList()))),
+                (a) -> assertCommand(a, "/save history " + path.toString(), "")
+        );
+        output.add("/save history " + path.toString());
+        assertEquals(Files.readAllLines(path), output);
     }
 
     public void testStartSet() throws BackingStoreException {
@@ -579,7 +540,7 @@
                     (a) -> assertVariable(a, "double", "b", "10", "10.0"),
                     (a) -> assertMethod(a, "void f() {}", "()V", "f"),
                     (a) -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
-                    (a) -> assertCommand(a, "/s " + startUpFile.toString(), null),
+                    (a) -> assertCommand(a, "/save " + startUpFile.toString(), null),
                     (a) -> assertCommand(a, "/setstart " + startUpFile.toString(), null)
             );
             Path unknown = compiler.getPath("UNKNOWN");
@@ -593,11 +554,11 @@
                         loadVariable(a, "double", "b", "10.0", "10.0");
                         loadMethod(a, "void f() {}", "()void", "f");
                         loadImport(a, "import java.util.stream.*;", "", "java.util.stream.*");
-                        assertCommandCheckOutput(a, "/c", assertClasses());
+                        assertCommandCheckOutput(a, "/classes", assertClasses());
                     },
-                    (a) -> assertCommandCheckOutput(a, "/v", assertVariables()),
-                    (a) -> assertCommandCheckOutput(a, "/m", assertMethods()),
-                    (a) -> assertCommandCheckOutput(a, "/i", assertImports())
+                    (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                    (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                    (a) -> assertCommandCheckOutput(a, "/imports", assertImports())
             );
         } finally {
             removeStartup();
@@ -618,24 +579,14 @@
     }
 
     public void testEmptyClassPath() {
-        String[] commands = {"/cp", "/classpath"};
-        test(Stream.of(commands)
-                .map(cmd -> (ReplTest) after -> assertCommand(after, cmd, "|  /classpath requires a path argument\n"))
-                .toArray(ReplTest[]::new));
-
+        test(after -> assertCommand(after, "/classpath", "|  /classpath requires a path argument\n"));
     }
 
     public void testNoArgument() {
-        String[] commands = {"/s", "/save", "/o", "/open", "/setstart", "/savestart"};
+        String[] commands = {"/save", "/open", "/setstart"};
         test(Stream.of(commands)
                 .map(cmd -> {
                     String c = cmd;
-                    if ("/s".equals(cmd)) {
-                        c = "/save";
-                    }
-                    if ("/o".equals(cmd)) {
-                        c = "/open";
-                    }
                     final String finalC = c;
                     return (ReplTest) after -> assertCommand(after, cmd,
                             "|  The " + finalC + " command requires a filename argument.\n");
@@ -646,7 +597,7 @@
     public void testStartSave() throws IOException {
         Compiler compiler = new Compiler();
         Path startSave = compiler.getPath("startSave.txt");
-        test(a -> assertCommand(a, "/savestart " + startSave.toString(), null));
+        test(a -> assertCommand(a, "/save start " + startSave.toString(), null));
         List<String> lines = Files.lines(startSave)
                 .filter(s -> !s.isEmpty())
                 .collect(Collectors.toList());
@@ -673,49 +624,42 @@
     public void testRemoteExit() {
         test(
                 a -> assertVariable(a, "int", "x"),
-                a -> assertCommandCheckOutput(a, "/v", assertVariables()),
+                a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 a -> assertCommandCheckOutput(a, "System.exit(5);",  s ->
                         assertTrue(s.contains("terminated"), s)),
-                a -> assertCommandCheckOutput(a, "/v", s ->
+                a -> assertCommandCheckOutput(a, "/vars", s ->
                         assertTrue(s.trim().isEmpty(), s)),
                 a -> assertMethod(a, "void f() { }", "()void", "f"),
-                a -> assertCommandCheckOutput(a, "/m", assertMethods())
+                a -> assertCommandCheckOutput(a, "/methods", assertMethods())
         );
     }
 
     public void testListArgs() {
-        Consumer<String> assertList = s -> assertTrue(s.split("\n").length >= 7, s);
+        Consumer<String> assertList = s -> assertTrue(s.split("\n").length >= 4, s);
         String arg = "qqqq";
         Consumer<String> assertError = s -> assertEquals(s, "|  Invalid /list argument: " + arg + "\n");
         test(
-                a -> assertCommandCheckOutput(a, "/l all", assertList),
                 a -> assertCommandCheckOutput(a, "/list all", assertList),
-                a -> assertCommandCheckOutput(a, "/l " + arg, assertError),
                 a -> assertCommandCheckOutput(a, "/list " + arg, assertError),
                 a -> assertVariable(a, "int", "a"),
-                a -> assertCommandCheckOutput(a, "/l history", assertList),
                 a -> assertCommandCheckOutput(a, "/list history", assertList)
         );
     }
 
     public void testFeedbackNegative() {
-        for (String feedback : new String[]{"/f", "/feedback"}) {
-            test(a -> assertCommandCheckOutput(a, feedback + " aaaa",
-                    assertStartsWith("|  Follow /feedback with of the following")));
-        }
+        test(a -> assertCommandCheckOutput(a, "/feedback aaaa",
+                assertStartsWith("|  Follow /feedback with of the following")));
     }
 
     public void testFeedbackOff() {
-        for (String feedback : new String[]{"/f", "/feedback"}) {
-            for (String off : new String[]{"o", "off"}) {
-                test(
-                        a -> assertCommand(a, feedback + " " + off, ""),
-                        a -> assertCommand(a, "int a", ""),
-                        a -> assertCommand(a, "void f() {}", ""),
-                        a -> assertCommandCheckOutput(a, "aaaa", assertStartsWith("|  Error:")),
-                        a -> assertCommandCheckOutput(a, "public void f() {}", assertStartsWith("|  Warning:"))
-                );
-            }
+        for (String off : new String[]{"o", "off"}) {
+            test(
+                    a -> assertCommand(a, "/feedback " + off, ""),
+                    a -> assertCommand(a, "int a", ""),
+                    a -> assertCommand(a, "void f() {}", ""),
+                    a -> assertCommandCheckOutput(a, "aaaa", assertStartsWith("|  Error:")),
+                    a -> assertCommandCheckOutput(a, "public void f() {}", assertStartsWith("|  Warning:"))
+            );
         }
     }
 
@@ -724,17 +668,15 @@
         Path testConciseFile = compiler.getPath("testConciseFeedback");
         String[] sources = new String[] {"int a", "void f() {}", "class A {}", "a = 10"};
         compiler.writeToFile(testConciseFile, sources);
-        for (String feedback : new String[]{"/f", "/feedback"}) {
-            for (String concise : new String[]{"c", "concise"}) {
-                test(
-                        a -> assertCommand(a, feedback + " " + concise, ""),
-                        a -> assertCommand(a, sources[0], ""),
-                        a -> assertCommand(a, sources[1], ""),
-                        a -> assertCommand(a, sources[2], ""),
-                        a -> assertCommand(a, sources[3], "|  a : 10\n"),
-                        a -> assertCommand(a, "/o " + testConciseFile.toString(), "|  a : 10\n")
-                );
-            }
+        for (String concise : new String[]{"c", "concise"}) {
+            test(
+                    a -> assertCommand(a, "/feedback " + concise, ""),
+                    a -> assertCommand(a, sources[0], ""),
+                    a -> assertCommand(a, sources[1], ""),
+                    a -> assertCommand(a, sources[2], ""),
+                    a -> assertCommand(a, sources[3], "|  a : 10\n"),
+                    a -> assertCommand(a, "/o " + testConciseFile.toString(), "|  a : 10\n")
+            );
         }
     }
 
@@ -788,65 +730,59 @@
                 "|  Variable a has been assigned the value 10\n"
         };
         compiler.writeToFile(testDefaultFile, sources);
-        for (String feedback : new String[]{"/f", "/feedback"}) {
-            for (String defaultFeedback : new String[]{"", "d", "default"}) {
-                test(
-                        a -> assertCommand(a, "/f o", ""),
-                        a -> assertCommand(a, "int x", ""),
-                        a -> assertCommand(a, feedback + " " + defaultFeedback, "|  Feedback mode: default\n"),
-                        a -> assertCommand(a, sources[0], output[0]),
-                        a -> assertCommand(a, sources[1], output[1]),
-                        a -> assertCommand(a, sources[2], output[2]),
-                        a -> assertCommand(a, sources[3], output[3]),
-                        a -> assertCommand(a, "/o " + testDefaultFile.toString(), "")
-                );
-            }
+        for (String defaultFeedback : new String[]{"", "d", "default"}) {
+            test(
+                    a -> assertCommand(a, "/feedback o", ""),
+                    a -> assertCommand(a, "int x", ""),
+                    a -> assertCommand(a, "/feedback " + defaultFeedback, "|  Feedback mode: default\n"),
+                    a -> assertCommand(a, sources[0], output[0]),
+                    a -> assertCommand(a, sources[1], output[1]),
+                    a -> assertCommand(a, sources[2], output[2]),
+                    a -> assertCommand(a, sources[3], output[3]),
+                    a -> assertCommand(a, "/o " + testDefaultFile.toString(), "")
+            );
         }
     }
 
     public void testDrop() {
-        for (String drop : new String[]{"/d", "/drop"}) {
-            test(false, new String[]{"-nostartup"},
-                    a -> assertVariable(a, "int", "a"),
-                    a -> dropVariable(a, drop + " 1", "int a = 0"),
-                    a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                    a -> dropMethod(a, drop + " 2", "b ()I"),
-                    a -> assertClass(a, "class A {}", "class", "A"),
-                    a -> dropClass(a, drop + " 3", "class A"),
-                    a -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
-                    a -> dropImport(a, drop + " 4", "import java.util.stream.*"),
-                    a -> assertCommandCheckOutput(a, "/v", assertVariables()),
-                    a -> assertCommandCheckOutput(a, "/m", assertMethods()),
-                    a -> assertCommandCheckOutput(a, "/c", assertClasses()),
-                    a -> assertCommandCheckOutput(a, "/i", assertImports())
-            );
-            test(false, new String[]{"-nostartup"},
-                    a -> assertVariable(a, "int", "a"),
-                    a -> dropVariable(a, drop + " a", "int a = 0"),
-                    a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                    a -> dropMethod(a, drop + " b", "b ()I"),
-                    a -> assertClass(a, "class A {}", "class", "A"),
-                    a -> dropClass(a, drop + " A", "class A"),
-                    a -> assertCommandCheckOutput(a, "/v", assertVariables()),
-                    a -> assertCommandCheckOutput(a, "/m", assertMethods()),
-                    a -> assertCommandCheckOutput(a, "/c", assertClasses()),
-                    a -> assertCommandCheckOutput(a, "/i", assertImports())
-            );
-        }
+        test(false, new String[]{"-nostartup"},
+                a -> assertVariable(a, "int", "a"),
+                a -> dropVariable(a, "/drop 1", "int a = 0"),
+                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
+                a -> dropMethod(a, "/drop 2", "b ()I"),
+                a -> assertClass(a, "class A {}", "class", "A"),
+                a -> dropClass(a, "/drop 3", "class A"),
+                a -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
+                a -> dropImport(a, "/drop 4", "import java.util.stream.*"),
+                a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                a -> assertCommandCheckOutput(a, "/imports", assertImports())
+        );
+        test(false, new String[]{"-nostartup"},
+                a -> assertVariable(a, "int", "a"),
+                a -> dropVariable(a, "/drop a", "int a = 0"),
+                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
+                a -> dropMethod(a, "/drop b", "b ()I"),
+                a -> assertClass(a, "class A {}", "class", "A"),
+                a -> dropClass(a, "/drop A", "class A"),
+                a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                a -> assertCommandCheckOutput(a, "/imports", assertImports())
+        );
     }
 
     public void testDropNegative() {
-        for (String drop : new String[]{"/d", "/drop"}) {
-            test(false, new String[]{"-nostartup"},
-                    a -> assertCommand(a, drop + " 0", "|  No definition or id named 0 found.  See /classes /methods /vars or /list\n"),
-                    a -> assertCommand(a, drop + " a", "|  No definition or id named a found.  See /classes /methods /vars or /list\n"),
-                    a -> assertCommandCheckOutput(a, drop,
-                            assertStartsWith("|  In the /drop argument, please specify an import, variable, method, or class to drop.")),
-                    a -> assertVariable(a, "int", "a"),
-                    a -> assertCommand(a, "a", "|  Variable a of type int has value 0\n"),
-                    a -> assertCommand(a, drop + " 2", "|  The argument did not specify an import, variable, method, or class to drop.\n")
-            );
-        }
+        test(false, new String[]{"-nostartup"},
+                a -> assertCommand(a, "/drop 0", "|  No definition or id named 0 found.  See /classes /methods /vars or /list\n"),
+                a -> assertCommand(a, "/drop a", "|  No definition or id named a found.  See /classes /methods /vars or /list\n"),
+                a -> assertCommandCheckOutput(a, "/drop",
+                        assertStartsWith("|  In the /drop argument, please specify an import, variable, method, or class to drop.")),
+                a -> assertVariable(a, "int", "a"),
+                a -> assertCommand(a, "a", "|  Variable a of type int has value 0\n"),
+                a -> assertCommand(a, "/drop 2", "|  The argument did not specify an import, variable, method, or class to drop.\n")
+        );
     }
 
     public void testAmbiguousDrop() {
@@ -855,25 +791,23 @@
             int lines = s.split("\n").length;
             assertEquals(lines, 5, "Expected 3 ambiguous keys, but found: " + (lines - 2) + "\n" + s);
         };
-        for (String drop : new String[]{"/d", "/drop"}) {
-            test(
-                    a -> assertVariable(a, "int", "a"),
-                    a -> assertMethod(a, "int a() { return 0; }", "()int", "a"),
-                    a -> assertClass(a, "class a {}", "class", "a"),
-                    a -> assertCommandCheckOutput(a, drop + " a", check),
-                    a -> assertCommandCheckOutput(a, "/v", assertVariables()),
-                    a -> assertCommandCheckOutput(a, "/m", assertMethods()),
-                    a -> assertCommandCheckOutput(a, "/c", assertClasses()),
-                    a -> assertCommandCheckOutput(a, "/i", assertImports())
-            );
-            test(
-                    a -> assertMethod(a, "int a() { return 0; }", "()int", "a"),
-                    a -> assertMethod(a, "double a(int a) { return 0; }", "(int)double", "a"),
-                    a -> assertMethod(a, "double a(double a) { return 0; }", "(double)double", "a"),
-                    a -> assertCommandCheckOutput(a, drop + " a", check),
-                    a -> assertCommandCheckOutput(a, "/m", assertMethods())
-            );
-        }
+        test(
+                a -> assertVariable(a, "int", "a"),
+                a -> assertMethod(a, "int a() { return 0; }", "()int", "a"),
+                a -> assertClass(a, "class a {}", "class", "a"),
+                a -> assertCommandCheckOutput(a, "/drop a", check),
+                a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                a -> assertCommandCheckOutput(a, "/imports", assertImports())
+        );
+        test(
+                a -> assertMethod(a, "int a() { return 0; }", "()int", "a"),
+                a -> assertMethod(a, "double a(int a) { return 0; }", "(int)double", "a"),
+                a -> assertMethod(a, "double a(double a) { return 0; }", "(double)double", "a"),
+                a -> assertCommandCheckOutput(a, "/drop a", check),
+                a -> assertCommandCheckOutput(a, "/methods", assertMethods())
+        );
     }
 
     public void testHistoryReference() {
@@ -893,4 +827,14 @@
                 a -> assertCommand(a, "/1", "System.err.println(1)\n", "", null, "", "1\n")
         );
     }
+
+    public void testCommandPrefix() {
+        test(a -> assertCommandCheckOutput(a, "/s",
+                      assertStartsWith("|  Command: /s is ambiguous: /seteditor, /save, /setstart")),
+             a -> assertCommand(a, "int var", "|  Added variable var of type int\n"),
+             a -> assertCommandCheckOutput(a, "/va",
+                      assertStartsWith("|    int var = 0")),
+             a -> assertCommandCheckOutput(a, "/save",
+                      assertStartsWith("|  The /save command requires a filename argument.")));
+    }
 }
--- a/test/tools/javac/diags/examples/DiamondRedundantArgs1.java	Sun Nov 29 11:00:10 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.warn.diamond.redundant.args.1
-// options: -XDfind=diamond
-
-class DiamondRedundantArgs1<X> {
-   DiamondRedundantArgs1<?> fs = new DiamondRedundantArgs1<String>();
-}
--- a/test/tools/javac/generics/diamond/6939780/T6939780_7.out	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/javac/generics/diamond/6939780/T6939780_7.out	Mon Nov 30 13:27:57 2015 -0800
@@ -1,5 +1,3 @@
 T6939780.java:22:28: compiler.warn.diamond.redundant.args
-T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
 T6939780.java:31:19: compiler.warn.diamond.redundant.args
-T6939780.java:32:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
-4 warnings
+2 warnings
--- a/test/tools/javac/generics/diamond/6939780/T6939780_8.out	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/javac/generics/diamond/6939780/T6939780_8.out	Mon Nov 30 13:27:57 2015 -0800
@@ -1,7 +1,5 @@
 T6939780.java:21:33: compiler.warn.diamond.redundant.args
 T6939780.java:22:28: compiler.warn.diamond.redundant.args
-T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
 T6939780.java:30:19: compiler.warn.diamond.redundant.args
 T6939780.java:31:19: compiler.warn.diamond.redundant.args
-T6939780.java:32:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
-6 warnings
+4 warnings
--- a/test/tools/javac/generics/diamond/6939780/T6939780_9.out	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/javac/generics/diamond/6939780/T6939780_9.out	Mon Nov 30 13:27:57 2015 -0800
@@ -1,13 +1,9 @@
 T6939780.java:21:33: compiler.warn.diamond.redundant.args
 T6939780.java:22:28: compiler.warn.diamond.redundant.args
-T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
 T6939780.java:24:33: compiler.warn.diamond.redundant.args
 T6939780.java:25:28: compiler.warn.diamond.redundant.args
-T6939780.java:26:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
 T6939780.java:30:19: compiler.warn.diamond.redundant.args
 T6939780.java:31:19: compiler.warn.diamond.redundant.args
-T6939780.java:32:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
 T6939780.java:33:19: compiler.warn.diamond.redundant.args
 T6939780.java:34:19: compiler.warn.diamond.redundant.args
-T6939780.java:35:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
-12 warnings
+8 warnings
--- a/test/tools/javac/generics/diamond/7002837/T7002837.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/javac/generics/diamond/7002837/T7002837.java	Mon Nov 30 13:27:57 2015 -0800
@@ -1,10 +1,34 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 7002837 8064365
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 7002837 8064365 8078660
  *
  * @summary  Diamond: javac generates diamond inference errors when in 'finder' mode
  * @author mcimadamore
- * @compile/fail/ref=T7002837.out -Werror -XDrawDiagnostics -XDfind=diamond T7002837.java
+ * @compile -Werror -XDrawDiagnostics -XDfind=diamond T7002837.java
  *
  */
 
--- a/test/tools/javac/generics/diamond/7002837/T7002837.out	Sun Nov 29 11:00:10 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-T7002837.java:13:19: compiler.warn.diamond.redundant.args.1: T7002837<java.lang.Integer>, T7002837<java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>
-- compiler.err.warnings.and.werror
-1 error
-1 warning
--- a/test/tools/javac/generics/diamond/neg/T8078473.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/javac/generics/diamond/neg/T8078473.java	Mon Nov 30 13:27:57 2015 -0800
@@ -1,8 +1,32 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 8078473
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8078473 8078660
  * @summary  javac diamond finder crashes when used to build java.base module
- * @compile/ref=T8078473.out T8078473.java -XDrawDiagnostics -XDfind=diamond
+ * @compile -Werror T8078473.java -XDrawDiagnostics -XDfind=diamond
  */
 
 class T8078473<P, Q> {
--- a/test/tools/javac/generics/diamond/neg/T8078473.out	Sun Nov 29 11:00:10 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-T8078473.java:15:14: compiler.warn.diamond.redundant.args.1: T8078473.C<Q,Q>, T8078473.C<java.lang.Object,java.lang.Object>
-T8078473.java:16:14: compiler.warn.diamond.redundant.args.1: T8078473.C<Q,Q>, T8078473.C<java.lang.Object,java.lang.Object>
-2 warnings
--- a/test/tools/javac/generics/diamond/neg/T8078473_2.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/javac/generics/diamond/neg/T8078473_2.java	Mon Nov 30 13:27:57 2015 -0800
@@ -1,8 +1,32 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 8078473
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8078473 8078660
  * @summary  javac diamond finder crashes when used to build java.base module
- * @compile/ref=T8078473_2.out T8078473_2.java -XDrawDiagnostics -XDfind=diamond
+ * @compile -Werror T8078473_2.java -XDrawDiagnostics -XDfind=diamond
  */
 
 package java.util.stream;
--- a/test/tools/javac/generics/diamond/neg/T8078473_2.out	Sun Nov 29 11:00:10 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-T8078473_2.java:17:13: compiler.warn.diamond.redundant.args.1: java.util.stream.T8078473_2.C<Q,Q>, java.util.stream.T8078473_2.C<java.lang.Object,java.lang.Object>
-T8078473_2.java:18:13: compiler.warn.diamond.redundant.args.1: java.util.stream.T8078473_2.C<Q,Q>, java.util.stream.T8078473_2.C<java.lang.Object,java.lang.Object>
-2 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference75.java	Mon Nov 30 13:27:57 2015 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8143647
+ * @summary Javac compiles method reference that allows results in an IllegalAccessError
+ * @run main MethodReference75
+ */
+
+import pkg.PublicDerived8143647;
+
+public class MethodReference75 {
+    public static void main(String[] args) {
+        if (java.util.Arrays
+                .asList(new PublicDerived8143647())
+                .stream()
+                .map(PublicDerived8143647::getX)
+                .findFirst()
+                .get()
+                .equals("PackagePrivateBase"))
+            System.out.println("OK");
+        else
+            throw new AssertionError("Unexpected output");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/pkg/PublicDerived8143647.java	Mon Nov 30 13:27:57 2015 -0800
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+abstract class PackagePrivateBase8143647 {
+    public String getX() {
+        return "PackagePrivateBase";
+    }
+}
+
+public class PublicDerived8143647 extends PackagePrivateBase8143647 {
+}
--- a/test/tools/lib/ToolBox.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/lib/ToolBox.java	Mon Nov 30 13:27:57 2015 -0800
@@ -274,6 +274,34 @@
     }
 
     /**
+     * Deletes all content of a directory (but not the directory itself).
+     * @param root the directory to be cleaned
+     */
+    public void cleanDirectory(Path root) throws IOException {
+        if (!Files.isDirectory(root)) {
+            throw new IOException(root + " is not a directory");
+        }
+        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes a) throws IOException {
+                Files.delete(file);
+                return FileVisitResult.CONTINUE;
+            }
+
+            @Override
+            public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
+                if (e != null) {
+                    throw e;
+                }
+                if (!dir.equals(root)) {
+                    Files.delete(dir);
+                }
+                return FileVisitResult.CONTINUE;
+            }
+        });
+    }
+
+    /**
      * Moves a file.
      * If the given destination exists and is a directory, the file will be moved
      * to that directory.  Otherwise, the file will be moved to the destination,
--- a/test/tools/sjavac/CompileCircularSources.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/CompileCircularSources.java	Mon Nov 30 13:27:57 2015 -0800
@@ -36,6 +36,7 @@
  * @run main Wrapper CompileCircularSources
  */
 
+import java.io.IOException;
 import java.util.*;
 import java.nio.file.*;
 
@@ -46,13 +47,11 @@
     }
 
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(BIN);
-        clean(GENSRC, BIN);
+        Files.createDirectories(GENSRC);
 
         Map<String,Long> previous_bin_state = collectState(BIN);
 
-        ToolBox tb = new ToolBox();
         tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
                      "package alfa.omega; public class A { beta.B b; }");
         tb.writeFile(GENSRC.resolve("beta/B.java"),
@@ -74,6 +73,5 @@
                                      BIN + "/beta/B.class",
                                      BIN + "/gamma/C.class",
                                      BIN + "/javac_state");
-        clean(GENSRC, BIN);
     }
 }
--- a/test/tools/sjavac/CompileExcludingDependency.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/CompileExcludingDependency.java	Mon Nov 30 13:27:57 2015 -0800
@@ -47,9 +47,7 @@
 
     // Verify that excluding classes from compilation but not from linking works
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(BIN);
-        clean(GENSRC,BIN);
         Map<String,Long> previous_bin_state = collectState(BIN);
         ToolBox tb = new ToolBox();
         tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
@@ -69,6 +67,5 @@
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
                                      BIN + "/alfa/omega/A.class",
                                      BIN + "/javac_state");
-        clean(GENSRC, BIN);
     }
 }
--- a/test/tools/sjavac/CompileWithAtFile.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/CompileWithAtFile.java	Mon Nov 30 13:27:57 2015 -0800
@@ -46,8 +46,6 @@
     }
 
     void test() throws Exception {
-        clean(TEST_ROOT);
-        ToolBox tb = new ToolBox();
         tb.writeFile(GENSRC.resolve("list.txt"),
                      "-if */alfa/omega/A.java\n" +
                      "-if */beta/B.java\n" +
@@ -55,11 +53,11 @@
                      "-d " + BIN + "\n" +
                      "--state-dir=" + BIN + "\n");
         tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
-                 "package alfa.omega; import beta.B; public class A { B b; }");
+                     "package alfa.omega; import beta.B; public class A { B b; }");
         tb.writeFile(GENSRC.resolve("beta/B.java"),
-                 "package beta; public class B { }");
+                     "package beta; public class B { }");
         tb.writeFile(GENSRC.resolve("beta/C.java"),
-                 "broken");
+                     "broken");
 
         Files.createDirectory(BIN);
         Map<String,Long> previous_bin_state = collectState(BIN);
@@ -71,6 +69,5 @@
                          BIN + "/javac_state",
                          BIN + "/alfa/omega/A.class",
                          BIN + "/beta/B.class");
-        clean(GENSRC, BIN);
     }
 }
--- a/test/tools/sjavac/CompileWithInvisibleSources.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/CompileWithInvisibleSources.java	Mon Nov 30 13:27:57 2015 -0800
@@ -49,9 +49,7 @@
     // gensrc2 contains broken code in beta.B, thus exclude that package
     // gensrc3 contains a proper beta.B
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(BIN);
-        clean(GENSRC, GENSRC2, GENSRC3, BIN);
 
         Map<String,Long> previous_bin_state = collectState(BIN);
 
@@ -82,7 +80,7 @@
                                      BIN + "/javac_state");
 
         System.out.println("----- Compile with exluded beta went well!");
-        clean(BIN);
+        tb.cleanDirectory(BIN);
         compileExpectFailure(GENSRC.toString(),
                              "-sourcepath", GENSRC2.toString(),
                              "-sourcepath", GENSRC3.toString(),
@@ -93,6 +91,5 @@
                              SERVER_ARG);
 
         System.out.println("----- Compile without exluded beta failed, as expected! Good!");
-        clean(GENSRC, BIN);
     }
 }
--- a/test/tools/sjavac/CompileWithOverrideSources.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/CompileWithOverrideSources.java	Mon Nov 30 13:27:57 2015 -0800
@@ -48,9 +48,7 @@
     // Compile gensrc and gensrc2. However do not compile broken beta.B in gensrc,
     // only compile ok beta.B in gensrc2
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(BIN);
-        clean(GENSRC, GENSRC2, GENSRC3, BIN);
 
         Map<String,Long> previous_bin_state = collectState(BIN);
         ToolBox tb = new ToolBox();
@@ -80,7 +78,7 @@
                                      BIN + "/javac_state");
 
         System.out.println("----- Compile with exluded beta went well!");
-        clean(BIN);
+        tb.cleanDirectory(BIN);
         compileExpectFailure(GENSRC.toString(),
                              GENSRC2.toString(),
                              "-d", BIN.toString(),
@@ -90,6 +88,5 @@
                              SERVER_ARG);
 
         System.out.println("----- Compile without exluded beta failed, as expected! Good!");
-        clean(GENSRC, GENSRC2, BIN);
     }
 }
--- a/test/tools/sjavac/IncCompileChangeNative.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/IncCompileChangeNative.java	Mon Nov 30 13:27:57 2015 -0800
@@ -51,7 +51,6 @@
     ToolBox tb = new ToolBox();
 
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(GENSRC);
         Files.createDirectories(BIN);
         Files.createDirectories(HEADERS);
@@ -59,8 +58,6 @@
         initialCompile();
         incrementalCompileDropAllNatives();
         incrementalCompileAddNative();
-
-        clean(GENSRC, BIN, HEADERS);
     }
 
     // Update B.java with one less native method i.e. it has no longer any methods
--- a/test/tools/sjavac/IncCompileDropClasses.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/IncCompileDropClasses.java	Mon Nov 30 13:27:57 2015 -0800
@@ -51,15 +51,12 @@
     ToolBox tb = new ToolBox();
 
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(GENSRC);
         Files.createDirectories(BIN);
         Files.createDirectories(HEADERS);
 
         initialCompile();
         incrementalCompileDroppingClasses();
-
-        clean(GENSRC, BIN, HEADERS);
     }
 
     // Testing that deleting AA.java deletes all generated inner class including AA.class
--- a/test/tools/sjavac/IncCompileNoChanges.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/IncCompileNoChanges.java	Mon Nov 30 13:27:57 2015 -0800
@@ -50,15 +50,12 @@
     Map<String,Long> previous_headers_state;
 
     void test() throws Exception {
-        clean(Paths.get(getClass().getSimpleName()));
         Files.createDirectories(GENSRC);
         Files.createDirectories(BIN);
         Files.createDirectories(HEADERS);
 
         initialCompile();
         incrementalCompileNoChanges();
-
-        clean(GENSRC, BIN, HEADERS);
     }
 
     // Testing that no change in sources implies no change in binaries
--- a/test/tools/sjavac/IncCompileUpdateNative.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/IncCompileUpdateNative.java	Mon Nov 30 13:27:57 2015 -0800
@@ -51,15 +51,12 @@
     ToolBox tb = new ToolBox();
 
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(GENSRC);
         Files.createDirectories(BIN);
         Files.createDirectories(HEADERS);
 
         initialCompile();
         incrementalCompileChangeNative();
-
-        clean(GENSRC, BIN, HEADERS);
     }
 
     // Update B.java with a new value for the final static annotated with @Native
--- a/test/tools/sjavac/NoState.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/NoState.java	Mon Nov 30 13:27:57 2015 -0800
@@ -46,8 +46,6 @@
     }
 
     public void run() throws Exception {
-        clean(TEST_ROOT);
-        ToolBox tb = new ToolBox();
         tb.writeFile(GENSRC.resolve("pkg/A.java"), "package pkg; class A {}");
         Files.createDirectory(BIN);
         compile("-d", BIN.toString(),
--- a/test/tools/sjavac/PermittedArtifact.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/PermittedArtifact.java	Mon Nov 30 13:27:57 2015 -0800
@@ -47,9 +47,7 @@
 
     //Verify that --permit-artifact=bin works
     void test() throws Exception {
-        clean(TEST_ROOT);
         Files.createDirectories(BIN);
-        clean(GENSRC, BIN);
 
         Map<String,Long> previous_bin_state = collectState(BIN);
 
@@ -73,6 +71,5 @@
                                      BIN + "/alfa/omega/A.class",
                                      BIN + "/alfa/omega/AA.class",
                                      BIN + "/javac_state");
-        clean(GENSRC, BIN);
     }
 }
--- a/test/tools/sjavac/SJavacTester.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/SJavacTester.java	Mon Nov 30 13:27:57 2015 -0800
@@ -34,6 +34,7 @@
             + "portfile=testportfile,"
             + "background=false";
 
+    final ToolBox tb = new ToolBox();
     final Path TEST_ROOT = Paths.get(getClass().getSimpleName());
 
     // Generated sources that will test aspects of sjavac
@@ -53,7 +54,6 @@
 
     void initialCompile() throws Exception {
         System.out.println("\nInitial compile of gensrc.");
-        ToolBox tb = new ToolBox();
         tb.writeFile(GENSRC.resolve("alfa/omega/AINT.java"),
                      "package alfa.omega; public interface AINT { void aint(); }");
         tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
@@ -101,30 +101,6 @@
         }
     }
 
-    void delete(final Path root) throws IOException {
-        if (!Files.exists(root)) return;
-        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
-                 @Override
-                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
-                 {
-                     Files.delete(file);
-                     return FileVisitResult.CONTINUE;
-                 }
-
-                 @Override
-                 public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException
-                 {
-                     if (e == null) {
-                         if (!dir.equals(root)) Files.delete(dir);
-                         return FileVisitResult.CONTINUE;
-                     } else {
-                         // directory iteration failed
-                         throw e;
-                     }
-                 }
-            });
-    }
-
     void compile(String... args) throws Exception {
         int rc = Main.go(args);
         if (rc != 0) throw new Exception("Error during compile!");
@@ -265,10 +241,4 @@
             throw new Exception("The dir should not differ! But it does!");
         }
     }
-
-    void clean(Path... listOfDirs) throws Exception {
-        for (Path dir : listOfDirs) {
-            delete(dir);
-        }
-    }
 }
--- a/test/tools/sjavac/StateDir.java	Sun Nov 29 11:00:10 2015 -0800
+++ b/test/tools/sjavac/StateDir.java	Mon Nov 30 13:27:57 2015 -0800
@@ -46,7 +46,6 @@
     }
 
     void test() throws Exception {
-        clean(TEST_ROOT);
         Path BAR = TEST_ROOT.resolve("bar");
         Files.createDirectories(BAR);
         Files.createDirectories(BIN);
@@ -69,6 +68,5 @@
         Map<String,Long> new_bar_state = collectState(BAR);
         verifyThatFilesHaveBeenAdded(previous_bar_state, new_bar_state,
                                      BAR + "/javac_state");
-        clean(GENSRC, BIN, BAR);
     }
 }