changeset 3342:9326e37434ee

Merge
author lana
date Thu, 14 Apr 2016 09:34:00 -0700
parents 8d951a6e7fe5 a399f56c42aa
children eaa3ac6a778a
files
diffstat 14 files changed, 762 insertions(+), 624 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java	Thu Apr 14 09:34:00 2016 -0700
@@ -45,6 +45,7 @@
 import com.sun.tools.javac.main.Arguments;
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.file.BaseFileManager;
+import com.sun.tools.javac.file.CacheFSInfo;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
@@ -95,6 +96,7 @@
                 ? new PrintWriter(System.err, true)
                 : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
         context.put(Log.outKey, pw);
+        CacheFSInfo.preRegister(context);
         return new JavacFileManager(context, true, charset);
     }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Apr 14 09:34:00 2016 -0700
@@ -42,6 +42,7 @@
 import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.ProviderNotFoundException;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
@@ -266,30 +267,137 @@
         System.out.println(message);
     }
 
-    /**
-     * Insert all files in a subdirectory of the platform image
-     * which match fileKinds into resultList.
-     */
-    private void listJRTImage(RelativeDirectory subdirectory,
-                               Set<JavaFileObject.Kind> fileKinds,
-                               boolean recurse,
-                               ListBuffer<JavaFileObject> resultList) throws IOException {
-        JRTIndex.Entry e = getJRTIndex().getEntry(subdirectory);
-        if (symbolFileEnabled && e.ctSym.hidden)
-            return;
-        for (Path file: e.files.values()) {
-            if (fileKinds.contains(getKind(file))) {
-                JavaFileObject fe
-                        = PathFileObject.forJRTPath(JavacFileManager.this, file);
-                resultList.append(fe);
+    private final Map<Path, Container> containers = new HashMap<>();
+
+    synchronized Container getContainer(Path path) throws IOException {
+        Container fs = containers.get(path);
+
+        if (fs != null) {
+            return fs;
+        }
+
+        if (fsInfo.isFile(path) && path.equals(Locations.thisSystemModules)) {
+            containers.put(path, fs = new JRTImageContainer());
+            return fs;
+        }
+
+        Path realPath = fsInfo.getCanonicalFile(path);
+
+        fs = containers.get(realPath);
+
+        if (fs != null) {
+            containers.put(path, fs);
+            return fs;
+        }
+
+        BasicFileAttributes attr = null;
+
+        try {
+            attr = Files.readAttributes(realPath, BasicFileAttributes.class);
+        } catch (IOException ex) {
+            //non-existing
+            fs = MISSING_CONTAINER;
+        }
+
+        if (attr != null) {
+            if (attr.isDirectory()) {
+                fs = new DirectoryContainer(realPath);
+            } else {
+                try {
+                    fs = new ArchiveContainer(realPath);
+                } catch (ProviderNotFoundException | SecurityException ex) {
+                    throw new IOException(ex);
+                }
             }
         }
 
-        if (recurse) {
-            for (RelativeDirectory rd: e.subdirs) {
-                listJRTImage(rd, fileKinds, recurse, resultList);
+        containers.put(realPath, fs);
+        containers.put(path, fs);
+
+        return fs;
+    }
+
+    private interface Container {
+        /**
+         * Insert all files in subdirectory subdirectory of container which
+         * match fileKinds into resultList
+         */
+        public abstract void list(Path userPath,
+                                  RelativeDirectory subdirectory,
+                                  Set<JavaFileObject.Kind> fileKinds,
+                                  boolean recurse,
+                                  ListBuffer<JavaFileObject> resultList) throws IOException;
+        public abstract JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException;
+        public abstract void close() throws IOException;
+    }
+
+    private static final Container MISSING_CONTAINER =  new Container() {
+        @Override
+        public void list(Path userPath,
+                         RelativeDirectory subdirectory,
+                         Set<JavaFileObject.Kind> fileKinds,
+                         boolean recurse,
+                         ListBuffer<JavaFileObject> resultList) throws IOException {
+        }
+        @Override
+        public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
+            return null;
+        }
+        @Override
+        public void close() throws IOException {}
+    };
+
+    private final class JRTImageContainer implements Container {
+
+        /**
+         * Insert all files in a subdirectory of the platform image
+         * which match fileKinds into resultList.
+         */
+        @Override
+        public void list(Path userPath,
+                         RelativeDirectory subdirectory,
+                         Set<JavaFileObject.Kind> fileKinds,
+                         boolean recurse,
+                         ListBuffer<JavaFileObject> resultList) throws IOException {
+            try {
+                JRTIndex.Entry e = getJRTIndex().getEntry(subdirectory);
+                if (symbolFileEnabled && e.ctSym.hidden)
+                    return;
+                for (Path file: e.files.values()) {
+                    if (fileKinds.contains(getKind(file))) {
+                        JavaFileObject fe
+                                = PathFileObject.forJRTPath(JavacFileManager.this, file);
+                        resultList.append(fe);
+                    }
+                }
+
+                if (recurse) {
+                    for (RelativeDirectory rd: e.subdirs) {
+                        list(userPath, rd, fileKinds, recurse, resultList);
+                    }
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace(System.err);
+                log.error("error.reading.file", userPath, getMessage(ex));
             }
         }
+
+        @Override
+        public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
+            JRTIndex.Entry e = getJRTIndex().getEntry(name.dirname());
+            if (symbolFileEnabled && e.ctSym.hidden)
+                return null;
+            Path p = e.files.get(name.basename());
+            if (p != null) {
+                return PathFileObject.forJRTPath(JavacFileManager.this, p);
+            } else {
+                return null;
+            }
+        }
+
+        @Override
+        public void close() throws IOException {
+        }
     }
 
     private synchronized JRTIndex getJRTIndex() {
@@ -300,164 +408,179 @@
 
     private JRTIndex jrtIndex;
 
+    private final class DirectoryContainer implements Container {
+        private final Path directory;
 
-    /**
-     * Insert all files in subdirectory subdirectory of directory directory
-     * which match fileKinds into resultList
-     */
-    private void listDirectory(Path directory, Path realDirectory,
-                               RelativeDirectory subdirectory,
-                               Set<JavaFileObject.Kind> fileKinds,
-                               boolean recurse,
-                               ListBuffer<JavaFileObject> resultList) {
-        Path d;
-        try {
-            d = subdirectory.resolveAgainst(directory);
-        } catch (InvalidPathException ignore) {
-            return;
+        public DirectoryContainer(Path directory) {
+            this.directory = directory;
         }
 
-        if (!Files.exists(d)) {
-           return;
-        }
+        /**
+         * Insert all files in subdirectory subdirectory of directory userPath
+         * which match fileKinds into resultList
+         */
+        @Override
+        public void list(Path userPath,
+                         RelativeDirectory subdirectory,
+                         Set<JavaFileObject.Kind> fileKinds,
+                         boolean recurse,
+                         ListBuffer<JavaFileObject> resultList) throws IOException {
+            Path d;
+            try {
+                d = subdirectory.resolveAgainst(userPath);
+            } catch (InvalidPathException ignore) {
+                return ;
+            }
 
-        if (!caseMapCheck(d, subdirectory)) {
-            return;
-        }
+            if (!Files.exists(d)) {
+               return;
+            }
 
-        java.util.List<Path> files;
-        try (Stream<Path> s = Files.list(d)) {
-            files = (sortFiles == null ? s : s.sorted(sortFiles)).collect(Collectors.toList());
-        } catch (IOException ignore) {
-            return;
-        }
+            if (!caseMapCheck(d, subdirectory)) {
+                return;
+            }
 
-        if (realDirectory == null)
-            realDirectory = fsInfo.getCanonicalFile(directory);
+            java.util.List<Path> files;
+            try (Stream<Path> s = Files.list(d)) {
+                files = (sortFiles == null ? s : s.sorted(sortFiles)).collect(Collectors.toList());
+            } catch (IOException ignore) {
+                return;
+            }
 
-        for (Path f: files) {
-            String fname = f.getFileName().toString();
-            if (fname.endsWith("/"))
-                fname = fname.substring(0, fname.length() - 1);
-            if (Files.isDirectory(f)) {
-                if (recurse && SourceVersion.isIdentifier(fname)) {
-                    listDirectory(directory, realDirectory,
-                                  new RelativeDirectory(subdirectory, fname),
-                                  fileKinds,
-                                  recurse,
-                                  resultList);
-                }
-            } else {
-                if (isValidFile(fname, fileKinds)) {
-                    RelativeFile file = new RelativeFile(subdirectory, fname);
-                    JavaFileObject fe = PathFileObject.forDirectoryPath(this,
-                            file.resolveAgainst(realDirectory), directory, file);
-                    resultList.append(fe);
+            for (Path f: files) {
+                String fname = f.getFileName().toString();
+                if (fname.endsWith("/"))
+                    fname = fname.substring(0, fname.length() - 1);
+                if (Files.isDirectory(f)) {
+                    if (recurse && SourceVersion.isIdentifier(fname)) {
+                        list(userPath,
+                             new RelativeDirectory(subdirectory, fname),
+                             fileKinds,
+                             recurse,
+                             resultList);
+                    }
+                } else {
+                    if (isValidFile(fname, fileKinds)) {
+                        RelativeFile file = new RelativeFile(subdirectory, fname);
+                        JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this,
+                                file.resolveAgainst(directory), userPath, file);
+                        resultList.append(fe);
+                    }
                 }
             }
         }
-    }
 
-    /**
-     * Insert all files in subdirectory subdirectory of archive archivePath
-     * which match fileKinds into resultList
-     */
-    private void listArchive(Path archivePath,
-            RelativeDirectory subdirectory,
-            Set<JavaFileObject.Kind> fileKinds,
-            boolean recurse,
-            ListBuffer<JavaFileObject> resultList)
-                throws IOException {
-        FileSystem fs = getFileSystem(archivePath);
-        if (fs == null) {
-            return;
+        @Override
+        public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
+            try {
+                Path f = name.resolveAgainst(userPath);
+                if (Files.exists(f))
+                    return PathFileObject.forSimplePath(JavacFileManager.this,
+                            fsInfo.getCanonicalFile(f), f);
+            } catch (InvalidPathException ignore) {
+            }
+            return null;
         }
 
-        Path containerSubdir = subdirectory.resolveAgainst(fs);
-        if (!Files.exists(containerSubdir)) {
-            return;
-        }
-
-        int maxDepth = (recurse ? Integer.MAX_VALUE : 1);
-        Set<FileVisitOption> opts = EnumSet.of(FOLLOW_LINKS);
-        Files.walkFileTree(containerSubdir, opts, maxDepth,
-                new SimpleFileVisitor<Path>() {
-                    @Override
-                    public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
-                        if (isValid(dir.getFileName())) {
-                            return FileVisitResult.CONTINUE;
-                        } else {
-                            return FileVisitResult.SKIP_SUBTREE;
-                        }
-                    }
-
-                    boolean isValid(Path fileName) {
-                        if (fileName == null) {
-                            return true;
-                        } else {
-                            String name = fileName.toString();
-                            if (name.endsWith("/")) {
-                                name = name.substring(0, name.length() - 1);
-                            }
-                            return SourceVersion.isIdentifier(name);
-                        }
-                    }
-
-                    @Override
-                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
-                        if (attrs.isRegularFile() && fileKinds.contains(getKind(file.getFileName().toString()))) {
-                            JavaFileObject fe = PathFileObject.forJarPath(
-                                    JavacFileManager.this, file, archivePath);
-                            resultList.append(fe);
-                        }
-                        return FileVisitResult.CONTINUE;
-                    }
-                });
-
-    }
-
-    /**
-     * container is a directory, a zip file, or a non-existant path.
-     * Insert all files in subdirectory subdirectory of container which
-     * match fileKinds into resultList
-     */
-    private void listContainer(Path container,
-                               RelativeDirectory subdirectory,
-                               Set<JavaFileObject.Kind> fileKinds,
-                               boolean recurse,
-                               ListBuffer<JavaFileObject> resultList)
-            throws IOException {
-        if (Files.isRegularFile(container) && container.equals(Locations.thisSystemModules)) {
-            try {
-                listJRTImage(subdirectory,
-                        fileKinds,
-                        recurse,
-                        resultList);
-            } catch (IOException ex) {
-                ex.printStackTrace(System.err);
-                log.error("error.reading.file", container, getMessage(ex));
-            }
-            return;
-        }
-
-        if  (Files.isDirectory(container)) {
-            listDirectory(container, null,
-                          subdirectory,
-                          fileKinds,
-                          recurse,
-                          resultList);
-            return;
-        }
-
-        if (Files.isRegularFile(container)) {
-            listArchive(container,
-                    subdirectory,
-                    fileKinds,
-                    recurse,
-                    resultList);
+        @Override
+        public void close() throws IOException {
         }
     }
 
+    private final class ArchiveContainer implements Container {
+        private final Path archivePath;
+        private final FileSystem fileSystem;
+        private final Map<RelativePath, Path> pathCache = new HashMap<>();
+
+        public ArchiveContainer(Path archivePath) throws IOException, ProviderNotFoundException, SecurityException {
+            this.archivePath = archivePath;
+            this.fileSystem = FileSystems.newFileSystem(archivePath, null);
+        }
+
+        /**
+         * Insert all files in subdirectory subdirectory of this archive
+         * which match fileKinds into resultList
+         */
+        @Override
+        public void list(Path userPath,
+                         RelativeDirectory subdirectory,
+                         Set<JavaFileObject.Kind> fileKinds,
+                         boolean recurse,
+                         ListBuffer<JavaFileObject> resultList) throws IOException {
+            Path resolvedSubdirectory = resolvePath(subdirectory);
+
+            if (resolvedSubdirectory == null)
+                return ;
+
+            int maxDepth = (recurse ? Integer.MAX_VALUE : 1);
+            Set<FileVisitOption> opts = EnumSet.of(FOLLOW_LINKS);
+            Files.walkFileTree(resolvedSubdirectory, opts, maxDepth,
+                    new SimpleFileVisitor<Path>() {
+                        @Override
+                        public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+                            if (isValid(dir.getFileName())) {
+                                return FileVisitResult.CONTINUE;
+                            } else {
+                                return FileVisitResult.SKIP_SUBTREE;
+                            }
+                        }
+
+                        boolean isValid(Path fileName) {
+                            if (fileName == null) {
+                                return true;
+                            } else {
+                                String name = fileName.toString();
+                                if (name.endsWith("/")) {
+                                    name = name.substring(0, name.length() - 1);
+                                }
+                                return SourceVersion.isIdentifier(name);
+                            }
+                        }
+
+                        @Override
+                        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                            if (attrs.isRegularFile() && fileKinds.contains(getKind(file.getFileName().toString()))) {
+                                JavaFileObject fe = PathFileObject.forJarPath(
+                                        JavacFileManager.this, file, archivePath);
+                                resultList.append(fe);
+                            }
+                            return FileVisitResult.CONTINUE;
+                        }
+                    });
+
+        }
+
+        @Override
+        public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
+            Path p = resolvePath(name);
+            if (p != null)
+                return PathFileObject.forJarPath(JavacFileManager.this, p, userPath);
+
+            return null;
+        }
+
+        private synchronized Path resolvePath(RelativePath path) {
+            if (!pathCache.containsKey(path)) {
+                Path relativePath = path.resolveAgainst(fileSystem);
+
+                if (!Files.exists(relativePath)) {
+                    relativePath = null;
+                }
+
+                pathCache.put(path, relativePath);
+                return relativePath;
+            }
+            return pathCache.get(path);
+        }
+
+        @Override
+        public void close() throws IOException {
+            fileSystem.close();
+        }
+    }
+    /**
+     * container is a directory, a zip file, or a non-existant path.
+     */
     private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) {
         JavaFileObject.Kind kind = getKind(s);
         return fileKinds.contains(kind);
@@ -498,18 +621,6 @@
         return j < 0;
     }
 
-    private FileSystem getFileSystem(Path path) throws IOException {
-        Path realPath = fsInfo.getCanonicalFile(path);
-        FileSystem fs = fileSystems.get(realPath);
-        if (fs == null) {
-            fileSystems.put(realPath, fs = FileSystems.newFileSystem(realPath, null));
-        }
-        return fs;
-    }
-
-    private final Map<Path,FileSystem> fileSystems = new HashMap<>();
-
-
     /** Flush any output resources.
      */
     @Override @DefinedBy(Api.COMPILER)
@@ -528,10 +639,10 @@
         }
 
         locations.close();
-        for (FileSystem fs: fileSystems.values()) {
-            fs.close();
+        for (Container container: containers.values()) {
+            container.close();
         }
-        fileSystems.clear();
+        containers.clear();
         contentCache.clear();
     }
 
@@ -570,8 +681,12 @@
         RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
         ListBuffer<JavaFileObject> results = new ListBuffer<>();
 
-        for (Path directory : path)
-            listContainer(directory, subdirectory, kinds, recurse, results);
+        for (Path directory : path) {
+            Container container = getContainer(directory);
+
+            container.list(directory, subdirectory, kinds, recurse, results);
+        }
+
         return results.toList();
     }
 
@@ -644,29 +759,10 @@
             return null;
 
         for (Path file: path) {
-            if (file.equals(Locations.thisSystemModules)) {
-                JRTIndex.Entry e = getJRTIndex().getEntry(name.dirname());
-                if (symbolFileEnabled && e.ctSym.hidden)
-                    continue;
-                Path p = e.files.get(name.basename());
-                if (p != null)
-                    return PathFileObject.forJRTPath(this, p);
-            } else if (Files.isDirectory(file)) {
-                try {
-                    Path f = name.resolveAgainst(file);
-                    if (Files.exists(f))
-                        return PathFileObject.forSimplePath(this,
-                                fsInfo.getCanonicalFile(f), f);
-                } catch (InvalidPathException ignore) {
-                }
-            } else if (Files.isRegularFile(file)) {
-                FileSystem fs = getFileSystem(file);
-                if (fs != null) {
-                    Path fsRoot = fs.getRootDirectories().iterator().next();
-                    Path f = name.resolveAgainst(fsRoot);
-                    if (Files.exists(f))
-                        return PathFileObject.forJarPath(this, f, file);
-                }
+            JavaFileObject fo = getContainer(file).getFileObject(file, name);
+
+            if (fo != null) {
+                return fo;
             }
         }
         return null;
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Apr 14 09:34:00 2016 -0700
@@ -1077,12 +1077,12 @@
                         ed.add(n);
                     }
                     editor = ed.toArray(new String[ed.size()]);
-                    fluffmsg("jshell.msg.set.editor.set", arg);
+                    fluffmsg("jshell.msg.set.editor.set", prog);
                     return true;
                 }
             }
             case "start": {
-                String init = readFile(at.next(), "'/set start'");
+                String init = readFile(at.next(), "/set start");
                 if (init == null) {
                     return false;
                 } else {
@@ -1351,7 +1351,7 @@
                 .filter(sn -> state.status(sn).isActive && sn instanceof PersistentSnippet)
                 .collect(toList());
         if (snippets.isEmpty()) {
-            errormsg("jshell.err.drop.active");
+            errormsg("jshell.err.drop.not.active");
             return false;
         }
         if (snippets.size() > 1) {
@@ -1499,7 +1499,7 @@
     }
 
     private boolean cmdOpen(String filename) {
-        return runFile(filename, "'/open'");
+        return runFile(filename, "/open");
     }
 
     private boolean runFile(String filename, String context) {
@@ -1533,7 +1533,7 @@
             } catch (AccessDeniedException e) {
                 errormsg("jshell.err.file.not.accessible", context, filename, e.getMessage());
             } catch (NoSuchFileException e) {
-                errormsg("jshell.err.file.not.found", context, filename, e.getMessage());
+                errormsg("jshell.err.file.not.found", context, filename);
             } catch (Exception e) {
                 errormsg("jshell.err.file.exception", context, filename, e);
             }
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Thu Apr 14 09:09:34 2016 -0700
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Thu Apr 14 09:34:00 2016 -0700
@@ -42,7 +42,7 @@
 jshell.msg.see = See {0} for help.
 
 jshell.err.file.not.accessible = File ''{1}'' for ''{0}'' is not accessible: {2}
-jshell.err.file.not.found = File ''{1}'' for ''{0}'' is not found: {2}
+jshell.err.file.not.found = File ''{1}'' for ''{0}'' is not found.
 jshell.err.file.exception = File ''{1}'' for ''{0}'' threw exception: {2}
 jshell.err.file.filename = ''{0}'' requires a filename argument.
 
@@ -90,7 +90,7 @@
 jshell.err.drop.arg =\
 In the /drop argument, please specify an import, variable, method, or class to drop.\n\
 Specify by id or name. Use /list to see ids. Use /reset to reset all state.
-jshell.msg.drop.not.active = The argument did not specify an active import, variable, method, or class to drop.
+jshell.err.drop.not.active = The argument did not specify an active import, variable, method, or class to drop.
 jshell.err.drop.ambiguous = The argument references more than one import, variable, method, or class.
 jshell.err.failed = Failed.
 jshell.msg.native.method = Native Method
@@ -503,74 +503,86 @@
 which are run when the jshell tool is started or reset.
 
 startup.feedback = \
-/set newmode normal command    \n\
-/set prompt normal '\\n-> ' '>> '    \n\
-/set format normal pre '|  '    \n\
-/set format normal post '%n'    \n\
-/set format normal errorpre '|  '    \n\
-/set format normal errorpost '%n'    \n\
-    \n\
-/set format normal errorline '{post}{pre}    {err}'    \n\
-    \n\
-/set format normal action 'Added' added-primary    \n\
-/set format normal action 'Modified' modified-primary    \n\
-/set format normal action 'Replaced' replaced-primary    \n\
-/set format normal action 'Overwrote' overwrote-primary    \n\
-/set format normal action 'Dropped' dropped-primary    \n\
-/set format normal action '  Update added' added-update    \n\
-/set format normal action '  Update modified' modified-update    \n\
-/set format normal action '  Update replaced' replaced-update    \n\
-/set format normal action '  Update overwrote' overwrote-update    \n\
-/set format normal action '  Update dropped' dropped-update    \n\
-    \n\
-/set format normal until ', however, it cannot be instanciated or its methods invoked until'  defined-class-primary    \n\
-/set format normal until ', however, its methods cannot be invoked until'                     defined-interface-primary    \n\
-/set format normal until ', however, it cannot be used until'                                 defined-enum,annotation-primary    \n\
-/set format normal until ', however, it cannot be invoked until'                              defined-method-primary    \n\
-/set format normal until ', however, it cannot be referenced until'                           notdefined-primary    \n\
-/set format normal until ' which cannot be instanciated or its methods invoked until'         defined-class-update    \n\
-/set format normal until ' whose methods cannot be invoked until'                             defined-interface-update    \n\
-/set format normal until ' which cannot be invoked until'                                     defined-method-update    \n\
-/set format normal until ' which cannot be referenced until'                                  notdefined-update    \n\
-    \n\
-/set format normal unrerr '{unresolved} is declared'                                           unresolved1-error0    \n\
-/set format normal unrerr '{unresolved} are declared'                                          unresolved2-error0    \n\
-/set format normal unrerr ' this error is corrected: {errors}'                                 unresolved0-error1    \n\
-/set format normal unrerr '{unresolved} is declared and this error is corrected: {errors}'     unresolved1-error1    \n\
-/set format normal unrerr '{unresolved} are declared and this error is corrected: {errors}'    unresolved2-error1    \n\
-/set format normal unrerr ' these errors are corrected: {errors}'                              unresolved0-error2    \n\
-/set format normal unrerr '{unresolved} is declared and these errors are corrected: {errors}'  unresolved1-error2    \n\
-/set format normal unrerr '{unresolved} are declared and these errors are corrected: {errors}' unresolved2-error2    \n\
-    \n\
-/set format normal resolve '{until}{unrerr}'                                                added,modified,replaced,used    \n\
-    \n\
-/set format normal typeKind 'class'                  class    \n\
-/set format normal typeKind 'interface'              interface    \n\
-/set format normal typeKind 'enum'                   enum    \n\
-/set format normal typeKind 'annotation interface'   annotation    \n\
-    \n\
-/set format normal display '{pre}{action} {typeKind} {name}{resolve}{post}'                 class,interface,enum,annotation    \n\
-/set format normal display '{pre}{action} method {name}({type}){resolve}{post}'             method    \n\
-    \n\
-/set format normal display '{pre}{action} variable {name} of type {type}{resolve}{post}'    vardecl    \n\
-/set format normal display '{pre}{action} variable {name} of type {type} with initial value {value}{resolve}{post}'    varinit    \n\
+/set newmode verbose command    \n\
+\n\
+/set prompt verbose '\\njshell> '   '   ...> '    \n\
+\n\
+/set format verbose pre '|  '    \n\
+/set format verbose post '%n'    \n\
+/set format verbose errorpre '|  '    \n\
+/set format verbose errorpost '%n'    \n\
+\n\
+/set format verbose errorline '{pre}    {err}'    \n\
+\n\
+/set format verbose action 'created' added-primary    \n\
+/set format verbose action 'modified' modified-primary    \n\
+/set format verbose action 'replaced' replaced-primary    \n\
+/set format verbose action 'overwrote' overwrote-primary    \n\
+/set format verbose action 'dropped' dropped-primary    \n\
+/set format verbose action '  update created' added-update    \n\
+/set format verbose action '  update modified' modified-update    \n\
+/set format verbose action '  update replaced' replaced-update    \n\
+/set format verbose action '  update overwrote' overwrote-update    \n\
+/set format verbose action '  update dropped' dropped-update    \n\
+\n\
+/set format verbose until ', however, it cannot be instanciated or its methods invoked until'   defined-class-primary    \n\
+/set format verbose until ', however, its methods cannot be invoked until'                      defined-interface-primary    \n\
+/set format verbose until ', however, it cannot be used until'                                  defined-enum,annotation-primary    \n\
+/set format verbose until ', however, it cannot be invoked until'                               defined-method-primary    \n\
+/set format verbose until ', however, it cannot be referenced until'                            notdefined-primary    \n\
+/set format verbose until ' which cannot be instanciated or its methods invoked until'          defined-class-update    \n\
+/set format verbose until ' whose methods cannot be invoked until'                              defined-interface-update    \n\
+/set format verbose until ' which cannot be invoked until'                                      defined-method-update    \n\
+/set format verbose until ' which cannot be referenced until'                                   notdefined-update    \n\
+\n\
+/set format verbose unrerr '{unresolved} is declared'                                           unresolved1-error0    \n\
+/set format verbose unrerr '{unresolved} are declared'                                          unresolved2-error0    \n\
+/set format verbose unrerr ' this error is corrected: {errors}'                                 unresolved0-error1    \n\
+/set format verbose unrerr '{unresolved} is declared and this error is corrected: {errors}'     unresolved1-error1    \n\
+/set format verbose unrerr '{unresolved} are declared and this error is corrected: {errors}'    unresolved2-error1    \n\
+/set format verbose unrerr ' these errors are corrected: {errors}'                              unresolved0-error2    \n\
+/set format verbose unrerr '{unresolved} is declared and these errors are corrected: {errors}'  unresolved1-error2    \n\
+/set format verbose unrerr '{unresolved} are declared and these errors are corrected: {errors}' unresolved2-error2    \n\
+\n\
+/set format verbose resolve '{until}{unrerr}'                                                   added,modified,replaced,used    \n\
+\n\
+/set format verbose typeKind 'class'                  class    \n\
+/set format verbose typeKind 'interface'              interface    \n\
+/set format verbose typeKind 'enum'                   enum    \n\
+/set format verbose typeKind 'annotation interface'   annotation    \n\
+\n\
+/set format verbose result '{name} ==> {value}{post}'                                        added,modified,replaced-ok-primary    \n\
+\n\
+/set format verbose display '{result}{pre}created scratch variable {name} : {type}{post}'    expression-primary    \n\
+/set format verbose display '{result}{pre}value of {name} : {type}{post}'                    varvalue-primary    \n\
+/set format verbose display '{result}{pre}assigned to {name} : {type}{post}'                 assignment-primary    \n\
+/set format verbose display '{result}{pre}{action} variable {name} : {type}{resolve}{post}'  varinit,vardecl    \n\
+/set format verbose display '{pre}{action} variable {name}{resolve}{post}'                   vardecl,varinit-notdefined    \n\
+/set format verbose display '{pre}{action} variable {name}{post}'                            dropped-vardecl,varinit    \n\
+/set format verbose display '{pre}{action} variable {name}, reset to null{post}'             replaced-vardecl,varinit-ok-update    \n\
+\n\
+/set format verbose display '{pre}{action} {typeKind} {name}{resolve}{post}'                 class,interface,enum,annotation    \n\
+/set format verbose display '{pre}{action} method {name}({type}){resolve}{post}'             method    \n\
+\n\
+/set format verbose display '{pre}attempted to use {typeKind} {name}{resolve}{post}'         used-class,interface,enum,annotation    \n\
+/set format verbose display '{pre}attempted to call method {name}({type}){resolve}{post}'    used-method    \n\
+\n\
+/set newmode normal command verbose    \n\
+/set format normal display ''                                                               added,modified,replaced,overwrote,dropped-update    \n\
 /set format normal display '{pre}{action} variable {name}, reset to null{post}'             replaced-vardecl,varinit-ok-update    \n\
-/set format normal display '{pre}{action} variable {name}{resolve}{post}'                   vardecl,varinit-notdefined    \n\
-/set format normal display '{pre}{action} variable {name}{post}'                            overwrote,dropped-vardecl,varinit    \n\
-    \n\
-/set format normal display '{pre}Expression value is: {value}{post}{pre}  assigned to temporary variable {name} of type {type}{post}' expression    \n\
-/set format normal display '{pre}Variable {name} of type {type} has value {value}{post}'    varvalue    \n\
-/set format normal display '{pre}Variable {name} has been assigned the value {value}{post}' assignment    \n\
-    \n\
-/set format normal display '{pre}Attempted to use {typeKind} {name}{resolve}{post}'         used-class,interface,enum,annotation    \n\
-/set format normal display '{pre}Attempted to call method {name}({type}){resolve}{post}'    used-method    \n\
-    \n\
+/set format normal display '{result}'                                                       added,modified,replaced-expression,varvalue,assignment,varinit,vardecl-ok-primary    \n\
+/set newmode concise quiet normal    \n\
+\n\
+/set prompt concise 'jshell> '   '   ...> '    \n\
+\n\
+/set format concise display ''                                                              class,interface,enum,annotation,method,assignment,varinit,vardecl-ok    \n\
+\n\
 /set feedback normal    \n\
-    \n\
-/set newmode off quiet    \n\
-/set prompt off '-> ' '>> '    \n\
-/set format off pre '|  '    \n\
-/set format off post '%n'    \n\
-/set format off errorpre '|  '    \n\
-/set format off errorpost '%n'    \n\
-/set format off display ''    \n
+\n\
+/set newmode silent quiet    \n\
+/set prompt silent '-> ' '>> '    \n\
+/set format silent pre '|  '    \n\
+/set format silent post '%n'    \n\
+/set format silent errorpre '|  '    \n\
+/set format silent errorpost '%n'    \n\
+/set format silent display ''    \n
--- a/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Thu Apr 14 09:34:00 2016 -0700
@@ -465,16 +465,40 @@
         // If appropriate, execute the snippet
         String value = null;
         Exception exception = null;
-        if (si.isExecutable() && si.status().isDefined) {
-            try {
-                value = state.executionControl().commandInvoke(state.maps.classFullName(si));
-                value = si.subKind().hasValue()
-                        ? expunge(value)
-                        : "";
-            } catch (EvalException ex) {
-                exception = translateExecutionException(ex);
-            } catch (UnresolvedReferenceException ex) {
-                exception = ex;
+        if (si.status().isDefined) {
+            if (si.isExecutable()) {
+                try {
+                    value = state.executionControl().commandInvoke(state.maps.classFullName(si));
+                    value = si.subKind().hasValue()
+                            ? expunge(value)
+                            : "";
+                } catch (EvalException ex) {
+                    exception = translateExecutionException(ex);
+                } catch (UnresolvedReferenceException ex) {
+                    exception = ex;
+                }
+            } else if (si.subKind() == SubKind.VAR_DECLARATION_SUBKIND) {
+                switch (((VarSnippet) si).typeName()) {
+                    case "byte":
+                    case "short":
+                    case "int":
+                    case "long":
+                        value = "0";
+                        break;
+                    case "float":
+                    case "double":
+                        value = "0.0";
+                        break;
+                    case "boolean":
+                        value = "false";
+                        break;
+                    case "char":
+                        value = "''";
+                        break;
+                    default:
+                        value = "null";
+                        break;
+                }
             }
         }
         return events(c, outs, value, exception);
--- a/test/jdk/jshell/EditorPadTest.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/EditorPadTest.java	Thu Apr 14 09:34:00 2016 -0700
@@ -25,6 +25,7 @@
  * @test
  * @summary Testing built-in editor.
  * @ignore 8139872
+ * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build ReplToolTesting EditorTestBase
  * @run testng EditorPadTest
  */
@@ -67,7 +68,7 @@
     private static JButton exit = null;
 
     @BeforeClass
-    public static void setUp() {
+    public static void setUpEditorPadTest() {
         try {
             robot = new Robot();
             robot.setAutoWaitForIdle(true);
--- a/test/jdk/jshell/EditorTestBase.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/EditorTestBase.java	Thu Apr 14 09:34:00 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -65,19 +65,19 @@
     }
 
     public void assertEditOutput(boolean after, String cmd, String output, Action action) {
-        assertEditOutput(after, cmd, s -> assertEquals(s, output, "command"), action);
+        assertEditOutput(after, cmd, s -> assertEquals(s.trim(), output.trim(), "command"), action);
     }
 
     @Test
     public void testEditNegative() {
-        for (String edit : new String[] {"/e", "/edit"}) {
+        for (String edit : new String[] {"/ed", "/edit"}) {
             test(new String[]{"-nostartup"},
-                    a -> assertCommand(a, edit + " 1",
-                            "|  No definition or id named 1 found.  See /classes, /methods, /vars, or /list\n"),
-                    a -> assertCommand(a, edit + " -1",
-                            "|  No definition or id named -1 found.  See /classes, /methods, /vars, or /list\n"),
-                    a -> assertCommand(a, edit + " unknown",
-                            "|  No definition or id named unknown found.  See /classes, /methods, /vars, or /list\n")
+                    a -> assertCommandOutputStartsWith(a, edit + " 1",
+                            "|  No definition or id found named: 1"),
+                    a -> assertCommandOutputStartsWith(a, edit + " -1",
+                            "|  No definition or id found named: -1"),
+                    a -> assertCommandOutputStartsWith(a, edit + " unknown",
+                            "|  No definition or id found named: unknown")
             );
         }
     }
@@ -86,7 +86,7 @@
     public void testDoNothing() {
         testEditor(
                 a -> assertVariable(a, "int", "a", "0", "0"),
-                a -> assertEditOutput(a, "/e 1", "", this::exit),
+                a -> assertEditOutput(a, "/ed 1", "", this::exit),
                 a -> assertCommandCheckOutput(a, "/v", assertVariables())
         );
     }
@@ -95,12 +95,12 @@
     public void testEditVariable1() {
         testEditor(
                 a -> assertVariable(a, "int", "a", "0", "0"),
-                a -> assertEditOutput(a, "/e 1", "|  Modified variable a of type int with initial value 10\n", () -> {
+                a -> assertEditOutput(a, "/ed 1", "a ==> 10", () -> {
                     writeSource("\n\n\nint a = 10;\n\n\n");
                     exit();
                     loadVariable(true, "int", "a", "10", "10");
                 }),
-                a -> assertEditOutput(a, "/e 1", "|  Modified variable a of type int with initial value 15\n", () -> {
+                a -> assertEditOutput(a, "/ed 1", "a ==> 15", () -> {
                     writeSource("int a = 15;");
                     exit();
                     loadVariable(true, "int", "a", "15", "15");
@@ -113,12 +113,12 @@
     public void testEditVariable2() {
         testEditor(
                 a -> assertVariable(a, "int", "a", "0", "0"),
-                a -> assertEditOutput(a, "/e 1", "|  Added variable b of type int with initial value 10\n", () -> {
+                a -> assertEditOutput(a, "/ed 1", "b ==> 10", () -> {
                     writeSource("int b = 10;");
                     exit();
                     loadVariable(true, "int", "b", "10", "10");
                 }),
-                a -> assertEditOutput(a, "/e 1", "|  Modified variable a of type int with initial value 15\n", () -> {
+                a -> assertEditOutput(a, "/ed 1", "a ==> 15", () -> {
                     writeSource("int a = 15;");
                     exit();
                     loadVariable(true, "int", "a", "15", "15");
@@ -131,19 +131,18 @@
     public void testEditClass1() {
         testEditor(
                 a -> assertClass(a, "class A {}", "class", "A"),
-                a -> assertEditOutput(a, "/e 1", "", () -> {
+                a -> assertEditOutput(a, "/ed 1", "", () -> {
                     writeSource("\n\n\nclass A {}\n\n\n");
                     exit();
                     loadClass(true, "class A {}", "class", "A");
                 }),
-                a -> assertEditOutput(a, "/e 1",
-                        "|  Replaced enum A\n" +
-                        "|    Update overwrote class A\n", () -> {
+                a -> assertEditOutput(a, "/ed 1",
+                        "|  replaced enum A", () -> {
                     writeSource("enum A {}");
                     exit();
                     loadClass(true, "enum A {}", "enum", "A");
                 }),
-                a -> assertCommandCheckOutput(a, "/c", assertClasses())
+                a -> assertCommandCheckOutput(a, "/classes", assertClasses())
         );
     }
 
@@ -151,19 +150,18 @@
     public void testEditClass2() {
         testEditor(
                 a -> assertClass(a, "class A {}", "class", "A"),
-                a -> assertEditOutput(a, "/e 1", "|  Added class B\n", () -> {
+                a -> assertEditOutput(a, "/ed 1", "|  created class B", () -> {
                     writeSource("class B { }");
                     exit();
                     loadClass(true, "class B {}", "class", "B");
                 }),
-                a -> assertEditOutput(a, "/e 1",
-                        "|  Replaced enum A\n" +
-                        "|    Update overwrote class A\n", () -> {
+                a -> assertEditOutput(a, "/ed 1",
+                        "|  replaced enum A", () -> {
                     writeSource("enum A {}");
                     exit();
                     loadClass(true, "enum A {}", "enum", "A");
                 }),
-                a -> assertCommandCheckOutput(a, "/c", assertClasses())
+                a -> assertCommandCheckOutput(a, "/classes", assertClasses())
         );
     }
 
@@ -171,14 +169,13 @@
     public void testEditMethod1() {
         testEditor(
                 a -> assertMethod(a, "void f() {}", "()void", "f"),
-                a -> assertEditOutput(a, "/e 1", "", () -> {
+                a -> assertEditOutput(a, "/ed 1", "", () -> {
                     writeSource("\n\n\nvoid f() {}\n\n\n");
                     exit();
                     loadMethod(true, "void f() {}", "()void", "f");
                 }),
-                a -> assertEditOutput(a, "/e 1",
-                        "|  Replaced method f()\n" +
-                        "|    Update overwrote method f()\n", () -> {
+                a -> assertEditOutput(a, "/ed 1",
+                        "|  replaced method f()", () -> {
                     writeSource("double f() { return 0; }");
                     exit();
                     loadMethod(true, "double f() { return 0; }", "()double", "f");
@@ -191,14 +188,13 @@
     public void testEditMethod2() {
         testEditor(
                 a -> assertMethod(a, "void f() {}", "()void", "f"),
-                a -> assertEditOutput(a, "/e 1", "|  Added method g()\n", () -> {
+                a -> assertEditOutput(a, "/ed 1", "|  created method g()", () -> {
                     writeSource("void g() {}");
                     exit();
                     loadMethod(true, "void g() {}", "()void", "g");
                 }),
-                a -> assertEditOutput(a, "/e 1",
-                        "|  Replaced method f()\n" +
-                        "|    Update overwrote method f()\n", () -> {
+                a -> assertEditOutput(a, "/ed 1",
+                        "|  replaced method f()", () -> {
                     writeSource("double f() { return 0; }");
                     exit();
                     loadMethod(true, "double f() { return 0; }", "()double", "f");
@@ -213,7 +209,7 @@
                 a -> assertVariable(a, "int", "a"),
                 a -> assertMethod(a, "void f() {}", "()void", "f"),
                 a -> assertClass(a, "class A {}", "class", "A"),
-                a -> assertEditInput(a, "/e", s -> {
+                a -> assertEditInput(a, "/ed", s -> {
                     String[] ss = s.split("\n");
                     assertEquals(ss.length, 3, "Expected 3 lines: " + s);
                     assertEquals(ss[0], "int a;");
@@ -226,15 +222,15 @@
     @Test
     public void testStartup() {
         testEditor(true, new String[0],
-                a -> assertEditInput(a, "/e", s -> assertTrue(s.isEmpty(), "Checking of startup: " + s), this::cancel),
-                a -> assertEditInput(a, "/e printf", assertStartsWith("void printf"), this::cancel));
+                a -> assertEditInput(a, "/ed", s -> assertTrue(s.isEmpty(), "Checking of startup: " + s), this::cancel),
+                a -> assertEditInput(a, "/ed printf", assertStartsWith("void printf"), this::cancel));
     }
 
     @Test
     public void testCancel() {
         testEditor(
                 a -> assertVariable(a, "int", "a"),
-                a -> assertEditOutput(a, "/e a", "", () -> {
+                a -> assertEditOutput(a, "/ed a", "", () -> {
                     writeSource("int b = 10");
                     cancel();
                 })
@@ -245,7 +241,7 @@
     public void testAccept() {
         testEditor(
                 a -> assertVariable(a, "int", "a"),
-                a -> assertEditOutput(a, "/e a", "|  Added variable b of type int with initial value 10\n", () -> {
+                a -> assertEditOutput(a, "/ed a", "b ==> 10", () -> {
                     writeSource("int b = 10");
                     accept();
                     exit();
--- a/test/jdk/jshell/ExternalEditorTest.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/ExternalEditorTest.java	Thu Apr 14 09:34:00 2016 -0700
@@ -24,8 +24,9 @@
 /*
  * @test
  * @summary Testing external editor.
- * @bug 8080843
+ * @bug 8080843 8143955
  * @ignore 8080843
+ * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build ReplToolTesting CustomEditor EditorTestBase
  * @run testng ExternalEditorTest
  */
@@ -124,7 +125,7 @@
     }
 
     @BeforeClass
-    public static void setUp() throws IOException {
+    public static void setUpExternalEditorTest() throws IOException {
         listener = new ServerSocket(0);
         listener.setSoTimeout(30000);
         int localPort = listener.getLocalPort();
@@ -193,11 +194,11 @@
     @Test
     public void setUnknownEditor() {
         test(
-                a -> assertCommand(a, "/set editor", "|  /set editor requires a path argument\n"),
-                a -> assertCommand(a, "/set editor UNKNOWN", "|  Editor set to: UNKNOWN\n"),
+                a -> assertCommand(a, "/set editor", "|  The '/set editor' command requires a path argument"),
+                a -> assertCommand(a, "/set editor UNKNOWN", "|  Editor set to: UNKNOWN"),
                 a -> assertCommand(a, "int a;", null),
-                a -> assertCommand(a, "/e 1",
-                        "|  Edit Error: process IO failure: Cannot run program \"UNKNOWN\": error=2, No such file or directory\n")
+                a -> assertCommand(a, "/ed 1",
+                        "|  Edit Error: process IO failure: Cannot run program \"UNKNOWN\": error=2, No such file or directory")
         );
     }
 
--- a/test/jdk/jshell/ReplToolTesting.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/ReplToolTesting.java	Thu Apr 14 09:34:00 2016 -0700
@@ -273,8 +273,7 @@
     }
 
     public void evaluateExpression(boolean after, String type, String expr, String value) {
-        String output = String.format("\\| *Expression values is: %s\n|" +
-                " *.*temporary variable (\\$\\d+) of type %s", value, type);
+        String output = String.format("(\\$\\d+) ==> %s", value);
         Pattern outputPattern = Pattern.compile(output);
         assertCommandCheckOutput(after, expr, s -> {
             Matcher matcher = outputPattern.matcher(s);
@@ -558,14 +557,19 @@
 
         @Override
         public Consumer<String> checkOutput() {
-            String pattern = String.format("\\| *\\w+ variable %s of type %s", name, type);
-            if (initialValue != null) {
-                pattern += " with initial value " + initialValue;
-            }
-            Predicate<String> checkOutput = Pattern.compile(pattern).asPredicate();
-            final String finalPattern = pattern;
-            return output -> assertTrue(checkOutput.test(output),
-                    "Output: " + output + " does not fit pattern: " + finalPattern);
+            String arrowPattern = String.format("%s ==> %s", name, value);
+            Predicate<String> arrowCheckOutput = Pattern.compile(arrowPattern).asPredicate();
+            String howeverPattern = String.format("\\| *\\w+ variable %s, however*.", name);
+            Predicate<String> howeverCheckOutput = Pattern.compile(howeverPattern).asPredicate();
+            return output -> {
+                if (output.startsWith("|  ")) {
+                    assertTrue(howeverCheckOutput.test(output),
+                    "Output: " + output + " does not fit pattern: " + howeverPattern);
+                } else {
+                    assertTrue(arrowCheckOutput.test(output),
+                    "Output: " + output + " does not fit pattern: " + arrowPattern);
+                }
+            };
         }
 
         @Override
--- a/test/jdk/jshell/T8146368/JShellToolTest8146368.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/T8146368/JShellToolTest8146368.java	Thu Apr 14 09:34:00 2016 -0700
@@ -37,8 +37,8 @@
 public class JShellToolTest8146368 extends ReplToolTesting {
     public void test() {
         test(
-                a -> assertCommand(a, "class A extends B {}", "|  Added class A, however, it cannot be referenced until class B is declared\n"),
-                a -> assertCommand(a, "und m() { return new und(); }", "|  Added method m(), however, it cannot be referenced until class und is declared\n")
+                a -> assertCommand(a, "class A extends B {}", "|  created class A, however, it cannot be referenced until class B is declared\n"),
+                a -> assertCommand(a, "und m() { return new und(); }", "|  created method m(), however, it cannot be referenced until class und is declared\n")
         );
     }
 }
--- a/test/jdk/jshell/ToolBasicTest.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/ToolBasicTest.java	Thu Apr 14 09:34:00 2016 -0700
@@ -23,9 +23,13 @@
 
 /*
  * @test
- * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317
+ * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955
  * @summary Tests for Basic tests for REPL tool
  * @requires os.family != "solaris"
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.javap
+ *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @ignore 8139873
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
@@ -176,23 +180,23 @@
             }
             assertOutput(getCommandOutput(), "", "command");
             assertOutput(getCommandErrorOutput(), "", "command error");
-            assertOutput(getUserOutput(), output, "user");
+            assertOutput(getUserOutput().trim(), output, "user");
             assertOutput(getUserErrorOutput(), "", "user error");
         }
     }
 
     public void testStop() {
         test(
-                (a) -> assertStop(a, "while (true) {}", "Killed.\n"),
-                (a) -> assertStop(a, "while (true) { try { Thread.sleep(100); } catch (InterruptedException ex) { } }", "Killed.\n")
+                (a) -> assertStop(a, "while (true) {}", "Killed."),
+                (a) -> assertStop(a, "while (true) { try { Thread.sleep(100); } catch (InterruptedException ex) { } }", "Killed.")
         );
     }
 
     @Test(enabled = false) // TODO 8130450
     public void testRerun() {
         test(false, new String[] {"-nostartup"},
-                (a) -> assertCommand(a, "/0", "|  No such command or snippet id: /0\n|  Type /help for help.\n"),
-                (a) -> assertCommand(a, "/5", "|  No such command or snippet id: /5\n|  Type /help for help.\n")
+                (a) -> assertCommand(a, "/0", "|  No such command or snippet id: /0\n|  Type /help for help."),
+                (a) -> assertCommand(a, "/5", "|  No such command or snippet id: /5\n|  Type /help for help.")
         );
         String[] codes = new String[] {
                 "int a = 0;", // var
@@ -251,99 +255,9 @@
         );
 
         test(false, new String[] {"-nostartup"},
-                (a) -> assertCommand(a, "/s1", "|  No such command or snippet id: /s1\n|  Type /help for help.\n"),
-                (a) -> assertCommand(a, "/1", "|  No such command or snippet id: /1\n|  Type /help for help.\n"),
-                (a) -> assertCommand(a, "/e1", "|  No such command or snippet id: /e1\n|  Type /help for help.\n")
-        );
-    }
-
-    public void testRemaining() {
-        test(
-                (a) -> assertCommand(a, "int z; z =", "|  Added variable z of type int\n"),
-                (a) -> assertCommand(a, "5", "|  Variable z has been assigned the value 5\n"),
-                (a) -> assertCommand(a, "/*nada*/; int q =", ""),
-                (a) -> assertCommand(a, "77", "|  Added variable q of type int with initial value 77\n"),
-                (a) -> assertCommand(a, "//comment;", ""),
-                (a) -> assertCommand(a, "int v;", "|  Added variable v of type int\n"),
-                (a) -> assertCommand(a, "int v; int c", "|  Added variable c of type int\n")
-        );
-    }
-
-    public void oneLineOfError() {
-        test(
-                (a) -> assertCommand(a, "12+", null),
-                (a) -> assertCommandCheckOutput(a, "  true", (s) ->
-                        assertTrue(s.contains("12+") && !s.contains("true"), "Output: '" + s + "'"))
-        );
-    }
-
-    public void defineVariables() {
-        test(
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
-                (a) -> assertVariable(a, "int", "a"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
-                (a) -> assertVariable(a, "double", "a", "1", "1.0"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
-                (a) -> evaluateExpression(a, "double", "2 * a", "2.0"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables())
-        );
-    }
-
-    public void defineMethods() {
-        test(
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
-                (a) -> assertMethod(a, "int f() { return 0; }", "()int", "f"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
-                (a) -> assertMethod(a, "void f(int a) { g(); }", "(int)void", "f"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
-                (a) -> assertMethod(a, "void g() {}", "()void", "g"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods())
-        );
-    }
-
-    public void defineClasses() {
-        test(
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
-                (a) -> assertClass(a, "class A { }", "class", "A"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
-                (a) -> assertClass(a, "interface A { }", "interface", "A"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
-                (a) -> assertClass(a, "enum A { }", "enum", "A"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
-                (a) -> assertClass(a, "@interface A { }", "@interface", "A"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses())
-        );
-    }
-
-    public void defineImports() {
-        test(
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
-                (a) -> assertImport(a, "import java.util.stream.Stream;", "", "java.util.stream.Stream"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
-                (a) -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
-                (a) -> assertImport(a, "import static java.lang.Math.PI;", "static", "java.lang.Math.PI"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
-                (a) -> assertImport(a, "import static java.lang.Math.*;", "static", "java.lang.Math.*"),
-                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
-                (a) -> assertCommandCheckOutput(a, "/imports", assertImports())
+                (a) -> assertCommand(a, "/s1", "|  No such command or snippet id: /s1\n|  Type /help for help."),
+                (a) -> assertCommand(a, "/1", "|  No such command or snippet id: /1\n|  Type /help for help."),
+                (a) -> assertCommand(a, "/e1", "|  No such command or snippet id: /e1\n|  Type /help for help.")
         );
     }
 
@@ -353,14 +267,14 @@
         compiler.compile(outDir, "package pkg; public class A { public String toString() { return \"A\"; } }");
         Path classpath = compiler.getPath(outDir);
         test(
-                (a) -> assertCommand(a, "/classpath " + classpath, String.format("|  Path %s added to classpath\n", classpath)),
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"A\"")
+                (a) -> assertCommand(a, "/classpath " + classpath, String.format("|  Path '%s' added to classpath", classpath)),
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
         test(new String[] { "-cp", classpath.toString() },
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"A\"")
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
         test(new String[] { "-classpath", classpath.toString() },
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"A\"")
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
     }
 
@@ -372,14 +286,14 @@
         compiler.jar(outDir, jarName, "pkg/A.class");
         Path jarPath = compiler.getPath(outDir).resolve(jarName);
         test(
-                (a) -> assertCommand(a, "/classpath " + jarPath, String.format("|  Path %s added to classpath\n", jarPath)),
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"A\"")
+                (a) -> assertCommand(a, "/classpath " + jarPath, String.format("|  Path '%s' added to classpath", jarPath)),
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
         test(new String[] { "-cp", jarPath.toString() },
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"A\"")
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
         test(new String[] { "-classpath", jarPath.toString() },
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"A\"")
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
     }
 
@@ -389,7 +303,7 @@
             Path startup = compiler.getPath("StartupFileOption/startup.txt");
             compiler.writeToFile(startup, "class A { public String toString() { return \"A\"; } }");
             test(new String[]{"-startup", startup.toString()},
-                    (a) -> evaluateExpression(a, "A", "new A()", "\"A\"\n")
+                    (a) -> evaluateExpression(a, "A", "new A()", "A")
             );
             test(new String[]{"-nostartup"},
                     (a) -> assertCommandCheckOutput(a, "printf(\"\")", assertStartsWith("|  Error:\n|  cannot find symbol"))
@@ -406,18 +320,18 @@
         Path path = compiler.getPath("loading.repl");
         compiler.writeToFile(path, "int a = 10; double x = 20; double a = 10;");
         test(new String[] { path.toString() },
-                (a) -> assertCommand(a, "x", "|  Variable x of type double has value 20.0\n"),
-                (a) -> assertCommand(a, "a", "|  Variable a of type double has value 10.0\n")
+                (a) -> assertCommand(a, "x", "x ==> 20.0"),
+                (a) -> assertCommand(a, "a", "a ==> 10.0")
         );
         Path unknown = compiler.getPath("UNKNOWN.jar");
         test(Locale.ROOT, true, new String[]{unknown.toString()},
                 "|  File " + unknown
-                + " is not found: " + unresolvableMessage(unknown) + "\n");
+                + " is not found: " + unresolvableMessage(unknown));
     }
 
     public void testReset() {
         test(
-                (a) -> assertReset(a, "/r"),
+                (a) -> assertReset(a, "/res"),
                 (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 (a) -> assertVariable(a, "int", "x"),
                 (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
@@ -444,8 +358,8 @@
         for (String s : new String[]{"/o", "/open"}) {
             test(
                     (a) -> assertCommand(a, s + " " + path.toString(), ""),
-                    (a) -> assertCommand(a, "a", "|  Variable a of type double has value 10.0\n"),
-                    (a) -> evaluateExpression(a, "A", "new A();", "\"A\""),
+                    (a) -> assertCommand(a, "a", "a ==> 10.0"),
+                    (a) -> evaluateExpression(a, "A", "new A();", "A"),
                     (a) -> evaluateExpression(a, "long", "Stream.of(\"A\").count();", "1"),
                     (a) -> {
                         loadVariable(a, "double", "x", "20.0", "20.0");
@@ -464,8 +378,7 @@
             Path unknown = compiler.getPath("UNKNOWN.repl");
             test(
                     (a) -> assertCommand(a, s + " " + unknown,
-                            "|  File '" + unknown
-                                    + "' is not found: " + unresolvableMessage(unknown) + "\n")
+                            "|  File '" + unknown + "' for '/open' is not found.")
             );
         }
     }
@@ -529,8 +442,8 @@
             );
             Path unknown = compiler.getPath("UNKNOWN");
             test(
-                    (a) -> assertCommand(a, "/set start " + unknown.toString(),
-                            "|  File '" + unknown + "' for /set start is not found.\n")
+                    (a) -> assertCommandOutputStartsWith(a, "/set start " + unknown.toString(),
+                            "|  File '" + unknown + "' for '/set start' is not found.")
             );
             test(false, new String[0],
                     (a) -> {
@@ -556,28 +469,6 @@
         }
     }
 
-    public void testUnknownCommand() {
-        test((a) -> assertCommand(a, "/unknown",
-                "|  No such command or snippet id: /unknown\n" +
-                "|  Type /help for help.\n"));
-    }
-
-    public void testEmptyClassPath() {
-        test(after -> assertCommand(after, "/classpath", "|  /classpath requires a path argument\n"));
-    }
-
-    public void testNoArgument() {
-        String[] commands = {"/save", "/open", "/set start"};
-        test(Stream.of(commands)
-                .map(cmd -> {
-                    String c = cmd;
-                    final String finalC = c;
-                    return (ReplTest) after -> assertCommand(after, cmd,
-                            "|  The " + finalC + " command requires a filename argument.\n");
-                })
-                .toArray(ReplTest[]::new));
-    }
-
     public void testStartSave() throws IOException {
         Compiler compiler = new Compiler();
         Path startSave = compiler.getPath("startSave.txt");
@@ -614,8 +505,8 @@
                 assertStartsWith("|  Does not match any current feedback mode")));
     }
 
-    public void testFeedbackOff() {
-        for (String off : new String[]{"o", "off"}) {
+    public void testFeedbackSilent() {
+        for (String off : new String[]{"s", "silent"}) {
             test(
                     a -> assertCommand(a, "/set feedback " + off, ""),
                     a -> assertCommand(a, "int a", ""),
@@ -632,16 +523,16 @@
         String[] sources = new String[] {"int a", "void f() {}", "class A {}", "a = 10"};
         String[] sources2 = new String[] {"int a //again", "void f() {int y = 4;}", "class A {} //again", "a = 10"};
         String[] output = new String[] {
-                "|  Added variable a of type int\n",
-                "|  Added method f()\n",
-                "|  Added class A\n",
-                "|  Variable a has been assigned the value 10\n"
+                "a ==> 0",
+                "|  created method f()",
+                "|  created class A",
+                "a ==> 10"
         };
         compiler.writeToFile(testNormalFile, sources2);
-        for (String feedback : new String[]{"/set f", "/set feedback"}) {
-            for (String feedbackState : new String[]{"n", "normal", "o", "off"}) {
+        for (String feedback : new String[]{"/set fe", "/set feedback"}) {
+            for (String feedbackState : new String[]{"n", "normal"}) {
                 test(
-                        a -> assertCommand(a, feedback + " " + feedbackState, "|  Feedback mode: normal\n"),
+                        a -> assertCommand(a, feedback + " " + feedbackState, "|  Feedback mode: normal"),
                         a -> assertCommand(a, sources[0], output[0]),
                         a -> assertCommand(a, sources[1], output[1]),
                         a -> assertCommand(a, sources[2], output[2]),
@@ -652,87 +543,21 @@
         }
     }
 
-    public void testDrop() {
-        test(false, new String[]{"-nostartup"},
-                a -> assertVariable(a, "int", "a"),
-                a -> dropVariable(a, "/drop 1", "int a = 0", "|  Dropped variable a\n"),
-                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop 2", "b ()I", "|  Dropped method b()\n"),
-                a -> assertClass(a, "class A {}", "class", "A"),
-                a -> dropClass(a, "/drop 3", "class A", "|  Dropped class A\n"),
-                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", "|  Dropped variable a\n"),
-                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop b", "b ()I", "|  Dropped method b()\n"),
-                a -> assertClass(a, "class A {}", "class", "A"),
-                a -> dropClass(a, "/drop A", "class A", "|  Dropped class A\n"),
-                a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
-                a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
-                a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
-                a -> assertCommandCheckOutput(a, "/imports", assertImports())
-        );
-    }
-
-    public void testDropNegative() {
-        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 active import, variable, method, or class to drop.\n")
-        );
-    }
-
-    public void testAmbiguousDrop() {
-        Consumer<String> check = s -> {
-            assertTrue(s.startsWith("|  The argument references more than one import, variable, method, or class"), s);
-            int lines = s.split("\n").length;
-            assertEquals(lines, 5, "Expected 3 ambiguous keys, but found: " + (lines - 2) + "\n" + s);
-        };
-        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() {
         test(false, new String[]{"-nostartup"},
                 a -> assertCommand(a, "System.err.println(1)", "", "", null, "", "1\n"),
                 a -> assertCommand(a, "System.err.println(2)", "", "", null, "", "2\n"),
-                a -> assertCommand(a, "/-2", "System.err.println(1)\n", "", null, "", "1\n"),
-                a -> assertCommand(a, "/history", "\n" +
+                a -> assertCommand(a, "/-2", "System.err.println(1)", "", null, "", "1\n"),
+                a -> assertCommand(a, "/history",
                                                     "/debug 0\n" +
                                                     "System.err.println(1)\n" +
                                                     "System.err.println(2)\n" +
                                                     "System.err.println(1)\n" +
                                                     "/history\n"),
-                a -> assertCommand(a, "/-2", "System.err.println(2)\n", "", null, "", "2\n"),
-                a -> assertCommand(a, "/!", "System.err.println(2)\n", "", null, "", "2\n"),
-                a -> assertCommand(a, "/2", "System.err.println(2)\n", "", null, "", "2\n"),
-                a -> assertCommand(a, "/1", "System.err.println(1)\n", "", null, "", "1\n")
+                a -> assertCommand(a, "/-2", "System.err.println(2)", "", null, "", "2\n"),
+                a -> assertCommand(a, "/!", "System.err.println(2)", "", null, "", "2\n"),
+                a -> assertCommand(a, "/2", "System.err.println(2)", "", null, "", "2\n"),
+                a -> assertCommand(a, "/1", "System.err.println(1)", "", null, "", "1\n")
         );
     }
 
@@ -744,14 +569,4 @@
             return ex.getMessage();
         }
     }
-
-    public void testCommandPrefix() {
-        test(a -> assertCommandCheckOutput(a, "/s",
-                      assertStartsWith("|  Command: /s is ambiguous: /save, /set")),
-             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/jdk/jshell/ToolReloadTest.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/ToolReloadTest.java	Thu Apr 14 09:34:00 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @key intermittent
- * @bug 8081845 8147898
+ * @bug 8081845 8147898 8143955
  * @summary Tests for /reload in JShell tool
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -71,7 +71,7 @@
         Path classpath = compiler.getPath(outDir);
         test(
                 (a) -> assertCommand(a, "/classpath " + classpath,
-                        String.format("|  Path '%s' added to classpath\n", classpath)),
+                        String.format("|  Path '%s' added to classpath", classpath)),
                 (a) -> assertMethod(a, "String foo() { return (new pkg.A()).toString(); }",
                         "()String", "foo"),
                 (a) -> assertVariable(a, "String", "v", "foo()", "\"A\""),
@@ -83,20 +83,20 @@
                         "-: String foo() { return (new pkg.A()).toString(); }\n" +
                         "-: String v = foo();\n");
                        },
-                (a) -> assertCommand(a, "v", "|  Variable v of type String has value \"Aprime\"\n"),
+                (a) -> assertCommand(a, "v", "v ==> \"Aprime\""),
                 (a) -> evaluateExpression(a, "String", "foo()", "\"Aprime\""),
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"Aprime\"")
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "Aprime")
         );
     }
 
     public void testReloadDrop() {
         test(false, new String[]{"-nostartup"},
                 a -> assertVariable(a, "int", "a"),
-                a -> dropVariable(a, "/dr 1", "int a = 0", "|  Dropped variable a\n"),
+                a -> dropVariable(a, "/dr 1", "int a = 0", "|  dropped variable a"),
                 a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop b", "b ()I", "|  Dropped method b()\n"),
+                a -> dropMethod(a, "/drop b", "b ()I", "|  dropped method b()"),
                 a -> assertClass(a, "class A {}", "class", "A"),
-                a -> dropClass(a, "/dr A", "class A", "|  Dropped class A\n"),
+                a -> dropClass(a, "/dr A", "class A", "|  dropped class A"),
                 a -> assertCommand(a, "/reload",
                         "|  Restarting and restoring state.\n" +
                         "-: int a;\n" +
@@ -115,13 +115,13 @@
     public void testReloadQuiet() {
         test(false, new String[]{"-nostartup"},
                 a -> assertVariable(a, "int", "a"),
-                a -> dropVariable(a, "/dr 1", "int a = 0", "|  Dropped variable a\n"),
+                a -> dropVariable(a, "/dr 1", "int a = 0", "|  dropped variable a"),
                 a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop b", "b ()I", "|  Dropped method b()\n"),
+                a -> dropMethod(a, "/drop b", "b ()I", "|  dropped method b()"),
                 a -> assertClass(a, "class A {}", "class", "A"),
-                a -> dropClass(a, "/dr A", "class A", "|  Dropped class A\n"),
+                a -> dropClass(a, "/dr A", "class A", "|  dropped class A"),
                 a -> assertCommand(a, "/reload quiet",
-                        "|  Restarting and restoring state.\n"),
+                        "|  Restarting and restoring state."),
                 a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
@@ -144,8 +144,8 @@
                         "-: ++c\n" +
                         "-: ++c\n"
                 ),
-                (a) -> assertCommand(a, "c", "|  Variable c of type int has value 11\n"),
-                (a) -> assertCommand(a, "$4", "|  Variable $4 of type int has value 10\n")
+                (a) -> assertCommand(a, "c", "c ==> 11"),
+                (a) -> assertCommand(a, "$4", "$4 ==> 10")
         );
     }
 
@@ -158,7 +158,7 @@
                 (a) -> assertCommand(a, "/vars", null),
                 (a) -> assertCommand(a, "/save abcd", null),
                 (a) -> assertCommand(a, "/reload",
-                        "|  Restarting and restoring state.\n")
+                        "|  Restarting and restoring state.")
         );
     }
 
@@ -168,7 +168,7 @@
                 (a) -> assertMethod(a, "int m(int z) { return z * z; }",
                         "(int)int", "m"),
                 (a) -> evaluateExpression(a, "int", "m(x)", "25"),
-                (a) -> assertCommand(a, "/reset", "|  Resetting state.\n"),
+                (a) -> assertCommand(a, "/reset", "|  Resetting state."),
                 (a) -> assertCommand(a, "/reload restore",
                         "|  Restarting and restoring from previous state.\n" +
                         "-: int x = 5;\n" +
@@ -188,7 +188,7 @@
                 (a) -> evaluateExpression(a, "int", "m(x)", "25"),
                 (a) -> assertCommand(a, "System.exit(1);",
                         "|  State engine terminated.\n" +
-                        "|  Restore definitions with: /reload restore\n"),
+                        "|  Restore definitions with: /reload restore"),
                 (a) -> assertCommand(a, "/reload restore",
                         "|  Restarting and restoring from previous state.\n" +
                         "-: int x = 5;\n" +
--- a/test/jdk/jshell/ToolSimpleTest.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/jdk/jshell/ToolSimpleTest.java	Thu Apr 14 09:34:00 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716
+ * @bug 8153716 8143955
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -47,10 +47,102 @@
 @Test
 public class ToolSimpleTest extends ReplToolTesting {
 
+    public void testRemaining() {
+        test(
+                (a) -> assertCommand(a, "int z; z =", "z ==> 0"),
+                (a) -> assertCommand(a, "5", "z ==> 5"),
+                (a) -> assertCommand(a, "/*nada*/; int q =", ""),
+                (a) -> assertCommand(a, "77", "q ==> 77"),
+                (a) -> assertCommand(a, "//comment;", ""),
+                (a) -> assertCommand(a, "int v;", "v ==> 0"),
+                (a) -> assertCommand(a, "int v; int c",
+                        "v ==> 0\n" +
+                        "c ==> 0")
+        );
+    }
+
+    public void oneLineOfError() {
+        test(
+                (a) -> assertCommand(a, "12+", null),
+                (a) -> assertCommandCheckOutput(a, "  true", (s) ->
+                        assertTrue(s.contains("12+") && !s.contains("true"), "Output: '" + s + "'"))
+        );
+    }
+
+    public void defineVariables() {
+        test(
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                (a) -> assertVariable(a, "int", "a"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                (a) -> assertVariable(a, "double", "a", "1", "1.0"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                (a) -> evaluateExpression(a, "double", "2 * a", "2.0"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables())
+        );
+    }
+
+    public void defineMethods() {
+        test(
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                (a) -> assertMethod(a, "int f() { return 0; }", "()int", "f"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                (a) -> assertMethod(a, "void f(int a) { g(); }", "(int)void", "f"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                (a) -> assertMethod(a, "void g() {}", "()void", "g"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods())
+        );
+    }
+
+    public void defineClasses() {
+        test(
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                (a) -> assertClass(a, "class A { }", "class", "A"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                (a) -> assertClass(a, "interface A { }", "interface", "A"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                (a) -> assertClass(a, "enum A { }", "enum", "A"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                (a) -> assertClass(a, "@interface A { }", "@interface", "A"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/classes", assertClasses())
+        );
+    }
+
+    public void defineImports() {
+        test(
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
+                (a) -> assertImport(a, "import java.util.stream.Stream;", "", "java.util.stream.Stream"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
+                (a) -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
+                (a) -> assertImport(a, "import static java.lang.Math.PI;", "static", "java.lang.Math.PI"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/imports", assertImports()),
+                (a) -> assertImport(a, "import static java.lang.Math.*;", "static", "java.lang.Math.*"),
+                (a) -> assertCommandCheckOutput(a, "/list", assertList()),
+                (a) -> assertCommandCheckOutput(a, "/imports", assertImports())
+        );
+    }
+
     public void defineVar() {
         test(
-                (a) -> assertCommand(a, "int x = 72", "|  Added variable x of type int with initial value 72"),
-                (a) -> assertCommand(a, "x", "|  Variable x of type int has value 72"),
+                (a) -> assertCommand(a, "int x = 72", "x ==> 72"),
+                (a) -> assertCommand(a, "x", "x ==> 72"),
                 (a) -> assertCommand(a, "/vars", "|    int x = 72")
         );
     }
@@ -59,7 +151,7 @@
     public void defineUnresolvedVar() {
         test(
                 (a) -> assertCommand(a, "undefined x",
-                        "|  Added variable x, however, it cannot be referenced until class undefined is declared"),
+                        "|  created variable x, however, it cannot be referenced until class undefined is declared"),
                 (a) -> assertCommand(a, "/vars", "|    undefined x = (not-active)")
         );
     }
@@ -67,15 +159,37 @@
     public void testUnresolved() {
         test(
                 (a) -> assertCommand(a, "int f() { return g() + x + new A().a; }",
-                        "|  Added method f(), however, it cannot be invoked until method g(), variable x, and class A are declared"),
+                        "|  created method f(), however, it cannot be invoked until method g(), variable x, and class A are declared"),
                 (a) -> assertCommand(a, "f()",
-                        "|  Attempted to call method f() which cannot be invoked until method g(), variable x, and class A are declared"),
+                        "|  attempted to call method f() which cannot be invoked until method g(), variable x, and class A are declared"),
                 (a) -> assertCommandOutputStartsWith(a, "int g() { return x; }",
-                        "|  Added method g(), however, it cannot be invoked until variable x is declared"),
-                (a) -> assertCommand(a, "g()", "|  Attempted to call method g() which cannot be invoked until variable x is declared")
+                        "|  created method g(), however, it cannot be invoked until variable x is declared"),
+                (a) -> assertCommand(a, "g()", "|  attempted to call method g() which cannot be invoked until variable x is declared")
         );
     }
 
+    public void testUnknownCommand() {
+        test((a) -> assertCommand(a, "/unknown",
+                "|  No such command or snippet id: /unknown\n" +
+                "|  Type /help for help."));
+    }
+
+    public void testEmptyClassPath() {
+        test(after -> assertCommand(after, "/classpath", "|  The /classpath command requires a path argument."));
+    }
+
+    public void testNoArgument() {
+        String[] commands = {"/save", "/open", "/set start"};
+        test(Stream.of(commands)
+                .map(cmd -> {
+                    String c = cmd;
+                    final String finalC = c;
+                    return (ReplTest) after -> assertCommand(after, cmd,
+                            "|  '" + finalC + "' requires a filename argument.");
+                })
+                .toArray(ReplTest[]::new));
+    }
+
     public void testDebug() {
         test(
                 (a) -> assertCommand(a, "/deb", "|  Debugging on"),
@@ -85,6 +199,72 @@
         );
     }
 
+    public void testDrop() {
+        test(false, new String[]{"-nostartup"},
+                a -> assertVariable(a, "int", "a"),
+                a -> dropVariable(a, "/drop 1", "int a = 0", "|  dropped variable a"),
+                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
+                a -> dropMethod(a, "/drop 2", "b ()I", "|  dropped method b()"),
+                a -> assertClass(a, "class A {}", "class", "A"),
+                a -> dropClass(a, "/drop 3", "class A", "|  dropped 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", "|  dropped variable a"),
+                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
+                a -> dropMethod(a, "/drop b", "b ()I", "|  dropped method b()"),
+                a -> assertClass(a, "class A {}", "class", "A"),
+                a -> dropClass(a, "/drop A", "class A", "|  dropped 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() {
+        test(false, new String[]{"-nostartup"},
+                a -> assertCommandOutputStartsWith(a, "/drop 0", "|  No definition or id found named: 0"),
+                a -> assertCommandOutputStartsWith(a, "/drop a", "|  No definition or id found named: a"),
+                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", "a ==> 0"),
+                a -> assertCommand(a, "/drop 2", "|  The argument did not specify an active import, variable, method, or class to drop.")
+        );
+    }
+
+    public void testAmbiguousDrop() {
+        Consumer<String> check = s -> {
+            assertTrue(s.startsWith("|  The argument references more than one import, variable, method, or class"), s);
+            int lines = s.split("\n").length;
+            assertEquals(lines, 5, "Expected 3 ambiguous keys, but found: " + (lines - 2) + "\n" + s);
+        };
+        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 testHelpLength() {
         Consumer<String> testOutput = (s) -> {
             List<String> ss = Stream.of(s.split("\n"))
@@ -148,6 +328,16 @@
         );
     }
 
+    public void testCommandPrefix() {
+        test(a -> assertCommandCheckOutput(a, "/s",
+                      assertStartsWith("|  Command: '/s' is ambiguous: /save, /set")),
+             a -> assertCommand(a, "int var", "var ==> 0"),
+             a -> assertCommandCheckOutput(a, "/va",
+                      assertStartsWith("|    int var = 0")),
+             a -> assertCommandCheckOutput(a, "/save",
+                      assertStartsWith("|  '/save' requires a filename argument.")));
+    }
+
     public void testHeadlessEditPad() {
         String prevHeadless = System.getProperty("java.awt.headless");
         try {
--- a/test/tools/javac/unit/T6198196.java	Thu Apr 14 09:09:34 2016 -0700
+++ b/test/tools/javac/unit/T6198196.java	Thu Apr 14 09:34:00 2016 -0700
@@ -36,34 +36,31 @@
 
 public class T6198196 {
     static String pkginf = "package-info";
-    static StandardJavaFileManager fm;
-    static void test(String pathname, String filename, boolean result) {
-        JavaFileObject fo;
-        fo = fm.getJavaFileObjectsFromStrings(Arrays.asList(pathname)).iterator().next();
-        if (result != fo.isNameCompatible(filename, JavaFileObject.Kind.SOURCE))
-            throw new AssertionError("endsWith(" + pathname + ", "
-                                     + filename + ") != " + result);
-        System.out.format("OK: endsWith(%s, %s) = %s%n", pathname, filename, result);
+    static void test(String pathname, String filename, boolean result) throws IOException {
+        try (StandardJavaFileManager fm =
+                ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
+            JavaFileObject fo =
+                    fm.getJavaFileObjectsFromStrings(Arrays.asList(pathname)).iterator().next();
+            if (result != fo.isNameCompatible(filename, JavaFileObject.Kind.SOURCE))
+                throw new AssertionError("endsWith(" + pathname + ", "
+                                         + filename + ") != " + result);
+            System.out.format("OK: endsWith(%s, %s) = %s%n", pathname, filename, result);
+        }
     }
     public static void main(String[] args) throws IOException {
-        fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
-        try {
-            boolean windows = System.getProperty("os.name").startsWith("Windows");
-            test("/x/y/z/package-info.java", pkginf, true);
-            if (windows) {
-                test("\\x\\y\\z\\package-info.java", pkginf, true);
-                test("..\\x\\y\\z\\package-info.java", pkginf, true);
-            } else {
-                test("\\x\\y\\z\\package-info.java", pkginf, false);
-                test("..\\x\\y\\z\\package-info.java", pkginf, false);
-            }
-            test("Package-info.java", pkginf, false);
-            test("../x/y/z/package-info.java", pkginf, true);
-            test("/x/y/z/package-info.java", pkginf, true);
-            test("x/y/z/package-info.java", pkginf, true);
-            test("package-info.java", pkginf, true);
-        } finally {
-            fm.close();
+        boolean windows = System.getProperty("os.name").startsWith("Windows");
+        test("/x/y/z/package-info.java", pkginf, true);
+        if (windows) {
+            test("\\x\\y\\z\\package-info.java", pkginf, true);
+            test("..\\x\\y\\z\\package-info.java", pkginf, true);
+        } else {
+            test("\\x\\y\\z\\package-info.java", pkginf, false);
+            test("..\\x\\y\\z\\package-info.java", pkginf, false);
         }
+        test("Package-info.java", pkginf, false);
+        test("../x/y/z/package-info.java", pkginf, true);
+        test("/x/y/z/package-info.java", pkginf, true);
+        test("x/y/z/package-info.java", pkginf, true);
+        test("package-info.java", pkginf, true);
     }
 }