Merge
authorlana
Fri, 02 Sep 2016 02:42:03 +0000
changeset 40773 20e81d45dfba
parent 40760 bd885379d32c (current diff)
parent 40772 de87954b8f20 (diff)
child 40774 bed459be3a01
Merge
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Fri Sep 02 02:42:03 2016 +0000
@@ -119,10 +119,6 @@
      */
     final Name completionFailureName;
 
-    /** Module specified with -Xmodule:
-     */
-    final Name moduleOverride;
-
     /** Access to files
      */
     private final JavaFileManager fileManager;
@@ -210,9 +206,6 @@
             ? names.fromString(options.get("failcomplete"))
             : null;
 
-        moduleOverride = options.isSet(Option.XMODULE) ? names.fromString(options.get(Option.XMODULE))
-                                                : null;
-
         // Temporary, until more info is available from the module system.
         boolean useCtProps;
         JavaFileManager fm = context.get(JavaFileManager.class);
@@ -527,16 +520,15 @@
         if (msym == syms.noModule) {
             preferCurrent = false;
             if (userPathsFirst) {
-                scanUserPaths(p);
+                scanUserPaths(p, true);
                 preferCurrent = true;
                 scanPlatformPath(p);
             } else {
                 scanPlatformPath(p);
-                scanUserPaths(p);
+                scanUserPaths(p, true);
             }
         } else if (msym.classLocation == StandardLocation.CLASS_PATH) {
-            // assert p.modle.sourceLocation == StandardLocation.SOURCE_PATH);
-            scanUserPaths(p);
+            scanUserPaths(p, msym.sourceLocation == StandardLocation.SOURCE_PATH);
         } else {
             scanModulePaths(p, msym);
         }
@@ -561,23 +553,6 @@
 
         String packageName = p.fullname.toString();
 
-        if (msym.name == moduleOverride) {
-            if (wantClassFiles) {
-                fillIn(p, CLASS_PATH,
-                       fileManager.list(CLASS_PATH,
-                                        packageName,
-                                        classKinds,
-                                        false));
-            }
-            if (wantSourceFiles && fileManager.hasLocation(SOURCE_PATH)) {
-                fillIn(p, SOURCE_PATH,
-                        fileManager.list(SOURCE_PATH,
-                                        packageName,
-                                        sourceKinds,
-                                        false));
-            }
-        }
-
         Location classLocn = msym.classLocation;
         Location sourceLocn = msym.sourceLocation;
 
@@ -600,7 +575,7 @@
     /**
      * Scans class path and source path for files in given package.
      */
-    private void scanUserPaths(PackageSymbol p) throws IOException {
+    private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException {
         Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
 
         Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
@@ -611,7 +586,7 @@
         sourceKinds.remove(JavaFileObject.Kind.CLASS);
         boolean wantSourceFiles = !sourceKinds.isEmpty();
 
-        boolean haveSourcePath = fileManager.hasLocation(SOURCE_PATH);
+        boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH);
 
         if (verbose && verbosePath) {
             if (fileManager instanceof StandardJavaFileManager) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Sep 02 02:42:03 2016 +0000
@@ -359,6 +359,19 @@
         return (flags_field & DEPRECATED) != 0;
     }
 
+    public boolean isDeprecatableViaAnnotation() {
+        switch (getKind()) {
+            case LOCAL_VARIABLE:
+            case PACKAGE:
+            case PARAMETER:
+            case RESOURCE_VARIABLE:
+            case EXCEPTION_PARAMETER:
+                return false;
+            default:
+                return true;
+        }
+    }
+
     public boolean isStatic() {
         return
             (flags() & STATIC) != 0 ||
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Fri Sep 02 02:42:03 2016 +0000
@@ -3192,7 +3192,7 @@
     }
 
     void checkDeprecatedAnnotation(DiagnosticPosition pos, Symbol s) {
-        if (lint.isEnabled(LintCategory.DEP_ANN) &&
+        if (lint.isEnabled(LintCategory.DEP_ANN) && s.isDeprecatableViaAnnotation() &&
             (s.flags() & DEPRECATED) != 0 &&
             !syms.deprecatedType.isErroneous() &&
             s.attribute(syms.deprecatedType.tsym) == null) {
@@ -3200,18 +3200,10 @@
                     pos, "missing.deprecated.annotation");
         }
         // Note: @Deprecated has no effect on local variables, parameters and package decls.
-        if (lint.isEnabled(LintCategory.DEPRECATION)) {
+        if (lint.isEnabled(LintCategory.DEPRECATION) && !s.isDeprecatableViaAnnotation()) {
             if (!syms.deprecatedType.isErroneous() && s.attribute(syms.deprecatedType.tsym) != null) {
-                switch (s.getKind()) {
-                    case LOCAL_VARIABLE:
-                    case PACKAGE:
-                    case PARAMETER:
-                    case RESOURCE_VARIABLE:
-                    case EXCEPTION_PARAMETER:
-                        log.warning(LintCategory.DEPRECATION, pos,
-                                "deprecated.annotation.has.no.effect", Kinds.kindName(s));
-                        break;
-                }
+                log.warning(LintCategory.DEPRECATION, pos,
+                        "deprecated.annotation.has.no.effect", Kinds.kindName(s));
             }
         }
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Fri Sep 02 02:42:03 2016 +0000
@@ -392,6 +392,7 @@
                             if (moduleOverride != null) {
                                 checkNoAllModulePath();
                                 defaultModule = moduleFinder.findModule(names.fromString(moduleOverride));
+                                defaultModule.sourceLocation = StandardLocation.SOURCE_PATH;
                             } else {
                                 // Question: why not do findAllModules and initVisiblePackages here?
                                 // i.e. body of unnamedModuleCompleter
@@ -432,7 +433,9 @@
 
             if (defaultModule != syms.unnamedModule) {
                 syms.unnamedModule.completer = getUnnamedModuleCompleter();
-                syms.unnamedModule.sourceLocation = StandardLocation.SOURCE_PATH;
+                if (moduleOverride == null) {
+                    syms.unnamedModule.sourceLocation = StandardLocation.SOURCE_PATH;
+                }
                 syms.unnamedModule.classLocation = StandardLocation.CLASS_PATH;
             }
 
@@ -1090,7 +1093,7 @@
         Set<ModuleSymbol> requiresPublic = requiresPublicCache.get(msym);
 
         if (requiresPublic == null) {
-            //the module graph may contain cycles involving automatic modules or -XaddReads edges
+            //the module graph may contain cycles involving automatic modules or --add-reads edges
             requiresPublic = new HashSet<>();
 
             Set<ModuleSymbol> seen = new HashSet<>();
@@ -1192,7 +1195,7 @@
             }
 
             // Terminology comes from
-            //  -XaddExports:module/package=target,...
+            //  --add-exports module/package=target,...
             // Compare to
             //  module module { exports package to target, ... }
             String moduleName = em.group(1);
@@ -1245,7 +1248,7 @@
             }
 
             // Terminology comes from
-            //  -XaddReads:target-module=source-module,...
+            //  --add-reads target-module=source-module,...
             // Compare to
             //  module target-module { requires source-module; ... }
             String targetName = rm.group(1);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Fri Sep 02 02:42:03 2016 +0000
@@ -810,7 +810,7 @@
      * SYSTEM_MODULES and MODULE_PATH.
      *
      * The Location can be specified to accept overriding classes from the
-     * {@code -Xpatch:<module>=<path> } parameter.
+     * {@code --patch-module <module>=<path> } parameter.
      */
     private class ModuleLocationHandler extends LocationHandler implements Location {
         protected final String name;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Fri Sep 02 02:42:03 2016 +0000
@@ -183,15 +183,15 @@
 
     SOURCE_PATH("--source-path -sourcepath", "opt.arg.path", "opt.sourcepath", STANDARD, FILEMANAGER),
 
-    MODULE_SOURCE_PATH("--module-source-path -modulesourcepath", "opt.arg.mspath", "opt.modulesourcepath", STANDARD, FILEMANAGER),
+    MODULE_SOURCE_PATH("--module-source-path", "opt.arg.mspath", "opt.modulesourcepath", STANDARD, FILEMANAGER),
 
-    MODULE_PATH("--module-path -p -modulepath -mp", "opt.arg.path", "opt.modulepath", STANDARD, FILEMANAGER),
+    MODULE_PATH("--module-path -p", "opt.arg.path", "opt.modulepath", STANDARD, FILEMANAGER),
 
-    UPGRADE_MODULE_PATH("--upgrade-module-path -upgrademodulepath", "opt.arg.path", "opt.upgrademodulepath", STANDARD, FILEMANAGER),
+    UPGRADE_MODULE_PATH("--upgrade-module-path", "opt.arg.path", "opt.upgrademodulepath", STANDARD, FILEMANAGER),
 
-    SYSTEM("--system -system", "opt.arg.jdk", "opt.system", STANDARD, FILEMANAGER),
+    SYSTEM("--system", "opt.arg.jdk", "opt.system", STANDARD, FILEMANAGER),
 
-    PATCH_MODULE("--patch-module -Xpatch:", "opt.arg.patch", "opt.patch", EXTENDED, FILEMANAGER) {
+    PATCH_MODULE("--patch-module", "opt.arg.patch", "opt.patch", EXTENDED, FILEMANAGER) {
         // The deferred filemanager diagnostics mechanism assumes a single value per option,
         // but --patch-module can be used multiple times, once per module. Therefore we compose
         // a value for the option containing the last value specified for each module, and separate
@@ -273,7 +273,7 @@
 
     PROCESSOR_PATH("--processor-path -processorpath", "opt.arg.path", "opt.processorpath", STANDARD, FILEMANAGER),
 
-    PROCESSOR_MODULE_PATH("--processor-module-path -processormodulepath", "opt.arg.path", "opt.processormodulepath", STANDARD, FILEMANAGER),
+    PROCESSOR_MODULE_PATH("--processor-module-path", "opt.arg.path", "opt.processormodulepath", STANDARD, FILEMANAGER),
 
     PARAMETERS("-parameters","opt.parameters", STANDARD, BASIC),
 
@@ -311,7 +311,7 @@
         }
     },
 
-    RELEASE("--release -release", "opt.arg.release", "opt.release", STANDARD, BASIC) {
+    RELEASE("--release", "opt.arg.release", "opt.release", STANDARD, BASIC) {
         @Override
         protected void help(Log log) {
             Iterable<PlatformProvider> providers =
@@ -566,7 +566,7 @@
         }
     },
 
-    ADD_EXPORTS("--add-exports -XaddExports:", "opt.arg.addExports", "opt.addExports", EXTENDED, BASIC) {
+    ADD_EXPORTS("--add-exports", "opt.arg.addExports", "opt.addExports", EXTENDED, BASIC) {
         @Override
         public boolean process(OptionHelper helper, String option, String arg) {
             String prev = helper.get(ADD_EXPORTS);
@@ -575,7 +575,7 @@
         }
     },
 
-    ADD_READS("--add-reads -XaddReads:", "opt.arg.addReads", "opt.addReads", EXTENDED, BASIC) {
+    ADD_READS("--add-reads", "opt.arg.addReads", "opt.addReads", EXTENDED, BASIC) {
         @Override
         public boolean process(OptionHelper helper, String option, String arg) {
             String prev = helper.get(ADD_READS);
@@ -598,9 +598,9 @@
 
     MODULE("--module -m", "opt.arg.m", "opt.m", STANDARD, BASIC),
 
-    ADD_MODULES("--add-modules -addmods", "opt.arg.addmods", "opt.addmods", STANDARD, BASIC),
+    ADD_MODULES("--add-modules", "opt.arg.addmods", "opt.addmods", STANDARD, BASIC),
 
-    LIMIT_MODULES("--limit-modules -limitmods", "opt.arg.limitmods", "opt.limitmods", STANDARD, BASIC),
+    LIMIT_MODULES("--limit-modules", "opt.arg.limitmods", "opt.limitmods", STANDARD, BASIC),
 
     // This option exists only for the purpose of documenting itself.
     // It's actually implemented by the CommandLine class.
@@ -645,7 +645,7 @@
         }
     },
 
-    MULTIRELEASE("--multi-release -multi-release", "opt.arg.multi-release", "opt.multi-release", HIDDEN, FILEMANAGER),
+    MULTIRELEASE("--multi-release", "opt.arg.multi-release", "opt.multi-release", HIDDEN, FILEMANAGER),
 
     INHERIT_RUNTIME_ENVIRONMENT("--inherit-runtime-environment", "opt.inherit_runtime_environment",
             EXTENDED, BASIC) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/PlatformDescription.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/PlatformDescription.java	Fri Sep 02 02:42:03 2016 +0000
@@ -36,7 +36,7 @@
 
 import com.sun.source.util.Plugin;
 
-/**A description of settings needed for a particular {@code -release name} option.
+/**A description of settings needed for a particular {@code --release name} option.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/PlatformProvider.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/PlatformProvider.java	Fri Sep 02 02:42:03 2016 +0000
@@ -25,7 +25,7 @@
 
 package com.sun.tools.javac.platform;
 
-/** A collection of platform descriptions that can be selected using {@code -release name}
+/** A collection of platform descriptions that can be selected using {@code --release name}
  *  command line option.
  *  Register in {@code META-INF/services/com.sun.tools.javac.platform.PlatformProvider}.
  *
@@ -36,7 +36,7 @@
  */
 public interface PlatformProvider {
 
-    /**Names of platforms supported by this provider. Each returned name can be used as the key for -release.
+    /**Names of platforms supported by this provider. Each returned name can be used as the key for --release.
      *
      * @return the platform keys
      */
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/package-info.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/package-info.java	Fri Sep 02 02:42:03 2016 +0000
@@ -24,7 +24,7 @@
  */
 
 /**
- *  An internal API for plugging in -release implementations.
+ *  An internal API for plugging in --release implementations.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Sep 02 02:42:03 2016 +0000
@@ -2780,10 +2780,10 @@
     illegal combination of -Xmodule and module-info on classpath
 
 compiler.err.xmodule.no.module.sourcepath=\
-    illegal combination of -Xmodule and -modulesourcepath
+    illegal combination of -Xmodule and --module-source-path
 
 compiler.err.processorpath.no.processormodulepath=\
-    illegal combination of -processorpath and -processormodulepath
+    illegal combination of -processorpath and --processor-module-path
 
 # 0: symbol
 compiler.err.package.in.other.module=\
@@ -2817,22 +2817,22 @@
 
 # 0:  string
 compiler.err.xaddexports.malformed.entry=\
-    bad value for -XaddExports: {0}
+    bad value for --add-exports {0}
 
 # 0: string
 compiler.err.xaddexports.too.many=\
-    multiple -XaddExports options for {0}
+    multiple --add-exports options for {0}
 
 # 0:  string
 compiler.err.xaddreads.malformed.entry=\
-    bad value for -XaddReads: {0}
+    bad value for --add-reads {0}
 
 # 0: string
 compiler.err.xaddreads.too.many=\
-    multiple -XaddReads options for {0}
+    multiple --add-reads options for {0}
 
 compiler.err.addmods.all.module.path.invalid=\
-    -addmods ALL-MODULE-PATH can only be used when compiling the unnamed module
+    --add-modules ALL-MODULE-PATH can only be used when compiling the unnamed module
 
 compiler.misc.locn.module_source_path=\
     module source path
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Fri Sep 02 02:42:03 2016 +0000
@@ -390,10 +390,10 @@
 javac.fullVersion={0} full version "{1}"
 
 javac.err.release.bootclasspath.conflict=\
-    option {0} cannot be used together with -release
+    option {0} cannot be used together with --release
 
 javac.err.unsupported.release.version=\
     release version {0} not supported
 
 javac.err.release.not.standard.file.manager=\
-    -release option specified, but the provided JavaFileManager is not a StandardJavaFileManager.
+    --release option specified, but the provided JavaFileManager is not a StandardJavaFileManager.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java	Fri Sep 02 02:42:03 2016 +0000
@@ -26,6 +26,8 @@
 package com.sun.tools.javac.util;
 
 import java.util.*;
+
+import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.main.Option;
 import static com.sun.tools.javac.main.Option.*;
 
@@ -176,7 +178,17 @@
         // disabled
         return
             isSet(XLINT_CUSTOM, s) ||
-            (isSet(XLINT) || isSet(XLINT_CUSTOM, "all")) &&
+            (isSet(XLINT) || isSet(XLINT_CUSTOM, "all") || (s.equals("dep-ann") && depAnnOnByDefault())) &&
                 isUnset(XLINT_CUSTOM, "-" + s);
     }
+        // where
+        private boolean depAnnOnByDefault() {
+            String sourceName = get(Option.SOURCE);
+            Source source = null;
+            if (sourceName != null)
+                source = Source.lookup(sourceName);
+            if (source == null)
+                source = Source.DEFAULT;
+            return source.compareTo(Source.JDK1_9) >= 0;
+        }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Option.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Option.java	Fri Sep 02 02:42:03 2016 +0000
@@ -85,13 +85,7 @@
                 helper.modulepath(paths);
         }
     },
-    MODULEPATH("-modulepath", "An alias for -modulepath") {
-        @Override
-        protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
-            MODULE_PATH.processMatching(iter, helper);
-        }
-    },
-    P("-p", "An alias for -modulepath") {
+    P("-p", "An alias for --module-path") {
         @Override
         protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
             MODULE_PATH.processMatching(iter, helper);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java	Fri Sep 02 02:42:03 2016 +0000
@@ -104,13 +104,6 @@
         }
     },
 
-    MODULESOURCEPATH("-modulesourcepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg);
-        }
-    },
-
     MODULE_SOURCE_PATH("--module-source-path", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -118,13 +111,6 @@
         }
     },
 
-    UPGRADEMODULEPATH("-upgrademodulepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg);
-        }
-    },
-
     UPGRADE_MODULE_PATH("--upgrade-module-path", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -132,13 +118,6 @@
         }
     },
 
-    SYSTEM("-system", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SYSTEM, arg);
-        }
-    },
-
     SYSTEM_("--system", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -146,13 +125,6 @@
         }
     },
 
-    MODULEPATH("-modulepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_PATH, arg);
-        }
-    },
-
     MODULE_PATH("--module-path", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -167,13 +139,6 @@
         }
     },
 
-    ADDMODS("-addmods", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
     ADD_MODULES("--add-modules", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -181,13 +146,6 @@
         }
     },
 
-    LIMITMODS("-limitmods", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
     LIMIT_MODULES("--limit-modules", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -210,13 +168,6 @@
         }
     },
 
-    RELEASE_OLD("-release", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt("--release", arg);
-        }
-    },
-
     SOURCE("-source", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -238,13 +189,6 @@
         }
     },
 
-    XADDREADS("-XaddReads:", false) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.ADD_READS.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     ADD_READS("--add-reads", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -252,13 +196,6 @@
         }
     },
 
-    ADDEXPORTS("-XaddExports:", false) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.ADD_EXPORTS.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     ADD_EXPORTS("--add-exports", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -273,13 +210,6 @@
         }
     },
 
-    XPATCH("-Xpatch:", false) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.XMODULE.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     PATCH_MODULE("--patch-module", true) {
         @Override
         public void process(Helper helper, String arg) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Fri Sep 02 02:42:03 2016 +0000
@@ -106,13 +106,6 @@
         }
     },
 
-    MODULESOURCEPATH("-modulesourcepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg);
-        }
-    },
-
     MODULE_SOURCE_PATH("--module-source-path", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -120,13 +113,6 @@
         }
     },
 
-    UPGRADEMODULEPATH("-upgrademodulepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg);
-        }
-    },
-
     UPGRADE_MODULE_PATH("--upgrade-module-path", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -134,27 +120,13 @@
         }
     },
 
-    SYSTEM("-system", true) {
+    SYSTEM("--system", true) {
         @Override
         public void process(Helper helper, String arg) {
             helper.setFileManagerOpt(Option.SYSTEM, arg);
         }
     },
 
-    SYSTEM_("--system", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SYSTEM, arg);
-        }
-    },
-
-    MODULEPATH("-modulepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_PATH, arg);
-        }
-    },
-
     MODULE_PATH("--module-path", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -169,13 +141,6 @@
         }
     },
 
-    ADDMODS("-addmods", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.ADD_MODULES.process(helper.getOptionHelper(), opt, arg);
-        }
-    },
-
     ADD_MODULES("--add-modules", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -183,13 +148,6 @@
         }
     },
 
-    LIMITMODS("-limitmods", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.LIMIT_MODULES.process(helper.getOptionHelper(), opt, arg);
-        }
-    },
-
     LIMIT_MODULES("--limit-modules", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -218,13 +176,6 @@
         }
     },
 
-    RELEASE_OLD("-release", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.RELEASE.process(helper.getOptionHelper(), opt, arg);
-        }
-    },
-
     SOURCE("-source", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -246,13 +197,6 @@
         }
     },
 
-    XADDREADS("-XaddReads:", false) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.ADD_READS.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     ADD_READS("--add-reads", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -260,13 +204,6 @@
         }
     },
 
-    ADDEXPORTS("-XaddExports:", false) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.ADD_EXPORTS.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     ADD_EXPORTS("--add-exports", true) {
         @Override
         public void process(Helper helper, String arg) {
@@ -281,13 +218,6 @@
         }
     },
 
-    XPATCH("-Xpatch:", false) {
-        @Override
-        public void process(Helper helper, String arg) {
-            Option.XMODULE.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     PATCH_MODULE("--patch-module", true) {
         @Override
         public void process(Helper helper, String arg) {
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Fri Sep 02 02:42:03 2016 +0000
@@ -81,7 +81,7 @@
  *  - more rigorous GNU style option parsing; use joptsimple?
  *
  * FUTURES:
- *  - add module support: -addmods, -modulepath, module arg
+ *  - add module support: --add-modules, --module-path, module arg
  *  - load deprecation declarations from a designated class library instead
  *    of the JDK
  *  - load deprecation declarations from a module
@@ -181,7 +181,7 @@
                      .filter(name -> !name.endsWith("package-info.class"))
                      .filter(name -> !name.endsWith("module-info.class"))
                      .map(s -> s.replaceAll("\\.class$", ""))
-                     .map(s -> s.replace('/', '.'))
+                     .map(s -> s.replace(File.separatorChar, '.'))
                      .collect(toList()));
     }
 
@@ -331,7 +331,7 @@
      * @throws IOException if an I/O error occurs
      */
     boolean processSelf(Collection<String> classes) throws IOException {
-        options.add("-addmods");
+        options.add("--add-modules");
         options.add("java.se.ee,jdk.xml.bind"); // TODO why jdk.xml.bind?
 
         if (classes.isEmpty()) {
@@ -360,7 +360,7 @@
      * @return success value
      */
     boolean processRelease(String release, Collection<String> classes) throws IOException {
-        options.addAll(List.of("-release", release));
+        options.addAll(List.of("--release", release));
 
         if (release.equals("9")) {
             List<String> rootMods = List.of("java.se", "java.se.ee");
@@ -368,7 +368,7 @@
             JavaCompiler.CompilationTask task =
                 compiler.getTask(null, fm, this,
                                  // options
-                                 List.of("-addmods", String.join(",", rootMods)),
+                                 List.of("--add-modules", String.join(",", rootMods)),
                                  // classes
                                  List.of("java.lang.Object"),
                                  null);
@@ -377,7 +377,7 @@
                 return false;
             }
             Map<PackageElement, List<TypeElement>> types = proc.getPublicTypes();
-            options.add("-addmods");
+            options.add("--add-modules");
             options.add(String.join(",", rootMods));
             return doClassNames(
                 types.values().stream()
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java	Fri Sep 02 02:42:03 2016 +0000
@@ -56,7 +56,7 @@
  * 1. archives specified in the command line arguments
  * 2. observable modules matching the source filter
  * 3. classpath archives matching the source filter or target filter
- * 4. -addmods and -m root modules
+ * 4. --add-modules and -m root modules
  */
 public class DepsAnalyzer {
     final JdepsConfiguration configuration;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Fri Sep 02 02:42:03 2016 +0000
@@ -127,7 +127,7 @@
             }
         }
 
-        // all roots specified in -addmods or -m are included
+        // all roots specified in --add-modules or -m are included
         // as the initial set for analysis.
         roots.stream()
              .map(nameToModule::get)
@@ -342,7 +342,7 @@
 
         SystemModuleFinder(String javaHome) throws IOException {
             if (javaHome == null) {
-                // -system none
+                // --system none
                 this.fileSystem = null;
                 this.root = null;
                 this.systemModules = Collections.emptyMap();
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Fri Sep 02 02:42:03 2016 +0000
@@ -313,7 +313,7 @@
             }
         },
 
-        // Another alternative to list modules in -addmods option
+        // Another alternative to list modules in --add-modules option
         new HiddenOption(true, "--include-system-modules") {
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
                 task.options.includeSystemModulePattern = Pattern.compile(arg);
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Fri Sep 02 02:42:03 2016 +0000
@@ -57,6 +57,8 @@
 import jdk.internal.jline.console.KeyMap;
 import jdk.internal.jline.console.UserInterruptException;
 import jdk.internal.jline.console.completer.Completer;
+import jdk.internal.jline.console.history.History;
+import jdk.internal.jline.console.history.MemoryHistory;
 import jdk.internal.jline.extra.EditingHistory;
 import jdk.internal.jshell.tool.StopDetectingInputStream.State;
 
@@ -68,6 +70,7 @@
     final StopDetectingInputStream input;
     final ConsoleReader in;
     final EditingHistory history;
+    final MemoryHistory userInputHistory = new MemoryHistory();
 
     String prefix = "";
 
@@ -299,6 +302,9 @@
     }
 
     public void beforeUserCode() {
+        synchronized (this) {
+            inputBytes = null;
+        }
         input.setState(State.BUFFER);
     }
 
@@ -380,6 +386,36 @@
         }
     }
 
+    private byte[] inputBytes;
+    private int inputBytesPointer;
+
+    @Override
+    public synchronized int readUserInput() {
+        while (inputBytes == null || inputBytes.length <= inputBytesPointer) {
+            boolean prevHandleUserInterrupt = in.getHandleUserInterrupt();
+            History prevHistory = in.getHistory();
+
+            try {
+                input.setState(State.WAIT);
+                in.setHandleUserInterrupt(true);
+                in.setHistory(userInputHistory);
+                inputBytes = (in.readLine("") + System.getProperty("line.separator")).getBytes();
+                inputBytesPointer = 0;
+            } catch (IOException ex) {
+                ex.printStackTrace();
+                return -1;
+            } catch (UserInterruptException ex) {
+                repl.state.stop();
+                return -1;
+            } finally {
+                in.setHistory(prevHistory);
+                in.setHandleUserInterrupt(prevHandleUserInterrupt);
+                input.setState(State.BUFFER);
+            }
+        }
+        return inputBytes[inputBytesPointer++];
+    }
+
     /**
      * A possible action which the user can choose to perform.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ContinuousCompletionProvider.java	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jshell.tool;
+
+import java.util.List;
+import static java.util.Comparator.comparing;
+import java.util.Map;
+import java.util.function.BiPredicate;
+import java.util.function.Supplier;
+import static java.util.stream.Collectors.toList;
+import java.util.stream.Stream;
+import jdk.internal.jshell.tool.JShellTool.CompletionProvider;
+import jdk.jshell.SourceCodeAnalysis;
+import jdk.jshell.SourceCodeAnalysis.Suggestion;
+
+class ContinuousCompletionProvider implements CompletionProvider {
+
+    static final BiPredicate<String, String> STARTSWITH_MATCHER =
+            (word, input) -> word.startsWith(input);
+    static final BiPredicate<String, String> PERFECT_MATCHER =
+            (word, input) -> word.equals(input);
+
+    private final Supplier<Map<String, CompletionProvider>> wordCompletionProviderSupplier;
+    private final BiPredicate<String, String> matcher;
+
+    ContinuousCompletionProvider(
+            Map<String, CompletionProvider> wordCompletionProvider,
+            BiPredicate<String, String> matcher) {
+        this(() -> wordCompletionProvider, matcher);
+    }
+
+    ContinuousCompletionProvider(
+            Supplier<Map<String, CompletionProvider>> wordCompletionProviderSupplier,
+            BiPredicate<String, String> matcher) {
+        this.wordCompletionProviderSupplier = wordCompletionProviderSupplier;
+        this.matcher = matcher;
+    }
+
+    @Override
+    public List<Suggestion> completionSuggestions(String input, int cursor, int[] anchor) {
+        String prefix = input.substring(0, cursor);
+        int space = prefix.indexOf(' ');
+
+        Stream<SourceCodeAnalysis.Suggestion> result;
+
+        Map<String, CompletionProvider> wordCompletionProvider = wordCompletionProviderSupplier.get();
+
+        if (space == (-1)) {
+            result = wordCompletionProvider.keySet().stream()
+                    .distinct()
+                    .filter(key -> key.startsWith(prefix))
+                    .map(key -> new JShellTool.ArgSuggestion(key + " "));
+            anchor[0] = 0;
+        } else {
+            String rest = prefix.substring(space + 1);
+            String word = prefix.substring(0, space);
+
+            List<CompletionProvider> candidates = wordCompletionProvider.entrySet().stream()
+                    .filter(e -> matcher.test(e.getKey(), word))
+                    .map(Map.Entry::getValue)
+                    .collect(toList());
+            if (candidates.size() == 1) {
+                result = candidates.get(0).completionSuggestions(rest, cursor - space - 1, anchor).stream();
+            } else {
+                result = Stream.empty();
+            }
+            anchor[0] += space + 1;
+        }
+
+        return result.sorted(comparing(Suggestion::continuation))
+                     .collect(toList());
+    }
+
+}
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Fri Sep 02 02:42:03 2016 +0000
@@ -35,9 +35,14 @@
 import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import static java.util.stream.Collectors.joining;
+import static java.util.stream.Collectors.toMap;
+import static jdk.internal.jshell.tool.ContinuousCompletionProvider.PERFECT_MATCHER;
+import jdk.internal.jshell.tool.JShellTool.CompletionProvider;
+import static jdk.internal.jshell.tool.JShellTool.EMPTY_COMPLETION_PROVIDER;
 
 /**
  * Feedback customization support
@@ -146,6 +151,17 @@
                 .forEach(m -> m.readOnly = true);
     }
 
+    JShellTool.CompletionProvider modeCompletions() {
+        return modeCompletions(EMPTY_COMPLETION_PROVIDER);
+    }
+
+    JShellTool.CompletionProvider modeCompletions(CompletionProvider successor) {
+        return new ContinuousCompletionProvider(
+                () -> modeMap.keySet().stream()
+                        .collect(toMap(Function.identity(), m -> successor)),
+                PERFECT_MATCHER);
+    }
+
     {
         for (FormatCase e : FormatCase.all)
             selectorMap.put(e.name().toLowerCase(Locale.US), e);
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java	Fri Sep 02 02:42:03 2016 +0000
@@ -54,6 +54,8 @@
 
     public abstract void replaceLastHistoryEntry(String source);
 
+    public abstract int readUserInput();
+
     class InputInterruptedException extends Exception {
         private static final long serialVersionUID = 1L;
     }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Fri Sep 02 02:42:03 2016 +0000
@@ -26,7 +26,6 @@
 package jdk.internal.jshell.tool;
 
 import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
@@ -112,6 +111,7 @@
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_FMGR;
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
+import static jdk.internal.jshell.tool.ContinuousCompletionProvider.STARTSWITH_MATCHER;
 
 /**
  * Command line REPL tool for Java using the JShell API.
@@ -141,11 +141,30 @@
     /**
      * The constructor for the tool (used by tool launch via main and by test
      * harnesses to capture ins and outs.
+     * @param in command line input -- snippets, commands and user input
+     * @param cmdout command line output, feedback including errors
+     * @param cmderr start-up errors and debugging info
+     * @param console console control interaction
+     * @param userout code execution output  -- System.out.printf("hi")
+     * @param usererr code execution error stream  -- System.err.printf("Oops")
+     * @param prefs preferences to use
+     * @param locale locale to use
+     */
+    public JShellTool(InputStream in, PrintStream cmdout, PrintStream cmderr,
+            PrintStream console,
+            PrintStream userout, PrintStream usererr,
+            Preferences prefs, Locale locale) {
+        this(in, cmdout, cmderr, console, null, userout, usererr, prefs, locale);
+    }
+
+    /**
+     * The constructor for the tool (used by tool launch via main and by test
+     * harnesses to capture ins and outs.
      * @param cmdin command line input -- snippets and commands
      * @param cmdout command line output, feedback including errors
      * @param cmderr start-up errors and debugging info
      * @param console console control interaction
-     * @param userin code execution input (not yet functional)
+     * @param userin code execution input, or null to use IOContext
      * @param userout code execution output  -- System.out.printf("hi")
      * @param usererr code execution error stream  -- System.err.printf("Oops")
      * @param prefs preferences to use
@@ -159,7 +178,12 @@
         this.cmdout = cmdout;
         this.cmderr = cmderr;
         this.console = console;
-        this.userin = userin;
+        this.userin = userin != null ? userin : new InputStream() {
+            @Override
+            public int read() throws IOException {
+                return input.readUserInput();
+            }
+        };
         this.userout = userout;
         this.usererr = usererr;
         this.prefs = prefs;
@@ -451,7 +475,7 @@
      */
     public static void main(String[] args) throws Exception {
         new JShellTool(System.in, System.out, System.err, System.out,
-                 new ByteArrayInputStream(new byte[0]), System.out, System.err,
+                 System.out, System.err,
                  Preferences.userRoot().node("tool/JShell"),
                  Locale.getDefault())
                 .start(args);
@@ -909,6 +933,7 @@
 
     interface CompletionProvider {
         List<Suggestion> completionSuggestions(String input, int cursor, int[] anchor);
+
     }
 
     enum CommandKind {
@@ -953,14 +978,31 @@
 
     }
 
-    private static final CompletionProvider EMPTY_COMPLETION_PROVIDER = new FixedCompletionProvider();
+    static final CompletionProvider EMPTY_COMPLETION_PROVIDER = new FixedCompletionProvider();
     private static final CompletionProvider KEYWORD_COMPLETION_PROVIDER = new FixedCompletionProvider("-all ", "-start ", "-history ");
     private static final CompletionProvider RELOAD_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider("-restore", "-quiet");
+    private static final CompletionProvider SET_MODE_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider("-command", "-quiet", "-delete");
     private static final CompletionProvider FILE_COMPLETION_PROVIDER = fileCompletions(p -> true);
     private final Map<String, Command> commands = new LinkedHashMap<>();
     private void registerCommand(Command cmd) {
         commands.put(cmd.command, cmd);
     }
+
+    private static CompletionProvider skipWordThenCompletion(CompletionProvider completionProvider) {
+        return (input, cursor, anchor) -> {
+            List<Suggestion> result = Collections.emptyList();
+
+            int space = input.indexOf(' ');
+            if (space != -1) {
+                String rest = input.substring(space + 1);
+                result = completionProvider.completionSuggestions(rest, cursor - space - 1, anchor);
+                anchor[0] += space + 1;
+            }
+
+            return result;
+        };
+    }
+
     private static CompletionProvider fileCompletions(Predicate<Path> accept) {
         return (code, cursor, anchor) -> {
             int lastSlash = code.lastIndexOf('/');
@@ -1037,6 +1079,31 @@
         };
     }
 
+    private static CompletionProvider orMostSpecificCompletion(
+            CompletionProvider left, CompletionProvider right) {
+        return (code, cursor, anchor) -> {
+            int[] leftAnchor = {-1};
+            int[] rightAnchor = {-1};
+
+            List<Suggestion> leftSuggestions = left.completionSuggestions(code, cursor, leftAnchor);
+            List<Suggestion> rightSuggestions = right.completionSuggestions(code, cursor, rightAnchor);
+
+            List<Suggestion> suggestions = new ArrayList<>();
+
+            if (leftAnchor[0] >= rightAnchor[0]) {
+                anchor[0] = leftAnchor[0];
+                suggestions.addAll(leftSuggestions);
+            }
+
+            if (leftAnchor[0] <= rightAnchor[0]) {
+                anchor[0] = rightAnchor[0];
+                suggestions.addAll(rightSuggestions);
+            }
+
+            return suggestions;
+        };
+    }
+
     // Snippet lists
 
     Stream<Snippet> allSnippets() {
@@ -1123,10 +1190,26 @@
                 EMPTY_COMPLETION_PROVIDER));
         registerCommand(new Command("/set",
                 arg -> cmdSet(arg),
-                new FixedCompletionProvider(SET_SUBCOMMANDS)));
+                new ContinuousCompletionProvider(Map.of(
+                        // need more completion for format for usability
+                        "format", feedback.modeCompletions(),
+                        "truncation", feedback.modeCompletions(),
+                        "feedback", feedback.modeCompletions(),
+                        "mode", skipWordThenCompletion(orMostSpecificCompletion(
+                                feedback.modeCompletions(SET_MODE_OPTIONS_COMPLETION_PROVIDER),
+                                SET_MODE_OPTIONS_COMPLETION_PROVIDER)),
+                        "prompt", feedback.modeCompletions(),
+                        "editor", fileCompletions(Files::isExecutable),
+                        "start", FILE_COMPLETION_PROVIDER),
+                        STARTSWITH_MATCHER)));
         registerCommand(new Command("/retain",
                 arg -> cmdRetain(arg),
-                new FixedCompletionProvider(RETAIN_SUBCOMMANDS)));
+                new ContinuousCompletionProvider(Map.of(
+                        "feedback", feedback.modeCompletions(),
+                        "mode", feedback.modeCompletions(),
+                        "editor", fileCompletions(Files::isExecutable),
+                        "start", FILE_COMPLETION_PROVIDER),
+                        STARTSWITH_MATCHER)));
         registerCommand(new Command("/?",
                 "help.quest",
                 arg -> cmdHelp(arg),
@@ -1151,36 +1234,18 @@
         registerCommand(new Command("shortcuts",
                 "help.shortcuts",
                 CommandKind.HELP_SUBJECT));
+
+        commandCompletions = new ContinuousCompletionProvider(
+                commands.values().stream()
+                        .filter(c -> c.kind.shouldSuggestCompletions)
+                        .collect(toMap(c -> c.command, c -> c.completions)),
+                STARTSWITH_MATCHER);
     }
 
+    private ContinuousCompletionProvider commandCompletions;
+
     public List<Suggestion> commandCompletionSuggestions(String code, int cursor, int[] anchor) {
-        String prefix = code.substring(0, cursor);
-        int space = prefix.indexOf(' ');
-        Stream<Suggestion> result;
-
-        if (space == (-1)) {
-            result = commands.values()
-                             .stream()
-                             .distinct()
-                             .filter(cmd -> cmd.kind.shouldSuggestCompletions)
-                             .map(cmd -> cmd.command)
-                             .filter(key -> key.startsWith(prefix))
-                             .map(key -> new ArgSuggestion(key + " "));
-            anchor[0] = 0;
-        } else {
-            String arg = prefix.substring(space + 1);
-            String cmd = prefix.substring(0, space);
-            Command[] candidates = findCommand(cmd, c -> true);
-            if (candidates.length == 1) {
-                result = candidates[0].completions.completionSuggestions(arg, cursor - space, anchor).stream();
-                anchor[0] += space + 1;
-            } else {
-                result = Stream.empty();
-            }
-        }
-
-        return result.sorted((s1, s2) -> s1.continuation().compareTo(s2.continuation()))
-                     .collect(Collectors.toList());
+        return commandCompletions.completionSuggestions(code, cursor, anchor);
     }
 
     public String commandDocumentation(String code, int cursor) {
@@ -2484,7 +2549,7 @@
         }
     }
 
-    private static class ArgSuggestion implements Suggestion {
+    static class ArgSuggestion implements Suggestion {
 
         private final String continuation;
 
@@ -2579,6 +2644,11 @@
     public void close() {
         scannerIn.close();
     }
+
+    @Override
+    public int readUserInput() {
+        return -1;
+    }
 }
 
 class FileScannerIOContext extends ScannerIOContext {
@@ -2617,4 +2687,9 @@
     @Override
     public void close() {
     }
+
+    @Override
+    public int readUserInput() {
+        return -1;
+    }
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java	Fri Sep 02 02:42:03 2016 +0000
@@ -46,6 +46,8 @@
 import static jdk.jshell.CompletenessAnalyzer.TK.*;
 import jdk.jshell.TaskFactory.ParseTask;
 import java.util.List;
+import java.util.function.Function;
+import java.util.function.Supplier;
 
 /**
  * Low level scanner to determine completeness of input.
@@ -81,13 +83,13 @@
 
     CaInfo scan(String s) {
         try {
-            Scanner scanner = scannerFactory.newScanner(s, false);
-            Matched in = new Matched(scanner);
-            Parser parser = new Parser(in, proc, s);
+            Parser parser = new Parser(
+                    () -> new Matched(scannerFactory.newScanner(s, false)),
+                    () -> proc.taskFactory.new ParseTask(s));
             Completeness stat = parser.parseUnit();
             int endPos = stat == Completeness.UNKNOWN
                     ? s.length()
-                    : in.prevCT.endPos;
+                    : parser.endPos();
             return new CaInfo(stat, endPos);
         } catch (SyntaxException ex) {
             return new CaInfo(error(), s.length());
@@ -188,7 +190,7 @@
         ERROR(TokenKind.ERROR, XERRO),  //
         IDENTIFIER(TokenKind.IDENTIFIER, XEXPR1|XDECL1|XTERM),  //
         UNDERSCORE(TokenKind.UNDERSCORE, XERRO),  //  _
-        CLASS(TokenKind.CLASS, XEXPR|XDECL1|XTERM),  //  class decl and .class
+        CLASS(TokenKind.CLASS, XEXPR|XDECL1),  //  class decl (MAPPED: DOTCLASS)
         MONKEYS_AT(TokenKind.MONKEYS_AT, XEXPR|XDECL1),  //  @
         IMPORT(TokenKind.IMPORT, XDECL1|XSTART),  //  import -- consider declaration
         SEMI(TokenKind.SEMI, XSTMT1|XTERM|XSTART),  //  ;
@@ -206,15 +208,15 @@
         THROWS(TokenKind.THROWS, XDECL),  //  throws
 
         // Primarive type names
-        BOOLEAN(TokenKind.BOOLEAN, XEXPR|XDECL1),  //  boolean
-        BYTE(TokenKind.BYTE, XEXPR|XDECL1),  //  byte
-        CHAR(TokenKind.CHAR, XEXPR|XDECL1),  //  char
-        DOUBLE(TokenKind.DOUBLE, XEXPR|XDECL1),  //  double
-        FLOAT(TokenKind.FLOAT, XEXPR|XDECL1),  //  float
-        INT(TokenKind.INT, XEXPR|XDECL1),  //  int
-        LONG(TokenKind.LONG, XEXPR|XDECL1),  //  long
-        SHORT(TokenKind.SHORT, XEXPR|XDECL1),  //  short
-        VOID(TokenKind.VOID, XEXPR|XDECL1),  //  void
+        BOOLEAN(TokenKind.BOOLEAN, XEXPR1|XDECL1),  //  boolean
+        BYTE(TokenKind.BYTE, XEXPR1|XDECL1),  //  byte
+        CHAR(TokenKind.CHAR, XEXPR1|XDECL1),  //  char
+        DOUBLE(TokenKind.DOUBLE, XEXPR1|XDECL1),  //  double
+        FLOAT(TokenKind.FLOAT, XEXPR1|XDECL1),  //  float
+        INT(TokenKind.INT, XEXPR1|XDECL1),  //  int
+        LONG(TokenKind.LONG, XEXPR1|XDECL1),  //  long
+        SHORT(TokenKind.SHORT, XEXPR1|XDECL1),  //  short
+        VOID(TokenKind.VOID, XEXPR1|XDECL1),  //  void
 
         // Modifiers keywords
         ABSTRACT(TokenKind.ABSTRACT, XDECL1),  //  abstract
@@ -230,7 +232,7 @@
 
         // Declarations and type parameters (thus expressions)
         EXTENDS(TokenKind.EXTENDS, XEXPR|XDECL),  //  extends
-        COMMA(TokenKind.COMMA, XEXPR|XDECL),  //  ,
+        COMMA(TokenKind.COMMA, XEXPR|XDECL|XTERM),  //  ,
         AMP(TokenKind.AMP, XEXPR|XDECL),  //  &
         GT(TokenKind.GT, XEXPR|XDECL),  //  >
         LT(TokenKind.LT, XEXPR|XDECL1),  //  <
@@ -239,7 +241,7 @@
         GTGTGT(TokenKind.GTGTGT, XEXPR|XDECL),  //  >>>
         QUES(TokenKind.QUES, XEXPR|XDECL),  //  ?
         DOT(TokenKind.DOT, XEXPR|XDECL),  //  .
-        STAR(TokenKind.STAR, XEXPR|XDECL|XTERM),  //  * -- import foo.* //TODO handle these case separately, XTERM
+        STAR(TokenKind.STAR, XEXPR),  //  * (MAPPED: DOTSTAR)
 
         // Statement keywords
         ASSERT(TokenKind.ASSERT, XSTMT1|XSTART),  //  assert
@@ -280,7 +282,7 @@
 
         // Expressions cannot terminate
         INSTANCEOF(TokenKind.INSTANCEOF, XEXPR),  //  instanceof
-        NEW(TokenKind.NEW, XEXPR1),  //  new
+        NEW(TokenKind.NEW, XEXPR1),  //  new (MAPPED: COLCOLNEW)
         SUPER(TokenKind.SUPER, XEXPR1|XDECL),  //  super -- shouldn't see as rec. But in type parameters
         ARROW(TokenKind.ARROW, XEXPR),  //  ->
         COLCOL(TokenKind.COLCOL, XEXPR),  //  ::
@@ -323,24 +325,29 @@
         UNMATCHED(XERRO),
         PARENS(XEXPR1|XDECL|XSTMT|XTERM),
         BRACKETS(XEXPR|XDECL|XTERM),
-        BRACES(XSTMT1|XEXPR|XTERM);
+        BRACES(XSTMT1|XEXPR|XTERM),
+        DOTSTAR(XDECL|XTERM),  // import foo.*
+        COLCOLNEW(XEXPR|XTERM),  //  :: new
+        DOTCLASS(XEXPR|XTERM),  //  class decl and .class
+        ;
 
         static final EnumMap<TokenKind,TK> tokenKindToTKMap = new EnumMap<>(TokenKind.class);
 
         final TokenKind tokenKind;
         final int belongs;
+        Function<TK,TK> mapping;
 
         TK(int b) {
-            this.tokenKind = null;
-            this.belongs = b;
+            this(null, b);
         }
 
         TK(TokenKind tokenKind, int b) {
             this.tokenKind = tokenKind;
             this.belongs = b;
+            this.mapping = null;
         }
 
-        private static TK tokenKindToTK(TokenKind kind) {
+        private static TK tokenKindToTK(TK prev, TokenKind kind) {
             TK tk = tokenKindToTKMap.get(kind);
             if (tk == null) {
                 System.err.printf("No corresponding %s for %s: %s\n",
@@ -349,7 +356,9 @@
                         kind);
                 throw new InternalError("No corresponding TK for TokenKind: " + kind);
             }
-            return tk;
+            return tk.mapping != null
+                    ? tk.mapping.apply(prev)
+                    : tk;
         }
 
         boolean isOkToTerminate() {
@@ -383,8 +392,12 @@
                 }
             }
             for (TokenKind kind : TokenKind.values()) {
-                tokenKindToTK(kind); // assure they can be retrieved without error
+                tokenKindToTK(null, kind); // assure they can be retrieved without error
             }
+            // Mappings of disambiguated contexts
+            STAR.mapping  = prev -> prev == DOT ? DOTSTAR : STAR;
+            NEW.mapping   = prev -> prev == COLCOL ? COLCOLNEW : NEW;
+            CLASS.mapping = prev -> prev == DOT ? DOTCLASS : CLASS;
         }
     }
 
@@ -520,7 +533,7 @@
                         ct = match(BRACKETS, TokenKind.LBRACKET);
                         break;
                     default:
-                        ct = new CT(TK.tokenKindToTK(current.kind), advance());
+                        ct = new CT(TK.tokenKindToTK(prevTK, current.kind), advance());
                         break;
                 }
                 if (ct.kind.isStart() && !prevTK.isOkToTerminate()) {
@@ -539,21 +552,21 @@
      */
     private static class Parser {
 
-        final Matched in;
-        CT token;
-        Completeness checkResult;
-
-        final JShell proc;
-        final String scannedInput;
-
+        private final Supplier<Matched> matchedFactory;
+        private final Supplier<ParseTask> parseFactory;
+        private Matched in;
+        private CT token;
+        private Completeness checkResult;
 
+        Parser(Supplier<Matched> matchedFactory, Supplier<ParseTask> parseFactory) {
+            this.matchedFactory = matchedFactory;
+            this.parseFactory = parseFactory;
+            resetInput();
+        }
 
-        Parser(Matched in, JShell proc, String scannedInput) {
-            this.in = in;
+        final void resetInput() {
+            this.in = matchedFactory.get();
             nextToken();
-
-            this.proc = proc;
-            this.scannedInput = scannedInput;
         }
 
         final void nextToken() {
@@ -598,6 +611,10 @@
             return flags != Completeness.COMPLETE;
         }
 
+        public int endPos() {
+            return in.prevCT.endPos;
+        }
+
         public Completeness parseUnit() {
             //System.err.printf("%s:  belongs %o  XANY1 %o\n", token.kind, token.kind.belongs, token.kind.belongs & XANY1);
             switch (token.kind.belongs & XANY1) {
@@ -651,11 +668,11 @@
                         case IDENTIFIER:
                         case BRACKETS:
                             return Completeness.COMPLETE_WITH_SEMI;
-                        case STAR:
+                        case DOTSTAR:
                             if (isImport) {
                                 return Completeness.COMPLETE_WITH_SEMI;
                             } else {
-                                return Completeness.DEFINITELY_INCOMPLETE;
+                                return Completeness.UNKNOWN;
                             }
                         default:
                             return Completeness.DEFINITELY_INCOMPLETE;
@@ -667,7 +684,7 @@
 
         public Completeness disambiguateDeclarationVsExpression() {
             // String folding messes up position information.
-            ParseTask pt = proc.taskFactory.new ParseTask(scannedInput);
+            ParseTask pt = parseFactory.get();
             List<? extends Tree> units = pt.units();
             if (units.isEmpty()) {
                 return error();
@@ -679,7 +696,7 @@
                 case LABELED_STATEMENT:
                     if (shouldAbort(IDENTIFIER))  return checkResult;
                     if (shouldAbort(COLON))  return checkResult;
-                    return parseStatement();
+                return parseStatement();
                 case VARIABLE:
                 case IMPORT:
                 case CLASS:
@@ -693,51 +710,6 @@
             }
         }
 
-//        public Status parseExpressionOrDeclaration() {
-//            if (token.kind == IDENTIFIER) {
-//                nextToken();
-//                switch (token.kind) {
-//                    case IDENTIFIER:
-//                        return parseDeclaration();
-//                }
-//            }
-//            while (token.kind.isExpressionOrDeclaration()) {
-//                if (!token.kind.isExpression()) {
-//                    return parseDeclaration();
-//                }
-//                if (!token.kind.isDeclaration()) {
-//                    // Expression not declaration
-//                    if (token.kind == EQ) {
-//                        // Check for array initializer
-//                        nextToken();
-//                        if (token.kind == BRACES) {
-//                            nextToken();
-//                            return lastly(SEMI);
-//                        }
-//                    }
-//                    return parseExpressionStatement();
-//                }
-//                nextToken();
-//            }
-//            switch (token.kind) {
-//                case BRACES:
-//                case SEMI:
-//                    nextToken();
-//                    return Status.COMPLETE;
-//                case UNMATCHED:
-//                    nextToken();
-//                    return Status.DEFINITELY_INCOMPLETE;
-//                case EOF:
-//                    if (in.prevCT.kind.isOkToTerminate()) {
-//                        return Status.COMPLETE_WITH_SEMI;
-//                    } else {
-//                        return Status.DEFINITELY_INCOMPLETE;
-//                    }
-//                default:
-//                    return error();
-//            }
-//        }
-
         public Completeness parseExpressionStatement() {
             if (shouldAbort(parseExpression()))  return checkResult;
             return lastly(SEMI);
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Fri Sep 02 02:42:03 2016 +0000
@@ -555,9 +555,11 @@
                             : "";
                 } catch (ResolutionException ex) {
                     DeclarationSnippet sn = (DeclarationSnippet) state.maps.getSnippetDeadOrAlive(ex.id());
-                    exception = new UnresolvedReferenceException(sn, ex.getStackTrace());
+                    exception = new UnresolvedReferenceException(sn, translateExceptionStack(ex));
                 } catch (UserException ex) {
-                    exception = translateExecutionException(ex);
+                    exception = new EvalException(translateExceptionMessage(ex),
+                            ex.causeExceptionClass(),
+                            translateExceptionStack(ex));
                 } catch (RunException ex) {
                     // StopException - no-op
                 } catch (InternalException ex) {
@@ -732,7 +734,7 @@
         }
     }
 
-    private EvalException translateExecutionException(UserException ex) {
+    private StackTraceElement[] translateExceptionStack(Exception ex) {
         StackTraceElement[] raw = ex.getStackTrace();
         int last = raw.length;
         do {
@@ -759,11 +761,14 @@
                 elems[i] = r;
             }
         }
+        return elems;
+    }
+
+    private String translateExceptionMessage(Exception ex) {
         String msg = ex.getMessage();
-        if (msg.equals("<none>")) {
-            msg = null;
-        }
-        return new EvalException(msg, ex.causeExceptionClass(), elems);
+        return msg.equals("<none>")
+                ? null
+                : msg;
     }
 
     private boolean isWrap(StackTraceElement ste) {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java	Fri Sep 02 02:42:03 2016 +0000
@@ -51,8 +51,6 @@
 import jdk.jshell.spi.ExecutionControl.ExecutionControlException;
 import jdk.jshell.spi.ExecutionEnv;
 import static jdk.jshell.execution.Util.failOverExecutionControlGenerator;
-import static java.util.stream.Collectors.collectingAndThen;
-import static java.util.stream.Collectors.toList;
 import static jdk.jshell.Util.expunge;
 
 /**
@@ -120,7 +118,8 @@
         this.executionControlGenerator = b.executionControlGenerator==null
                 ? failOverExecutionControlGenerator(
                         JDIDefaultExecutionControl.launch(),
-                        JDIDefaultExecutionControl.listen())
+                        JDIDefaultExecutionControl.listen("localhost"),
+                        JDIDefaultExecutionControl.listen(null))
                 : b.executionControlGenerator;
 
         this.maps = new SnippetMaps(this);
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DemultiplexInput.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DemultiplexInput.java	Fri Sep 02 02:42:03 2016 +0000
@@ -40,15 +40,14 @@
 class DemultiplexInput extends Thread {
 
     private final DataInputStream delegate;
-    private final PipeInputStream command;
     private final Map<String, OutputStream> io;
+    private final Iterable<OutputStream> closeList;
 
-    DemultiplexInput(InputStream input, PipeInputStream command,
-            Map<String, OutputStream> io) {
+    DemultiplexInput(InputStream input, Map<String, OutputStream> io, Iterable<OutputStream> closeList) {
         super("output reader");
         this.delegate = new DataInputStream(input);
-        this.command = command;
         this.io = io;
+        this.closeList = closeList;
     }
 
     @Override
@@ -65,23 +64,23 @@
                 byte[] data = new byte[dataLen];
                 DemultiplexInput.this.delegate.readFully(data);
                 String chan = new String(name, "UTF-8");
-                if (chan.equals("command")) {
-                    for (byte b : data) {
-                        command.write(Byte.toUnsignedInt(b));
-                    }
+                OutputStream out = io.get(chan);
+                if (out == null) {
+                    debug("Unexpected channel name: %s", chan);
                 } else {
-                    OutputStream out = io.get(chan);
-                    if (out == null) {
-                        debug("Unexpected channel name: %s", chan);
-                    } else {
-                        out.write(data);
-                    }
+                    out.write(data);
                 }
             }
         } catch (IOException ex) {
             debug(ex, "Failed reading output");
         } finally {
-            command.close();
+            for (OutputStream out : closeList) {
+                try {
+                    out.close();
+                } catch (IOException ex) {
+                    debug(ex, "Failed reading output");
+                }
+            }
         }
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIDefaultExecutionControl.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIDefaultExecutionControl.java	Fri Sep 02 02:42:03 2016 +0000
@@ -25,9 +25,9 @@
 package jdk.jshell.execution;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import java.net.ServerSocket;
 import java.net.Socket;
@@ -48,7 +48,7 @@
 import com.sun.jdi.VirtualMachine;
 import jdk.jshell.spi.ExecutionControl;
 import jdk.jshell.spi.ExecutionEnv;
-import static jdk.jshell.execution.Util.remoteInput;
+import static jdk.jshell.execution.Util.remoteInputOutput;
 
 /**
  * The implementation of {@link jdk.jshell.spi.ExecutionControl} that the
@@ -77,17 +77,19 @@
      * @return the generator
      */
     public static ExecutionControl.Generator launch() {
-        return env -> create(env, true);
+        return env -> create(env, true, null);
     }
 
     /**
      * Creates an ExecutionControl instance based on a JDI
      * {@code ListeningConnector}.
      *
+     * @param host explicit hostname to use, if null use discovered
+     * hostname, applies to listening only (!isLaunch)
      * @return the generator
      */
-    public static ExecutionControl.Generator listen() {
-        return env -> create(env, false);
+    public static ExecutionControl.Generator listen(String host) {
+        return env -> create(env, false, host);
     }
 
     /**
@@ -100,10 +102,15 @@
      *
      * @param env the context passed by
      * {@link jdk.jshell.spi.ExecutionControl#start(jdk.jshell.spi.ExecutionEnv) }
+     * @param isLaunch does JDI do the launch? That is, LaunchingConnector,
+     * otherwise we start explicitly and use ListeningConnector
+     * @param host explicit hostname to use, if null use discovered
+     * hostname, applies to listening only (!isLaunch)
      * @return the channel
      * @throws IOException if there are errors in set-up
      */
-    private static JDIDefaultExecutionControl create(ExecutionEnv env, boolean isLaunch) throws IOException {
+    private static ExecutionControl create(ExecutionEnv env,
+            boolean isLaunch, String host) throws IOException {
         try (final ServerSocket listener = new ServerSocket(0)) {
             // timeout after 60 seconds
             listener.setSoTimeout(60000);
@@ -111,14 +118,10 @@
 
             // Set-up the JDI connection
             JDIInitiator jdii = new JDIInitiator(port,
-                    env.extraRemoteVMOptions(), REMOTE_AGENT, isLaunch);
+                    env.extraRemoteVMOptions(), REMOTE_AGENT, isLaunch, host);
             VirtualMachine vm = jdii.vm();
             Process process = jdii.process();
 
-            // Forward input to the remote agent
-            Util.forwardInputToRemote(env.userIn(), process.getOutputStream(),
-                    ex -> debug(ex, "input forwarding failure"));
-
             List<Consumer<String>> deathListeners = new ArrayList<>();
             deathListeners.add(s -> env.closeDown());
             Util.detectJDIExitEvent(vm, s -> {
@@ -131,12 +134,13 @@
             // output.
             Socket socket = listener.accept();
             // out before in -- match remote creation so we don't hang
-            ObjectOutput cmdout = new ObjectOutputStream(socket.getOutputStream());
-            Map<String, OutputStream> io = new HashMap<>();
-            io.put("out", env.userOut());
-            io.put("err", env.userErr());
-            ObjectInput cmdin = remoteInput(socket.getInputStream(), io);
-            return new JDIDefaultExecutionControl(cmdout, cmdin, vm, process, deathListeners);
+            OutputStream out = socket.getOutputStream();
+            Map<String, OutputStream> outputs = new HashMap<>();
+            outputs.put("out", env.userOut());
+            outputs.put("err", env.userErr());
+            Map<String, InputStream> input = new HashMap<>();
+            input.put("in", env.userIn());
+            return remoteInputOutput(socket.getInputStream(), out, outputs, input, (objIn, objOut) -> new JDIDefaultExecutionControl(objOut, objIn, vm, process, deathListeners));
         }
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIInitiator.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIInitiator.java	Fri Sep 02 02:42:03 2016 +0000
@@ -56,9 +56,11 @@
      * @param remoteAgent full class name of remote agent to launch
      * @param isLaunch does JDI do the launch? That is, LaunchingConnector,
      * otherwise we start explicitly and use ListeningConnector
+     * @param host explicit hostname to use, if null use discovered
+     * hostname, applies to listening only (!isLaunch)
      */
-    public JDIInitiator(int port, List<String> remoteVMOptions,
-            String remoteAgent, boolean isLaunch) {
+    public JDIInitiator(int port, List<String> remoteVMOptions, String remoteAgent,
+            boolean isLaunch, String host) {
         this.remoteAgent = remoteAgent;
         String connectorName
                 = isLaunch
@@ -72,6 +74,9 @@
                 = isLaunch
                         ? launchArgs(port, String.join(" ", remoteVMOptions))
                         : new HashMap<>();
+        if (host != null && !isLaunch) {
+            argumentName2Value.put("localAddress", host);
+        }
         this.connectorArgs = mergeConnectorArgs(connector, argumentName2Value);
         this.vm = isLaunch
                 ? launchTarget()
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/MultiplexingOutputStream.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/MultiplexingOutputStream.java	Fri Sep 02 02:42:03 2016 +0000
@@ -50,13 +50,7 @@
 
     @Override
     public void write(int b) throws IOException {
-        synchronized (delegate) {
-            delegate.write(name.length); //assuming the len is small enough to fit into byte
-            delegate.write(name);
-            delegate.write(1);
-            delegate.write(b);
-            delegate.flush();
-        }
+        write(new byte[] {(byte) b});
     }
 
     @Override
@@ -65,10 +59,12 @@
             int i = 0;
             while (len > 0) {
                 int size = Math.min(PACKET_SIZE, len);
-                delegate.write(name.length); //assuming the len is small enough to fit into byte
-                delegate.write(name);
-                delegate.write(size);
-                delegate.write(b, off + i, size);
+                byte[] data = new byte[name.length + 1 + size + 1];
+                data[0] = (byte) name.length; //assuming the len is small enough to fit into byte
+                System.arraycopy(name, 0, data, 1, name.length);
+                data[name.length + 1] = (byte) size;
+                System.arraycopy(b, off + i, data, name.length + 2, size);
+                delegate.write(data);
                 i += size;
                 len -= size;
             }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/PipeInputStream.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/PipeInputStream.java	Fri Sep 02 02:42:03 2016 +0000
@@ -24,7 +24,9 @@
  */
 package jdk.jshell.execution;
 
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 
 /**
  *
@@ -39,7 +41,10 @@
     private boolean closed;
 
     @Override
-    public synchronized int read() {
+    public synchronized int read() throws IOException {
+        if (start == end) {
+            inputNeeded();
+        }
         while (start == end) {
             if (closed) {
                 return -1;
@@ -57,7 +62,9 @@
         }
     }
 
-    public synchronized void write(int b) {
+    protected void inputNeeded() throws IOException {}
+
+    private synchronized void write(int b) {
         if (closed) {
             throw new IllegalStateException("Already closed.");
         }
@@ -85,4 +92,22 @@
         notifyAll();
     }
 
+    public OutputStream createOutput() {
+        return new OutputStream() {
+            @Override public void write(int b) throws IOException {
+                PipeInputStream.this.write(b);
+            }
+            @Override
+            public void write(byte[] b, int off, int len) throws IOException {
+                for (int i = 0 ; i < len ; i++) {
+                    write(Byte.toUnsignedInt(b[off + i]));
+                }
+            }
+            @Override
+            public void close() throws IOException {
+                PipeInputStream.this.close();
+            }
+        };
+    }
+
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java	Fri Sep 02 02:42:03 2016 +0000
@@ -61,10 +61,12 @@
         Socket socket = new Socket(loopBack, Integer.parseInt(args[0]));
         InputStream inStream = socket.getInputStream();
         OutputStream outStream = socket.getOutputStream();
-        Map<String, Consumer<OutputStream>> chans = new HashMap<>();
-        chans.put("out", st -> System.setOut(new PrintStream(st, true)));
-        chans.put("err", st -> System.setErr(new PrintStream(st, true)));
-        forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, chans);
+        Map<String, Consumer<OutputStream>> outputs = new HashMap<>();
+        outputs.put("out", st -> System.setOut(new PrintStream(st, true)));
+        outputs.put("err", st -> System.setErr(new PrintStream(st, true)));
+        Map<String, Consumer<InputStream>> input = new HashMap<>();
+        input.put("in", st -> System.setIn(st));
+        forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input);
     }
 
     // These three variables are used by the main JShell process in interrupting
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java	Fri Sep 02 02:42:03 2016 +0000
@@ -25,6 +25,7 @@
 package jdk.jshell.execution;
 
 import jdk.jshell.spi.ExecutionEnv;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInput;
@@ -32,9 +33,13 @@
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.function.BiFunction;
 import java.util.function.Consumer;
+
 import com.sun.jdi.VirtualMachine;
 import jdk.jshell.spi.ExecutionControl;
 
@@ -99,21 +104,40 @@
      * instance, then responses back on the output.
      * @param ec the direct instance of {@link ExecutionControl} to process commands
      * @param inStream the stream from which to create the command input
-     * @param outStream the stream that will carry {@code System.out},
-     * {@code System.err}, any specified auxiliary channels, and the
-     * command response output.
-     * @param streamMap a map between names of additional streams to carry and setters
-     * for the stream
+     * @param outStream the stream that will carry any specified auxiliary channels (like
+     *                  {@code System.out} and {@code System.err}), and the command response output.
+     * @param outputStreamMap a map between names of additional streams to carry and setters
+     *                        for the stream. Names starting with '$' are reserved for internal use.
+     * @param inputStreamMap a map between names of additional streams to carry and setters
+     *                       for the stream. Names starting with '$' are reserved for internal use.
      * @throws IOException if there are errors using the passed streams
      */
     public static void forwardExecutionControlAndIO(ExecutionControl ec,
             InputStream inStream, OutputStream outStream,
-            Map<String, Consumer<OutputStream>> streamMap) throws IOException {
-        ObjectInputStream cmdIn = new ObjectInputStream(inStream);
-        for (Entry<String, Consumer<OutputStream>> e : streamMap.entrySet()) {
+            Map<String, Consumer<OutputStream>> outputStreamMap,
+            Map<String, Consumer<InputStream>> inputStreamMap) throws IOException {
+        for (Entry<String, Consumer<OutputStream>> e : outputStreamMap.entrySet()) {
             e.getValue().accept(multiplexingOutputStream(e.getKey(), outStream));
         }
-        ObjectOutputStream cmdOut = new ObjectOutputStream(multiplexingOutputStream("command", outStream));
+
+        ObjectOutputStream cmdOut = new ObjectOutputStream(multiplexingOutputStream("$command", outStream));
+        PipeInputStream cmdInPipe = new PipeInputStream();
+        Map<String, OutputStream> inputs = new HashMap<>();
+        inputs.put("$command", cmdInPipe.createOutput());
+        for (Entry<String, Consumer<InputStream>> e : inputStreamMap.entrySet()) {
+            OutputStream inputSignal = multiplexingOutputStream("$" + e.getKey() + "-input-requested", outStream);
+            PipeInputStream inputPipe = new PipeInputStream() {
+                @Override protected void inputNeeded() throws IOException {
+                    inputSignal.write('1');
+                    inputSignal.flush();
+                }
+            };
+            inputs.put(e.getKey(), inputPipe.createOutput());
+            e.getValue().accept(inputPipe);
+        }
+        new DemultiplexInput(inStream, inputs, inputs.values()).start();
+        ObjectInputStream cmdIn = new ObjectInputStream(cmdInPipe);
+
         forwardExecutionControl(ec, cmdIn, cmdOut);
     }
 
@@ -122,18 +146,41 @@
     }
 
     /**
-     * Reads from an InputStream which has been packetized and write its contents
-     * to the out and err OutputStreams; Copies the command stream.
+     * Creates an ExecutionControl for given packetized input and output. The given InputStream
+     * is de-packetized, and content forwarded to ObjectInput and given OutputStreams. The ObjectOutput
+     * and values read from the given InputStream are packetized and sent to the given OutputStream.
+     *
      * @param input the packetized input stream
-     * @param streamMap a map between stream names and the output streams to forward
-     * @return the command stream
+     * @param output the packetized output stream
+     * @param outputStreamMap a map between stream names and the output streams to forward.
+     *                        Names starting with '$' are reserved for internal use.
+     * @param inputStreamMap a map between stream names and the input streams to forward.
+     *                       Names starting with '$' are reserved for internal use.
+     * @param factory to create the ExecutionControl from ObjectInput and ObjectOutput.
+     * @return the created ExecutionControl
      * @throws IOException if setting up the streams raised an exception
      */
-    public static ObjectInput remoteInput(InputStream input,
-            Map<String, OutputStream> streamMap) throws IOException {
+    public static ExecutionControl remoteInputOutput(InputStream input, OutputStream output,
+            Map<String, OutputStream> outputStreamMap, Map<String, InputStream> inputStreamMap,
+            BiFunction<ObjectInput, ObjectOutput, ExecutionControl> factory) throws IOException {
+        Map<String, OutputStream> augmentedStreamMap = new HashMap<>(outputStreamMap);
+        ObjectOutput commandOut = new ObjectOutputStream(Util.multiplexingOutputStream("$command", output));
+        for (Entry<String, InputStream> e : inputStreamMap.entrySet()) {
+            InputStream  in = e.getValue();
+            OutputStream inTarget = Util.multiplexingOutputStream(e.getKey(), output);
+            augmentedStreamMap.put("$" + e.getKey() + "-input-requested", new OutputStream() {
+                @Override
+                public void write(int b) throws IOException {
+                    //value ignored, just a trigger to read from the input
+                    inTarget.write(in.read());
+                }
+            });
+        }
         PipeInputStream commandIn = new PipeInputStream();
-        new DemultiplexInput(input, commandIn, streamMap).start();
-        return new ObjectInputStream(commandIn);
+        OutputStream commandInTarget = commandIn.createOutput();
+        augmentedStreamMap.put("$command", commandInTarget);
+        new DemultiplexInput(input, augmentedStreamMap, Arrays.asList(commandInTarget)).start();
+        return factory.apply(new ObjectInputStream(commandIn), commandOut);
     }
 
     /**
@@ -151,32 +198,4 @@
         }
     }
 
-    /**
-     * Creates a Thread that will ship all input to the remote agent.
-     *
-     * @param inputStream the user input
-     * @param outStream the input to the remote agent
-     * @param handler a failure handler
-     */
-    public static void forwardInputToRemote(final InputStream inputStream,
-            final OutputStream outStream, final Consumer<Exception> handler) {
-        Thread thr = new Thread("input reader") {
-            @Override
-            public void run() {
-                try {
-                    byte[] buf = new byte[256];
-                    int cnt;
-                    while ((cnt = inputStream.read(buf)) != -1) {
-                        outStream.write(buf, 0, cnt);
-                        outStream.flush();
-                    }
-                } catch (Exception ex) {
-                    handler.accept(ex);
-                }
-            }
-        };
-        thr.setPriority(Thread.MAX_PRIORITY - 1);
-        thr.start();
-    }
-
 }
--- a/langtools/test/ProblemList.txt	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/ProblemList.txt	Fri Sep 02 02:42:03 2016 +0000
@@ -77,10 +77,3 @@
 ###########################################################################
 #
 # jdeps 
-
-###########################################################################
-#
-# jdeprscan
-
-tools/jdeprscan/tests/jdk/jdeprscan/TestLoad.java                               8164837    windows-all    probably line breaks or encoding
-tools/jdeprscan/tests/jdk/jdeprscan/TestScan.java                               8164837    windows-all    probably line breaks or encoding
--- a/langtools/test/jdk/javadoc/tool/ReleaseOption.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/javadoc/tool/ReleaseOption.java	Fri Sep 02 02:42:03 2016 +0000
@@ -33,7 +33,7 @@
 /**
  * @test
  * @bug 8086737
- * @summary Test -release option in javadoc
+ * @summary Test --release option in javadoc
  * @run main ReleaseOption
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  */
@@ -43,10 +43,10 @@
     }
 
     void run() {
-        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "7");
-        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "8");
-        doRunTest(1, out -> true, "-release", "7", "-source", "7");
-        doRunTest(1, out -> true, "-release", "7", "-bootclasspath", "any");
+        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "7");
+        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "8");
+        doRunTest(1, out -> true, "--release", "7", "-source", "7");
+        doRunTest(1, out -> true, "--release", "7", "-bootclasspath", "any");
     }
 
     void doRunTest(int expectedResult, Predicate<String> validate, String... args) {
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8144095
+ * @bug 8144095 8164825
  * @summary Test Command Completion
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -40,6 +40,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.function.Predicate;
@@ -148,6 +149,80 @@
         assertCompletion("/classpath ~/|", false, completions.toArray(new String[completions.size()]));
     }
 
+    public void testSet() throws IOException {
+        List<String> p1 = listFiles(Paths.get(""));
+        FileSystems.getDefault().getRootDirectories().forEach(s -> p1.add(s.toString()));
+        Collections.sort(p1);
+
+        String[] modes = {"concise ", "normal ", "silent ", "verbose "};
+        String[] options = {"-command", "-delete", "-quiet"};
+        String[] modesWithOptions = Stream.concat(Arrays.stream(options), Arrays.stream(modes)).sorted().toArray(String[]::new);
+        test(false, new String[] {"--no-startup"},
+                a -> assertCompletion(a, "/se|", false, "/set "),
+                a -> assertCompletion(a, "/set |", false, "editor ", "feedback ", "format ", "mode ", "prompt ", "start ", "truncation "),
+
+                // /set editor
+                a -> assertCompletion(a, "/set e|", false, "editor "),
+                a -> assertCompletion(a, "/set editor |", false, p1.toArray(new String[p1.size()])),
+
+                // /set feedback
+                a -> assertCompletion(a, "/set fe|", false, "feedback "),
+                a -> assertCompletion(a, "/set fe |", false, modes),
+
+                // /set format
+                a -> assertCompletion(a, "/set fo|", false, "format "),
+                a -> assertCompletion(a, "/set fo |", false, modes),
+
+                // /set mode
+                a -> assertCompletion(a, "/set mo|", false, "mode "),
+                a -> assertCompletion(a, "/set mo |", false),
+                a -> assertCompletion(a, "/set mo newmode |", false, modesWithOptions),
+                a -> assertCompletion(a, "/set mo newmode -|", false, options),
+                a -> assertCompletion(a, "/set mo newmode -command |", false),
+                a -> assertCompletion(a, "/set mo newmode normal |", false, options),
+
+                // /set prompt
+                a -> assertCompletion(a, "/set pro|", false, "prompt "),
+                a -> assertCompletion(a, "/set pro |", false, modes),
+
+                // /set start
+                a -> assertCompletion(a, "/set st|", false, "start "),
+                a -> assertCompletion(a, "/set st |", false, p1.toArray(new String[p1.size()])),
+
+                // /set truncation
+                a -> assertCompletion(a, "/set tr|", false, "truncation "),
+                a -> assertCompletion(a, "/set tr |", false, modes)
+        );
+    }
+
+    public void testRetain() throws IOException {
+        List<String> p1 = listFiles(Paths.get(""));
+        FileSystems.getDefault().getRootDirectories().forEach(s -> p1.add(s.toString()));
+        Collections.sort(p1);
+
+        String[] modes = {"concise ", "normal ", "silent ", "verbose "};
+        test(false, new String[] {"--no-startup"},
+                a -> assertCompletion(a, "/ret|", false, "/retain "),
+                a -> assertCompletion(a, "/retain |", false, "editor ", "feedback ", "mode ", "start "),
+
+                // /retain editor
+                a -> assertCompletion(a, "/retain e|", false, "editor "),
+                a -> assertCompletion(a, "/retain editor |", false, p1.toArray(new String[p1.size()])),
+
+                // /retain feedback
+                a -> assertCompletion(a, "/retain fe|", false, "feedback "),
+                a -> assertCompletion(a, "/retain fe |", false, modes),
+
+                // /retain mode
+                a -> assertCompletion(a, "/retain mo|", false, "mode "),
+                a -> assertCompletion(a, "/retain mo |", false, modes),
+
+                // /retain start
+                a -> assertCompletion(a, "/retain st|", false, "start "),
+                a -> assertCompletion(a, "/retain st |", false, p1.toArray(new String[p1.size()]))
+        );
+    }
+
     private void createIfNeeded(Path file) throws IOException {
         if (!Files.exists(file))
             Files.createFile(file);
--- a/langtools/test/jdk/jshell/CompletenessTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/CompletenessTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8149524 8131024
+ * @bug 8149524 8131024 8165211 8080071 8130454
  * @summary Test SourceCodeAnalysis
  * @build KullaTesting TestingInputStream
  * @run testng CompletenessTest
@@ -63,6 +63,7 @@
         "foo: while (true) { printf(\"Innn\"); break foo; }",
         "class Case<E1 extends Enum<E1>, E2 extends Enum<E2>, E3 extends Enum<E3>> {}",
         ";",
+        "enum Tt { FOO, BAR, BAZ,; }"
     };
 
     static final String[] expression = new String[] {
@@ -77,6 +78,8 @@
         "new int[] {1, 2,3}",
         "new Foo() {}",
         "i >= 0 && Character.isWhitespace(s.charAt(i))",
+        "int.class",
+        "String.class",
     };
 
     static final String[] complete_with_semi = new String[] {
@@ -113,6 +116,7 @@
         "BufferedReader br = new BufferedReader(new FileReader(path))",
         "bar: g()",
         "baz: while (true) if (t()) printf('-'); else break baz",
+        "java.util.function.IntFunction<int[]> ggg = int[]::new",
     };
 
     static final String[] considered_incomplete = new String[] {
@@ -141,6 +145,8 @@
         "if (match.kind == BRACES && (prevCT.kind == ARROW || prevCT.kind == NEW_MIDDLE)) {",
         "if (match.kind == BRACES && (prevCT.kind == ARROW || prevCT.kind == NEW_MIDDLE)) { new CT(UNMATCHED, current, \"Unmatched \" + unmatched);",
         "x +",
+        "x *",
+        "3 *",
         "int",
         "for (int i = 0; i < lines.length(); ++i) {",
         "new",
@@ -156,6 +162,7 @@
         "enum TK { EOF(TokenKind.EOF, 0),",
         "enum TK { EOF(TokenKind.EOF, 0), NEW_MIDDLE(XEXPR1|XTERM)",
         "enum TK { EOF(TokenKind.EOF, 0), NEW_MIDDLE(XEXPR1|XTERM); ",
+        "enum Tt { FOO, BAR, BAZ,;"
     };
 
     static final String[] unknown = new String[] {
--- a/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -419,9 +419,9 @@
     public void testUncompletedDeclaration() {
         assertCompletion("class Clazz { Claz|", "Clazz");
         assertCompletion("class Clazz { class A extends Claz|", "Clazz");
-        assertCompletion("class Clazz { Clazz clazz; Object o = cla|", "clazz");
-        assertCompletion("class Clazz { static Clazz clazz; Object o = cla|", "clazz");
-        assertCompletion("class Clazz { Clazz clazz; static Object o = cla|", true);
+        assertCompletion("class Clazz { Clazz clazz; Object o = claz|", "clazz");
+        assertCompletion("class Clazz { static Clazz clazz; Object o = claz|", "clazz");
+        assertCompletion("class Clazz { Clazz clazz; static Object o = claz|", true);
         assertCompletion("class Clazz { void method(Claz|", "Clazz");
         assertCompletion("class A { int method() { return 0; } int a = meth|", "method()");
         assertCompletion("class A { int field = 0; int method() { return fiel|", "field");
--- a/langtools/test/jdk/jshell/IdGeneratorTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/IdGeneratorTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -99,19 +99,18 @@
         }
     }
 
-    @Test(enabled = false) // TODO 8133507
     public void testIdInException() {
         JShell.Builder builder = getBuilder().idGenerator(((snippet, id) -> "custom" + id));
         try (JShell jShell = builder.build()) {
             EvalException evalException = (EvalException) jShell.eval("throw new Error();").get(0).exception();
             for (StackTraceElement ste : evalException.getStackTrace()) {
-                assertTrue(ste.getFileName().startsWith("custom"), "Not started with \"custom\": "
+                assertTrue(ste.getFileName().startsWith("#custom"), "Not started with \"#custom\": "
                         + ste.getFileName());
             }
             jShell.eval("void f() { g(); }");
             UnresolvedReferenceException unresolvedException = (UnresolvedReferenceException) jShell.eval("f();").get(0).exception();
             for (StackTraceElement ste : unresolvedException.getStackTrace()) {
-                assertTrue(ste.getFileName().startsWith("custom"), "Not started with \"custom\": "
+                assertTrue(ste.getFileName().startsWith("#custom"), "Not started with \"#custom\": "
                         + ste.getFileName());
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/JDILaunchingExecutionControlTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8164518
+ * @summary Tests for standard JDI connector (without failover) -- launching
+ * @modules jdk.jshell/jdk.jshell.execution
+ * @build KullaTesting ExecutionControlTestBase
+ * @run testng JDILaunchingExecutionControlTest
+ */
+
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import jdk.jshell.execution.JDIDefaultExecutionControl;
+
+@Test
+public class JDILaunchingExecutionControlTest extends ExecutionControlTestBase {
+
+    @BeforeMethod
+    @Override
+    public void setUp() {
+        setUp(builder -> builder.executionEngine(JDIDefaultExecutionControl.launch()));
+    }
+}
--- a/langtools/test/jdk/jshell/JDIListeningExecutionControlTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/JDIListeningExecutionControlTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8131029 8159935 8160127
+ * @bug 8131029 8159935 8160127 8164518
  * @summary Tests for alternate JDI connector -- listening
  * @modules jdk.jshell/jdk.jshell.execution
  * @build KullaTesting ExecutionControlTestBase
@@ -41,6 +41,6 @@
     @BeforeMethod
     @Override
     public void setUp() {
-        setUp(builder -> builder.executionEngine(JDIDefaultExecutionControl.listen()));
+        setUp(builder -> builder.executionEngine(JDIDefaultExecutionControl.listen(null)));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/JDIListeningLocalhostExecutionControlTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8164518
+ * @summary Tests for alternate JDI connector -- listening to "localhost"
+ * @modules jdk.jshell/jdk.jshell.execution
+ * @build KullaTesting ExecutionControlTestBase
+ * @run testng JDIListeningLocalhostExecutionControlTest
+ */
+
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import jdk.jshell.execution.JDIDefaultExecutionControl;
+
+@Test
+public class JDIListeningLocalhostExecutionControlTest extends ExecutionControlTestBase {
+
+    @BeforeMethod
+    @Override
+    public void setUp() {
+        setUp(builder -> builder.executionEngine(JDIDefaultExecutionControl.listen("localhost")));
+    }
+}
--- a/langtools/test/jdk/jshell/ReplToolTesting.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/ReplToolTesting.java	Fri Sep 02 02:42:03 2016 +0000
@@ -247,7 +247,6 @@
                 new PrintStream(cmdout),
                 new PrintStream(cmderr),
                 new PrintStream(console),
-                userin,
                 new PrintStream(userout),
                 new PrintStream(usererr),
                 prefs,
@@ -463,7 +462,7 @@
 
     private List<String> computeCompletions(String code, boolean isSmart) {
         JShellTool js = this.repl != null ? this.repl
-                                      : new JShellTool(null, null, null, null, null, null, null, prefs, Locale.ROOT);
+                                      : new JShellTool(null, null, null, null, null, null, prefs, Locale.ROOT);
         int cursor =  code.indexOf('|');
         code = code.replace("|", "");
         assertTrue(cursor > -1, "'|' not found: " + code);
--- a/langtools/test/jdk/jshell/StartOptionTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/StartOptionTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -63,7 +63,6 @@
                 new PrintStream(cmdout),
                 new PrintStream(cmderr),
                 new PrintStream(console),
-                new TestingInputStream(),
                 new PrintStream(userout),
                 new PrintStream(usererr),
                 new ReplToolTesting.MemoryPreferences(),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/UserInputTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8131023
+ * @summary Verify that the user's code can read System.in
+ * @build KullaTesting TestingInputStream
+ * @run testng UserInputTest
+ */
+
+import org.testng.annotations.Test;
+
+@Test
+public class UserInputTest extends KullaTesting {
+
+    public void testReadInput() {
+        setInput("AB\n");
+        assertEval("System.in.read()", "65");
+        setInput("BC\n");
+        assertEval("System.in.read()", "66");
+    }
+
+}
--- a/langtools/test/jdk/jshell/UserJDIUserRemoteTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/jdk/jshell/UserJDIUserRemoteTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -37,7 +37,6 @@
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
 import java.net.ServerSocket;
 import java.util.ArrayList;
 import java.util.List;
@@ -62,7 +61,7 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 import static jdk.jshell.execution.Util.forwardExecutionControlAndIO;
-import static jdk.jshell.execution.Util.remoteInput;
+import static jdk.jshell.execution.Util.remoteInputOutput;
 
 @Test
 public class UserJDIUserRemoteTest extends ExecutionControlTestBase {
@@ -146,7 +145,7 @@
      * @return the channel
      * @throws IOException if there are errors in set-up
      */
-    static MyExecutionControl make(ExecutionEnv env, UserJDIUserRemoteTest test) throws IOException {
+    static ExecutionControl make(ExecutionEnv env, UserJDIUserRemoteTest test) throws IOException {
         try (final ServerSocket listener = new ServerSocket(0)) {
             // timeout after 60 seconds
             listener.setSoTimeout(60000);
@@ -159,7 +158,7 @@
                     + System.getProperty("path.separator")
                     + System.getProperty("user.dir"));
             JDIInitiator jdii = new JDIInitiator(port,
-                    opts, REMOTE_AGENT, true);
+                    opts, REMOTE_AGENT, true, null);
             VirtualMachine vm = jdii.vm();
             Process process = jdii.process();
 
@@ -175,13 +174,14 @@
             // output.
             Socket socket = listener.accept();
             // out before in -- match remote creation so we don't hang
-            ObjectOutput cmdout = new ObjectOutputStream(socket.getOutputStream());
-            Map<String, OutputStream> io = new HashMap<>();
-            io.put("out", env.userOut());
-            io.put("err", env.userErr());
-            io.put("aux", test.auxStream);
-            ObjectInput cmdin = remoteInput(socket.getInputStream(), io);
-            MyExecutionControl myec = new MyExecutionControl(cmdout, cmdin, vm, process, deathListeners);
+            OutputStream out = socket.getOutputStream();
+            Map<String, OutputStream> outputs = new HashMap<>();
+            outputs.put("out", env.userOut());
+            outputs.put("err", env.userErr());
+            outputs.put("aux", test.auxStream);
+            Map<String, InputStream> input = new HashMap<>();
+            input.put("in", env.userIn());
+            ExecutionControl myec = remoteInputOutput(socket.getInputStream(), out, outputs, input, (objIn, objOut) -> new MyExecutionControl(objOut, objIn, vm, process, deathListeners));
             test.currentEC = myec;
             return myec;
         }
@@ -255,11 +255,13 @@
             Socket socket = new Socket(loopBack, Integer.parseInt(args[0]));
             InputStream inStream = socket.getInputStream();
             OutputStream outStream = socket.getOutputStream();
-            Map<String, Consumer<OutputStream>> chans = new HashMap<>();
-            chans.put("out", st -> System.setOut(new PrintStream(st, true)));
-            chans.put("err", st -> System.setErr(new PrintStream(st, true)));
-            chans.put("aux", st -> { auxPrint = new PrintStream(st, true); });
-            forwardExecutionControlAndIO(new MyRemoteExecutionControl(), inStream, outStream, chans);
+            Map<String, Consumer<OutputStream>> outputs = new HashMap<>();
+            outputs.put("out", st -> System.setOut(new PrintStream(st, true)));
+            outputs.put("err", st -> System.setErr(new PrintStream(st, true)));
+            outputs.put("aux", st -> { auxPrint = new PrintStream(st, true); });
+            Map<String, Consumer<InputStream>> input = new HashMap<>();
+            input.put("in", st -> System.setIn(st));
+            forwardExecutionControlAndIO(new MyRemoteExecutionControl(), inStream, outStream, outputs, input);
         } catch (Throwable ex) {
             throw ex;
         }
--- a/langtools/test/tools/javac/T4994049/DeprecatedYES.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/T4994049/DeprecatedYES.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,4 +1,5 @@
-DeprecatedYES.java:18:10: compiler.warn.has.been.deprecated: foo(), A
+DeprecatedYES.java:12:10: compiler.warn.missing.deprecated.annotation
 - compiler.err.warnings.and.werror
+DeprecatedYES.java:18:10: compiler.warn.has.been.deprecated: foo(), A
 1 error
-1 warning
+2 warnings
--- a/langtools/test/tools/javac/T8139474/DashRelease7DashVerboseTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/T8139474/DashRelease7DashVerboseTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -24,8 +24,8 @@
 /*
  * @test
  * bug 8139474
- * @summary -release 7 -verbose causes Javac exception
- * @compile -release 7 -verbose DashRelease7DashVerboseTest.java
+ * @summary --release 7 -verbose causes Javac exception
+ * @compile --release 7 -verbose DashRelease7DashVerboseTest.java
 */
 
 public class DashRelease7DashVerboseTest {}
--- a/langtools/test/tools/javac/danglingDep/DepX.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/danglingDep/DepX.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,2 +1,4 @@
+DepX.java:38:1: compiler.warn.missing.deprecated.annotation
 - compiler.note.deprecated.filename: RefX.java
 - compiler.note.deprecated.recompile
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/depDocComment/SuppressDepAnnWithSwitchTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8164073
+ * @summary Verify that -Xlint:-dep-ann suppresses warnings.
+ * @compile -Xlint:-dep-ann -Werror SuppressDepAnnWithSwitchTest.java
+ */
+
+public class SuppressDepAnnWithSwitchTest {
+    /** @deprecated */
+    int f;
+}
--- a/langtools/test/tools/javac/depDocComment/SuppressDeprecation.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depDocComment/SuppressDeprecation.java	Fri Sep 02 02:42:03 2016 +0000
@@ -1,10 +1,11 @@
 /**
  * @test  /nodynamiccopyright/
- * @bug 4216683 4346296 4656556 4785453
+ * @bug 4216683 4346296 4656556 4785453 8164073
  * @summary New rules for when deprecation messages are suppressed
  * @author gafter
  *
  * @compile/ref=SuppressDeprecation.out -Xlint:deprecation -XDrawDiagnostics SuppressDeprecation.java
+ * @compile/ref=SuppressDeprecation8.out -source 8 -Xlint:deprecation -XDrawDiagnostics SuppressDeprecation.java
  */
 
 /* Test for the contexts in which deprecations warnings should
--- a/langtools/test/tools/javac/depDocComment/SuppressDeprecation.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depDocComment/SuppressDeprecation.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,8 +1,20 @@
-SuppressDeprecation.java:82:10: compiler.warn.has.been.deprecated: g(), T
-SuppressDeprecation.java:83:14: compiler.warn.has.been.deprecated: g(), T
-SuppressDeprecation.java:84:9: compiler.warn.has.been.deprecated: var, T
-SuppressDeprecation.java:87:9: compiler.warn.has.been.deprecated: T(), T
-SuppressDeprecation.java:90:9: compiler.warn.has.been.deprecated: T(int), T
-SuppressDeprecation.java:98:1: compiler.warn.has.been.deprecated: T(), T
-SuppressDeprecation.java:130:17: compiler.warn.has.been.deprecated: X, compiler.misc.unnamed.package
-7 warnings
+SuppressDeprecation.java:29:9: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:33:10: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:38:10: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:48:5: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:53:5: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:67:10: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:74:9: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:80:10: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:83:10: compiler.warn.has.been.deprecated: g(), T
+SuppressDeprecation.java:84:14: compiler.warn.has.been.deprecated: g(), T
+SuppressDeprecation.java:85:9: compiler.warn.has.been.deprecated: var, T
+SuppressDeprecation.java:88:9: compiler.warn.has.been.deprecated: T(), T
+SuppressDeprecation.java:91:9: compiler.warn.has.been.deprecated: T(int), T
+SuppressDeprecation.java:99:1: compiler.warn.has.been.deprecated: T(), T
+SuppressDeprecation.java:124:9: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:103:1: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:129:1: compiler.warn.missing.deprecated.annotation
+SuppressDeprecation.java:131:17: compiler.warn.has.been.deprecated: X, compiler.misc.unnamed.package
+SuppressDeprecation.java:135:1: compiler.warn.missing.deprecated.annotation
+19 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/depDocComment/SuppressDeprecation8.out	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,9 @@
+- compiler.warn.source.no.bootclasspath: 1.8
+SuppressDeprecation.java:83:10: compiler.warn.has.been.deprecated: g(), T
+SuppressDeprecation.java:84:14: compiler.warn.has.been.deprecated: g(), T
+SuppressDeprecation.java:85:9: compiler.warn.has.been.deprecated: var, T
+SuppressDeprecation.java:88:9: compiler.warn.has.been.deprecated: T(), T
+SuppressDeprecation.java:91:9: compiler.warn.has.been.deprecated: T(int), T
+SuppressDeprecation.java:99:1: compiler.warn.has.been.deprecated: T(), T
+SuppressDeprecation.java:131:17: compiler.warn.has.been.deprecated: X, compiler.misc.unnamed.package
+8 warnings
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test1.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test1.java	Fri Sep 02 02:42:03 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -26,11 +26,11 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=empty    -XDrawDiagnostics -Xlint:deprecation I.java
+ * @compile/ref=Test1I.out   -XDrawDiagnostics -Xlint:deprecation I.java
  * @compile/ref=Test1A.out  -XDrawDiagnostics -Xlint:deprecation A.java
  * @compile/ref=Test1B.out  -XDrawDiagnostics -Xlint:deprecation B.java
  * @compile/ref=Test1B2.out -XDrawDiagnostics -Xlint:deprecation B2.java
- * @compile/ref=empty    -XDrawDiagnostics -Xlint:deprecation B3.java
+ * @compile/ref=Test1B3.out    -XDrawDiagnostics -Xlint:deprecation B3.java
  * @compile/ref=empty    -XDrawDiagnostics -Xlint:deprecation Test1.java
  */
 
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test1A.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test1A.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,4 +1,10 @@
 A.java:13:36: compiler.warn.has.been.deprecated: iDep_aUnd_bInh(), I
 A.java:12:36: compiler.warn.has.been.deprecated: iDep_aUnd_bUnd(), I
 A.java:11:36: compiler.warn.has.been.deprecated: iDep_aUnd_bDep(), I
-3 warnings
+A.java:8:36: compiler.warn.missing.deprecated.annotation
+A.java:9:36: compiler.warn.missing.deprecated.annotation
+A.java:10:36: compiler.warn.missing.deprecated.annotation
+A.java:17:36: compiler.warn.missing.deprecated.annotation
+A.java:18:36: compiler.warn.missing.deprecated.annotation
+A.java:19:36: compiler.warn.missing.deprecated.annotation
+9 warnings
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test1B.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test1B.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,4 +1,10 @@
 B.java:15:36: compiler.warn.has.been.deprecated: iDep_aInh_bUnd(), I
+B.java:8:36: compiler.warn.missing.deprecated.annotation
 B.java:9:36: compiler.warn.has.been.deprecated: iDep_aDep_bUnd(), A
+B.java:11:36: compiler.warn.missing.deprecated.annotation
+B.java:14:36: compiler.warn.missing.deprecated.annotation
+B.java:17:36: compiler.warn.missing.deprecated.annotation
 B.java:18:36: compiler.warn.has.been.deprecated: iUnd_aDep_bUnd(), A
-3 warnings
+B.java:20:36: compiler.warn.missing.deprecated.annotation
+B.java:23:36: compiler.warn.missing.deprecated.annotation
+9 warnings
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test1B2.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test1B2.out	Fri Sep 02 02:42:03 2016 +0000
@@ -2,6 +2,12 @@
 B2.java:7:10: compiler.warn.has.been.deprecated: iDep_aUnd_bInh(), I
 B2.java:12:36: compiler.warn.has.been.deprecated: iDep_aUnd_bUnd(), I
 B2.java:9:36: compiler.warn.has.been.deprecated: iDep_aDep_bUnd(), I
+B2.java:8:36: compiler.warn.missing.deprecated.annotation
 B2.java:9:36: compiler.warn.has.been.deprecated: iDep_aDep_bUnd(), A
+B2.java:11:36: compiler.warn.missing.deprecated.annotation
+B2.java:14:36: compiler.warn.missing.deprecated.annotation
+B2.java:17:36: compiler.warn.missing.deprecated.annotation
 B2.java:18:36: compiler.warn.has.been.deprecated: iUnd_aDep_bUnd(), A
-6 warnings
+B2.java:20:36: compiler.warn.missing.deprecated.annotation
+B2.java:23:36: compiler.warn.missing.deprecated.annotation
+12 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test1B3.out	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,8 @@
+B3.java:32:36: compiler.warn.missing.deprecated.annotation
+B3.java:35:36: compiler.warn.missing.deprecated.annotation
+B3.java:38:36: compiler.warn.missing.deprecated.annotation
+B3.java:41:36: compiler.warn.missing.deprecated.annotation
+B3.java:44:36: compiler.warn.missing.deprecated.annotation
+B3.java:47:36: compiler.warn.missing.deprecated.annotation
+B3.java:31:10: compiler.warn.missing.deprecated.annotation
+7 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test1I.out	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,9 @@
+I.java:30:36: compiler.warn.missing.deprecated.annotation
+I.java:31:36: compiler.warn.missing.deprecated.annotation
+I.java:32:36: compiler.warn.missing.deprecated.annotation
+I.java:33:36: compiler.warn.missing.deprecated.annotation
+I.java:34:36: compiler.warn.missing.deprecated.annotation
+I.java:35:36: compiler.warn.missing.deprecated.annotation
+I.java:36:36: compiler.warn.missing.deprecated.annotation
+I.java:37:36: compiler.warn.missing.deprecated.annotation
+8 warnings
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test2.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test2.java	Fri Sep 02 02:42:03 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -26,7 +26,7 @@
  * @bug 5086088
  * @summary check warnings generated when overriding deprecated methods
  *
- * @compile/ref=empty   -XDrawDiagnostics -Xlint:deprecation P.java
+ * @compile/ref=Test2P.out -XDrawDiagnostics -Xlint:deprecation P.java
  * @compile/ref=Test2Q.out -XDrawDiagnostics -Xlint:deprecation Q.java
  * @compile/ref=Test2R.out -XDrawDiagnostics -Xlint:deprecation R.java
  * @compile/ref=empty   -XDrawDiagnostics -Xlint:deprecation Test2.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test2P.out	Fri Sep 02 02:42:03 2016 +0000
@@ -0,0 +1,10 @@
+P.java:30:36: compiler.warn.missing.deprecated.annotation
+P.java:31:36: compiler.warn.missing.deprecated.annotation
+P.java:32:36: compiler.warn.missing.deprecated.annotation
+P.java:33:36: compiler.warn.missing.deprecated.annotation
+P.java:34:36: compiler.warn.missing.deprecated.annotation
+P.java:35:36: compiler.warn.missing.deprecated.annotation
+P.java:36:36: compiler.warn.missing.deprecated.annotation
+P.java:37:36: compiler.warn.missing.deprecated.annotation
+P.java:38:36: compiler.warn.missing.deprecated.annotation
+9 warnings
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test2Q.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test2Q.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,4 +1,10 @@
+Q.java:8:36: compiler.warn.missing.deprecated.annotation
+Q.java:9:36: compiler.warn.missing.deprecated.annotation
+Q.java:10:36: compiler.warn.missing.deprecated.annotation
 Q.java:11:36: compiler.warn.has.been.deprecated: pDep_qUnd_rDep(), P
 Q.java:12:36: compiler.warn.has.been.deprecated: pDep_qUnd_rUnd(), P
 Q.java:13:36: compiler.warn.has.been.deprecated: pDep_qUnd_rInh(), P
-3 warnings
+Q.java:17:36: compiler.warn.missing.deprecated.annotation
+Q.java:18:36: compiler.warn.missing.deprecated.annotation
+Q.java:19:36: compiler.warn.missing.deprecated.annotation
+9 warnings
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test2R.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test2R.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,4 +1,10 @@
+R.java:8:36: compiler.warn.missing.deprecated.annotation
 R.java:9:36: compiler.warn.has.been.deprecated: pDep_qDep_rUnd(), Q
+R.java:11:36: compiler.warn.missing.deprecated.annotation
+R.java:14:36: compiler.warn.missing.deprecated.annotation
 R.java:15:36: compiler.warn.has.been.deprecated: pDep_qInh_rUnd(), P
+R.java:17:36: compiler.warn.missing.deprecated.annotation
 R.java:18:36: compiler.warn.has.been.deprecated: pUnd_qDep_rUnd(), Q
-3 warnings
+R.java:20:36: compiler.warn.missing.deprecated.annotation
+R.java:23:36: compiler.warn.missing.deprecated.annotation
+9 warnings
--- a/langtools/test/tools/javac/depOverrides/doccomment/Test3.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/depOverrides/doccomment/Test3.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,2 +1,3 @@
+Test3.java:11:14: compiler.warn.missing.deprecated.annotation
 Test3.java:18:1: compiler.warn.has.been.deprecated: m(), LibInterface
-1 warning
+2 warnings
--- a/langtools/test/tools/javac/diags/examples/ProcessorPathNoProcessorModulePath/ProcessorPathNoProcessorModulePath.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/diags/examples/ProcessorPathNoProcessorModulePath/ProcessorPathNoProcessorModulePath.java	Fri Sep 02 02:42:03 2016 +0000
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.err.processorpath.no.processormodulepath
-// options: -processormodulepath mods -processorpath mods
+// options: --processor-module-path mods -processorpath mods
 
 class ProcessorPathNoProcessorModulePath {}
--- a/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarAwareSJFM.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarAwareSJFM.java	Fri Sep 02 02:42:03 2016 +0000
@@ -174,7 +174,7 @@
         jfm.setLocation(jloc, List.of(new File("multi-release.jar")));
 
         if (version.length() > 0) {
-            jfm.handleOption("-multi-release", List.of(version).iterator());
+            jfm.handleOption("--multi-release", List.of(version).iterator());
         }
 
         CustomClassLoader cldr = new CustomClassLoader(jfm);
--- a/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -135,12 +135,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 8 -cp multi-release.jar Main.java -> succeeds
+    // javac -d classes --release 8 -cp multi-release.jar Main.java -> succeeds
     public void main1Release8(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main1);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "8")
+                .options("--release", "8")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run();
@@ -149,12 +149,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 9 -cp multi-release.jar Main.java -> fails
+    // javac -d classes --release 9 -cp multi-release.jar Main.java -> fails
     public void main1Release9(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main1);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "9")
+                .options("--release", "9")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run(Task.Expect.FAIL, 1);
@@ -177,12 +177,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 8 -cp multi-release.jar Main.java -> fails
+    // javac -d classes --release 8 -cp multi-release.jar Main.java -> fails
     public void main2Release8(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main2);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "8")
+                .options("--release", "8")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run(Task.Expect.FAIL, 1);
@@ -191,12 +191,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 9 -cp multi-release.jar Main.java -> succeeds
+    // javac -d classes --release 9 -cp multi-release.jar Main.java -> succeeds
     public void main2Release9(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main2);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "9")
+                .options("--release", "9")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run();
--- a/langtools/test/tools/javac/lint/Deprecation.out	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/lint/Deprecation.out	Fri Sep 02 02:42:03 2016 +0000
@@ -1,4 +1,5 @@
-Deprecation.java:14:17: compiler.warn.has.been.deprecated: A, compiler.misc.unnamed.package
+Deprecation.java:11:1: compiler.warn.missing.deprecated.annotation
 - compiler.err.warnings.and.werror
+Deprecation.java:14:17: compiler.warn.has.been.deprecated: A, compiler.misc.unnamed.package
 1 error
-1 warning
+2 warnings
--- a/langtools/test/tools/javac/modules/AnachronisticModuleInfo/AnachronisticModuleInfoTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/modules/AnachronisticModuleInfo/AnachronisticModuleInfoTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -78,7 +78,7 @@
 
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
-                        "-upgrademodulepath", modulePath)
+                        "--upgrade-module-path", modulePath)
                 .files(findJavaFiles(src))
                 .run(Task.Expect.FAIL)
                 .writeAll()
--- a/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @summary tests for -upgrademodulepath
+ * @summary tests for --upgrade-module-path
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
--- a/langtools/test/tools/javac/modules/XModuleTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/modules/XModuleTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -27,7 +27,9 @@
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.code
  *      jdk.compiler/com.sun.tools.javac.main
+ *      jdk.compiler/com.sun.tools.javac.processing
  * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
  * @run main XModuleTest
  */
@@ -35,12 +37,22 @@
 import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Set;
 
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
+
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import toolbox.JavacTask;
 import toolbox.ModuleBuilder;
 import toolbox.Task;
-import toolbox.TestRunner;
-import toolbox.ToolBox;
+import toolbox.Task.Expect;
 
 public class XModuleTest extends ModuleTestBase {
 
@@ -111,15 +123,22 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = new JavacTask(tb)
-                .options("-Xmodule:java.compiler", "--class-path", cpClasses.toString())
+        List<String> log = new JavacTask(tb)
+                .options("-Xmodule:java.compiler",
+                         "--class-path", cpClasses.toString(),
+                         "-XDrawDiagnostics")
                 .outdir(classes)
                 .files(src.resolve("javax/lang/model/element/Extra.java"))
-                .run()
+                .run(Expect.FAIL)
                 .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
-        if (!log.isEmpty())
+        List<String> expectedOut = Arrays.asList(
+                "Extra.java:1:76: compiler.err.doesnt.exist: p",
+                "1 error"
+        );
+
+        if (!expectedOut.equals(log))
             throw new Exception("expected output not found: " + log);
     }
 
@@ -302,4 +321,103 @@
                 .run()
                 .writeAll();
     }
+
+    @Test
+    public void testUnnamedIsolation(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path sourcePath = base.resolve("source-path");
+        tb.writeJavaFiles(sourcePath, "package src; public class Src {}");
+
+        Path classPathSrc = base.resolve("class-path-src");
+        tb.writeJavaFiles(classPathSrc, "package cp; public class CP { }");
+        Path classPath = base.resolve("classPath");
+        tb.createDirectories(classPath);
+
+        String cpLog = new JavacTask(tb)
+                .outdir(classPath)
+                .files(findJavaFiles(classPathSrc))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!cpLog.isEmpty())
+            throw new Exception("expected output not found: " + cpLog);
+
+        Path modulePathSrc = base.resolve("module-path-src");
+        tb.writeJavaFiles(modulePathSrc,
+                          "module m {}",
+                          "package m; public class M {}");
+        Path modulePath = base.resolve("modulePath");
+        tb.createDirectories(modulePath.resolve("m"));
+
+        String modLog = new JavacTask(tb)
+                .outdir(modulePath.resolve("m"))
+                .files(findJavaFiles(modulePathSrc))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!modLog.isEmpty())
+            throw new Exception("expected output not found: " + modLog);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "package m; public class Extra { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("-Xmodule:m",
+                         "--class-path", classPath.toString(),
+                         "--source-path", sourcePath.toString(),
+                         "--module-path", modulePath.toString(),
+                         "--processor-path", System.getProperty("test.classes"),
+                         "-XDaccessInternalAPI=true",
+                         "-processor", CheckModuleContentProcessing.class.getName())
+                .outdir(classes)
+                .files(findJavaFiles(sourcePath))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class CheckModuleContentProcessing extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            Symtab syms = Symtab.instance(((JavacProcessingEnvironment) processingEnv).getContext());
+            Elements elements = processingEnv.getElementUtils();
+            ModuleElement unnamedModule = syms.unnamedModule;
+            ModuleElement mModule = elements.getModuleElement("m");
+
+            assertNonNull("mModule found", mModule);
+            assertNonNull("src.Src from m", elements.getTypeElement(mModule, "src.Src"));
+            assertNull("cp.CP not from m", elements.getTypeElement(mModule, "cp.CP"));
+            assertNull("src.Src not from unnamed", elements.getTypeElement(unnamedModule, "src.Src"));
+            assertNonNull("cp.CP from unnamed", elements.getTypeElement(unnamedModule, "cp.CP"));
+
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+        private static void assertNonNull(String msg, Object val) {
+            if (val == null) {
+                throw new AssertionError(msg);
+            }
+        }
+
+        private static void assertNull(String msg, Object val) {
+            if (val != null) {
+                throw new AssertionError(msg);
+            }
+        }
+    }
+
 }
--- a/langtools/test/tools/javac/options/release/ReleaseOption.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/options/release/ReleaseOption.java	Fri Sep 02 02:42:03 2016 +0000
@@ -1,9 +1,9 @@
 /**
  * @test /nodynamiccopyright/
  * @bug 8072480
- * @summary Verify that javac rejects Java 8 program with -release 7
+ * @summary Verify that javac rejects Java 8 program with --release 7
  * @compile ReleaseOption.java
- * @compile/fail/ref=ReleaseOption-release7.out -XDrawDiagnostics -release 7 ReleaseOption.java
+ * @compile/fail/ref=ReleaseOption-release7.out -XDrawDiagnostics --release 7 ReleaseOption.java
  */
 
 interface ReleaseOption extends java.util.stream.Stream {
--- a/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Fri Sep 02 02:42:03 2016 +0000
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 8072480
- * @summary Verify option clash between -release and -source is reported correctly.
+ * @summary Verify option clash between --release and -source is reported correctly.
  * @modules jdk.compiler/com.sun.tools.javac.util
  */
 
@@ -62,7 +62,7 @@
         useRawMessages.setBoolean(null, true);
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         List<String> options = new ArrayList<>();
-        options.addAll(Arrays.asList("-release", "7"));
+        options.addAll(Arrays.asList("--release", "7"));
         options.addAll(Arrays.asList(args));
         options.add(System.getProperty("test.src") + File.separator + "ReleaseOptionClashes.java");
         compiler.run(null, null, out, options.toArray(new String[0]));
--- a/langtools/test/tools/javac/options/release/ReleaseOptionThroughAPI.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/options/release/ReleaseOptionThroughAPI.java	Fri Sep 02 02:42:03 2016 +0000
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 8072480
- * @summary Verify that javac can handle -release when invoked using the Compiler API
+ * @summary Verify that javac can handle --release when invoked using the Compiler API
  */
 
 import java.io.IOException;
@@ -50,7 +50,7 @@
              PrintWriter outWriter = new PrintWriter(out)) {
             Iterable<? extends JavaFileObject> input =
                     fm.getJavaFileObjects(System.getProperty("test.src") + "/ReleaseOption.java");
-            List<String> options = Arrays.asList("-release", "7", "-XDrawDiagnostics");
+            List<String> options = Arrays.asList("--release", "7", "-XDrawDiagnostics");
 
             compiler.getTask(outWriter, fm, null, options, null, input).call();
             String expected =
--- a/langtools/test/tools/javac/platform/PlatformProviderTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/platform/PlatformProviderTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -101,7 +101,7 @@
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
                            "-XDrawDiagnostics",
-                           "-release",
+                           "--release",
                            platformSpec,
                            System.getProperty("test.src") + "/PlatformProviderTestSource.java")
                   .run();
@@ -135,7 +135,7 @@
                   .options("-J--class-path=" + System.getProperty("test.classes"),
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
-                           "-release",
+                           "--release",
                            "fail",
                            System.getProperty("test.src") + "/PlatformProviderTestSource.java")
                   .run(Task.Expect.FAIL);
--- a/langtools/test/tools/javac/sym/ElementStructureTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/sym/ElementStructureTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -255,7 +255,7 @@
     }
 
     void run(Writer output, String version) throws Exception {
-        List<String> options = Arrays.asList("-release", version, "-classpath", "");
+        List<String> options = Arrays.asList("--release", version, "-classpath", "");
         List<ToolBox.JavaSource> files = Arrays.asList(new ToolBox.JavaSource("Test", ""));
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, options, null, files);
--- a/langtools/test/tools/javac/synthesize/Main.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/synthesize/Main.java	Fri Sep 02 02:42:03 2016 +0000
@@ -99,7 +99,7 @@
         if (stdBootClassPath) {
             args.add("-Xmodule:java.base");
         } else {
-            args.add("-system");
+            args.add("--system");
             args.add("none");
             files.add("module-info.java");
         }
--- a/langtools/test/tools/javac/tree/JavacTreeScannerTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/tree/JavacTreeScannerTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -41,7 +41,7 @@
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
  * @build AbstractTreeScannerTest JavacTreeScannerTest
- * @run main JavacTreeScannerTest -q -r .
+ * @run main/othervm JavacTreeScannerTest -q -r .
  */
 
 import java.io.*;
--- a/langtools/test/tools/javac/tree/SourceTreeScannerTest.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javac/tree/SourceTreeScannerTest.java	Fri Sep 02 02:42:03 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -41,7 +41,7 @@
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
  * @build AbstractTreeScannerTest SourceTreeScannerTest
- * @run main SourceTreeScannerTest -q -r .
+ * @run main/othervm SourceTreeScannerTest -q -r .
  */
 
 import java.io.*;
--- a/langtools/test/tools/javadoc/ReleaseOption.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/javadoc/ReleaseOption.java	Fri Sep 02 02:42:03 2016 +0000
@@ -34,7 +34,7 @@
 /**
  * @test
  * @bug 8086737
- * @summary Test -release option in javadoc
+ * @summary Test --release option in javadoc
  * @run main ReleaseOption
  */
 public class ReleaseOption {
@@ -43,10 +43,10 @@
     }
 
     void run() {
-        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "7");
-        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "8");
-        doRunTest(1, out -> true, "-release", "7", "-source", "7");
-        doRunTest(1, out -> true, "-release", "7", "-bootclasspath", "any");
+        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "7");
+        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "8");
+        doRunTest(1, out -> true, "--release", "7", "-source", "7");
+        doRunTest(1, out -> true, "--release", "7", "-bootclasspath", "any");
     }
 
     void doRunTest(int expectedResult, Predicate<String> validate, String... args) {
--- a/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Thu Sep 01 23:20:13 2016 +0000
+++ b/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Fri Sep 02 02:42:03 2016 +0000
@@ -205,7 +205,7 @@
                 .collect(Collectors.joining(File.pathSeparator));
         new JavacTask(tb)
                 .outdir(Files.createDirectories(modules.resolve(name)))
-                .options("-mp", mp)
+                .options("--module-path", mp)
                 .files(tb.findJavaFiles(moduleSrc))
                 .run()
                 .writeAll();