Merge
authorlana
Thu, 13 Oct 2016 23:03:01 +0000
changeset 41524 4c65c407ee8a
parent 41513 a51f7035abbc (current diff)
parent 41523 da4f500b886d (diff)
child 41525 7f01e2b0619b
Merge
--- a/langtools/make/build.properties	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/make/build.properties	Thu Oct 13 23:03:01 2016 +0000
@@ -24,11 +24,12 @@
 #
 
 #javac configuration for "normal build" (these will be passed to the bootstrap compiler):
-javac.opts = -XDignore.symbol.file=true -Xlint:all,-deprecation,-options -Werror -g:source,lines,vars
+javac.opts = -XDignore.symbol.file=true -Xlint:all,-deprecation,-options,-exports -Werror -g:source,lines,vars
 javac.source = 9
 javac.target = 9
 
 #version used to compile build tools
+javac.build.opts = -XDignore.symbol.file=true -Xlint:all,-deprecation,-options -Werror -g:source,lines,vars
 javac.build.source = 8
 javac.build.target = 8
 
--- a/langtools/make/build.xml	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/make/build.xml	Thu Oct 13 23:03:01 2016 +0000
@@ -275,7 +275,7 @@
                classpath="${ant.core.lib}"
                bootclasspath="${langtools.jdk.home}/jre/lib/rt.jar"
                includeantruntime="false">
-            <compilerarg line="${javac.opts} -XDstringConcat=inline"/>
+            <compilerarg line="${javac.build.opts} -XDstringConcat=inline"/>
         </javac>
         <taskdef name="pparse"
                  classname="anttasks.PropertiesParserTask"
@@ -291,7 +291,7 @@
                destdir="${build.dir}/toolclasses/"
                classpath="${ant.core.lib}"
                includeantruntime="false">
-            <compilerarg line="${javac.opts} -XDstringConcat=inline"/>
+            <compilerarg line="${javac.build.opts} -XDstringConcat=inline"/>
         </javac>
         <taskdef name="pcompile"
                  classname="anttasks.CompilePropertiesTask"
--- a/langtools/make/gensrc/GensrcCommon.gmk	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/make/gensrc/GensrcCommon.gmk	Thu Oct 13 23:03:01 2016 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 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
--- a/langtools/make/intellij/misc.xml	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/make/intellij/misc.xml	Thu Oct 13 23:03:01 2016 +0000
@@ -4,14 +4,17 @@
     <entry_points version="2.0" />
   </component>
   <component name="JTRegService">
-    <option name="JTRegDir" value="@IDEA_JTREG_HOME@" />
-    <option name="JTRegOptions" value='@XPATCH@' />
-    <option name="alternativeJrePath" value="@IDEA_TARGET_JDK@" />
-    <option name="alternativeJrePathEnabled" value="true" />
-    <option name="workDir" value="build" />
+    <path>@IDEA_JTREG_HOME@</path>
+    <workDir>build</workDir>
+    <jre alt="true" value="@IDEA_TARGET_JDK@" />
+    <options>@XPATCH@</options>
+    <ant>
+      <target file="file://$PROJECT_DIR$/.idea/build.xml" name="build-all-classes" />
+    </ant>
   </component>
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/.idea/out" />
   </component>
 </project>
 
+
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Oct 13 23:03:01 2016 +0000
@@ -949,6 +949,7 @@
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public java.util.List<Directive> getDirectives() {
+            complete();
             completeUsesProvides();
             return Collections.unmodifiableList(directives);
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Thu Oct 13 23:03:01 2016 +0000
@@ -30,6 +30,9 @@
 var catTypes = "Types";
 var catMembers = "Members";
 var catSearchTags = "SearchTags";
+var highlight = "<span class=\"resultHighlight\">$&</span>";
+var camelCaseRegexp = "";
+var secondaryMatcher = "";
 function getName(name) {
     var anchor = "";
     var ch = '';
@@ -65,27 +68,35 @@
     }
     return anchor;
 }
+function getHighlightedText(item) {
+    var ccMatcher = new RegExp(camelCaseRegexp);
+    var label = item.replace(ccMatcher, highlight);
+    if (label === item) {
+        label = item.replace(secondaryMatcher, highlight);
+    }
+    return label;
+}
 var watermark = 'Search';
 $(function() {
     $("#search").prop("disabled", false);
     $("#reset").prop("disabled", false);
     $("#search").val(watermark).addClass('watermark');
-    $("#search").blur(function(){
+    $("#search").blur(function() {
         if ($(this).val().length == 0) {
             $(this).val(watermark).addClass('watermark');
         }
     });
-    $("#search").keydown(function(){
-       if ($(this).val() == watermark) {
+    $("#search").keydown(function() {
+        if ($(this).val() == watermark) {
             $(this).val('').removeClass('watermark');
         }
     });
-    $("#reset").click(function(){
-       $("#search").val('');
-       $("#search").focus();
+    $("#reset").click(function() {
+        $("#search").val('');
+        $("#search").focus();
     });
     $("#search").focus();
-    $("#search")[0].setSelectionRange(0,0);
+    $("#search")[0].setSelectionRange(0, 0);
 });
 $.widget("custom.catcomplete", $.ui.autocomplete, {
     _create: function() {
@@ -112,22 +123,19 @@
         });
     },
     _renderItem: function(ul, item) {
-        var result = this.element.val();
-        var regexp = new RegExp($.ui.autocomplete.escapeRegex(result), "i");
-        highlight = "<span class=\"resultHighlight\">$&</span>";
         var label = "";
         if (item.category === catModules) {
-            label = item.l.replace(regexp, highlight);
+            label = getHighlightedText(item.l);
         } else if (item.category === catPackages) {
             label = (item.m)
-                    ? (item.m + "/" + item.l).replace(regexp, highlight)
-                    : item.l.replace(regexp, highlight);
+                    ? getHighlightedText(item.m + "/" + item.l)
+                    : getHighlightedText(item.l);
         } else if (item.category === catTypes) {
-            label += (item.p + "." + item.l).replace(regexp, highlight);
+            label = getHighlightedText(item.p + "." + item.l);
         } else if (item.category === catMembers) {
-            label += item.p + "." + (item.c + "." + item.l).replace(regexp, highlight);
+            label = getHighlightedText(item.p + "." + (item.c + "." + item.l));
         } else if (item.category === catSearchTags) {
-            label = item.l.replace(regexp, highlight);
+            label = getHighlightedText(item.l);
         } else {
             label = item.l;
         }
@@ -163,7 +171,9 @@
             var tgresult = new Array();
             var displayCount = 0;
             var exactMatcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term) + "$", "i");
-            var secondaryMatcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
+            camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join("([a-z0-9_$]*?)");
+            var camelCaseMatcher = new RegExp("^" + camelCaseRegexp);
+            secondaryMatcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
             if (moduleSearchIndex) {
                 var mdleCount = 0;
                 $.each(moduleSearchIndex, function(index, item) {
@@ -171,6 +181,8 @@
                     if (exactMatcher.test(item.l)) {
                         result.unshift(item);
                         mdleCount++;
+                    } else if (camelCaseMatcher.test(item.l)) {
+                        result.unshift(item);
                     } else if (secondaryMatcher.test(item.l)) {
                         result.push(item);
                     }
@@ -188,6 +200,8 @@
                     if (exactMatcher.test(item.l)) {
                         presult.unshift(item);
                         pCount++;
+                    } else if (camelCaseMatcher.test(pkg)) {
+                        presult.unshift(item);
                     } else if (secondaryMatcher.test(pkg)) {
                         presult.push(item);
                     }
@@ -202,6 +216,8 @@
                     if (exactMatcher.test(item.l)) {
                         tresult.unshift(item);
                         tCount++;
+                    } else if (camelCaseMatcher.test(item.l)) {
+                        tresult.unshift(item);
                     } else if (secondaryMatcher.test(item.p + "." + item.l)) {
                         tresult.push(item);
                     }
@@ -216,6 +232,8 @@
                     if (exactMatcher.test(item.l)) {
                         mresult.unshift(item);
                         mCount++;
+                    } else if (camelCaseMatcher.test(item.l)) {
+                        mresult.unshift(item);
                     } else if (secondaryMatcher.test(item.c + "." + item.l)) {
                         mresult.push(item);
                     }
@@ -294,4 +312,4 @@
             }
         }
     });
-});
+});
\ No newline at end of file
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Thu Oct 13 23:03:01 2016 +0000
@@ -680,20 +680,21 @@
     private boolean genModuleInfo(JdepsConfiguration config) throws IOException {
         // check if any JAR file contains unnamed package
         for (String arg : inputArgs) {
-            Optional<String> classInUnnamedPackage =
-                ClassFileReader.newInstance(Paths.get(arg))
-                    .entries().stream()
-                    .filter(n -> n.endsWith(".class"))
-                    .filter(cn -> toPackageName(cn).isEmpty())
-                    .findFirst();
+            try (ClassFileReader reader = ClassFileReader.newInstance(Paths.get(arg))) {
+                Optional<String> classInUnnamedPackage =
+                    reader.entries().stream()
+                        .filter(n -> n.endsWith(".class"))
+                        .filter(cn -> toPackageName(cn).isEmpty())
+                        .findFirst();
 
-            if (classInUnnamedPackage.isPresent()) {
-                if (classInUnnamedPackage.get().equals("module-info.class")) {
-                    reportError("err.genmoduleinfo.not.jarfile", arg);
-                } else {
-                    reportError("err.genmoduleinfo.unnamed.package", arg);
+                if (classInUnnamedPackage.isPresent()) {
+                    if (classInUnnamedPackage.get().equals("module-info.class")) {
+                        reportError("err.genmoduleinfo.not.jarfile", arg);
+                    } else {
+                        reportError("err.genmoduleinfo.unnamed.package", arg);
+                    }
+                    return false;
                 }
-                return false;
             }
         }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Oct 13 23:03:01 2016 +0000
@@ -73,7 +73,6 @@
 import jdk.jshell.JShell;
 import jdk.jshell.JShell.Subscription;
 import jdk.jshell.MethodSnippet;
-import jdk.jshell.PersistentSnippet;
 import jdk.jshell.Snippet;
 import jdk.jshell.Snippet.Status;
 import jdk.jshell.SnippetEvent;
@@ -1137,10 +1136,9 @@
         return state.snippets();
     }
 
-    Stream<PersistentSnippet> dropableSnippets() {
+    Stream<Snippet> dropableSnippets() {
         return state.snippets()
-                .filter(sn -> state.status(sn).isActive() && sn instanceof PersistentSnippet)
-                .map(sn -> (PersistentSnippet) sn);
+                .filter(sn -> state.status(sn).isActive());
     }
 
     Stream<VarSnippet> allVarSnippets() {
@@ -1761,13 +1759,13 @@
             errormsg("jshell.err.drop.arg");
             return false;
         }
-        Stream<PersistentSnippet> stream = argsToSnippets(this::dropableSnippets, args);
+        Stream<Snippet> stream = argsToSnippets(this::dropableSnippets, args);
         if (stream == null) {
             // Snippet not found. Error already printed
             fluffmsg("jshell.msg.see.classes.etc");
             return false;
         }
-        List<PersistentSnippet> snippets = stream.collect(toList());
+        List<Snippet> snippets = stream.collect(toList());
         if (snippets.size() > args.size()) {
             // One of the args references more thean one snippet
             errormsg("jshell.err.drop.ambiguous");
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java	Thu Oct 13 23:03:01 2016 +0000
@@ -77,9 +77,7 @@
                 } catch (IOException ex) {
                     errorHandler.accept(ex);
                 } finally {
-                    synchronized (StopDetectingInputStream.this) {
-                        state = StopDetectingInputStream.State.CLOSED;
-                    }
+                    shutdown();
                 }
             }
         };
@@ -140,8 +138,10 @@
     }
 
     public synchronized void setState(State state) {
-        this.state = state;
-        notifyAll();
+        if (this.state != State.CLOSED) {
+            this.state = state;
+            notifyAll();
+        }
     }
 
     private synchronized State waitInputNeeded() {
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Thu Oct 13 23:03:01 2016 +0000
@@ -743,7 +743,7 @@
 /set format verbose result '{name} ==> {value}{post}'                                        added,modified,replaced-ok-primary    \n\
 \n\
 /set format verbose display '{result}{pre}created scratch variable {name} : {type}{post}'    expression-added,modified,replaced-primary    \n\
-/set format verbose display '{result}{pre}value of {name} : {type}{post}'                    varvalue-primary    \n\
+/set format verbose display '{result}{pre}value of {name} : {type}{post}'                    varvalue-added,modified,replaced-primary    \n\
 /set format verbose display '{result}{pre}assigned to {name} : {type}{post}'                 assignment-primary    \n\
 /set format verbose display '{result}{pre}{action} variable {name} : {type}{resolve}{post}'  varinit,vardecl    \n\
 /set format verbose display '{pre}{action} variable {name}{resolve}{post}'                   vardecl,varinit-notdefined    \n\
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Thu Oct 13 23:03:01 2016 +0000
@@ -521,10 +521,13 @@
 
     List<SnippetEvent> drop(Snippet si) {
         Unit c = new Unit(state, si);
-
-        Set<Unit> ins = c.dependents().collect(toSet());
-        Set<Unit> outs = compileAndLoad(ins);
-
+        Set<Unit> outs;
+        if (si instanceof PersistentSnippet) {
+            Set<Unit> ins = c.dependents().collect(toSet());
+            outs = compileAndLoad(ins);
+        } else {
+            outs = Collections.emptySet();
+        }
         return events(c, outs, null, null);
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java	Thu Oct 13 23:03:01 2016 +0000
@@ -58,7 +58,7 @@
  * API.  A {@code JShell} instance holds the evolving compilation and
  * execution state.  The state is changed with the instance methods
  * {@link jdk.jshell.JShell#eval(java.lang.String) eval(String)},
- * {@link jdk.jshell.JShell#drop(jdk.jshell.PersistentSnippet) drop(PersistentSnippet)} and
+ * {@link jdk.jshell.JShell#drop(jdk.jshell.Snippet) drop(Snippet)} and
  * {@link jdk.jshell.JShell#addToClasspath(java.lang.String) addToClasspath(String)}.
  * The majority of methods query the state.
  * A {@code JShell} instance also allows registering for events with
@@ -428,7 +428,12 @@
     }
 
     /**
-     * Remove a declaration from the state.
+     * Remove a declaration from the state.  That is, if the snippet is an
+     * {@linkplain jdk.jshell.Snippet.Status#isActive() active}
+     * {@linkplain jdk.jshell.PersistentSnippet persistent} snippet, remove the
+     * snippet and update the JShell evaluation state accordingly.
+     * For all active snippets, change the {@linkplain #status status} to
+     * {@link jdk.jshell.Snippet.Status#DROPPED DROPPED}.
      * @param snippet The snippet to remove
      * @return The list of events from updating declarations dependent on the
      * dropped snippet.
@@ -436,7 +441,7 @@
      * @throws IllegalArgumentException if the snippet is not associated with
      * this {@code JShell} instance.
      */
-    public List<SnippetEvent> drop(PersistentSnippet snippet) throws IllegalStateException {
+    public List<SnippetEvent> drop(Snippet snippet) throws IllegalStateException {
         checkIfAlive();
         checkValidSnippet(snippet);
         List<SnippetEvent> events = eval.drop(snippet);
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Key.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Key.java	Thu Oct 13 23:03:01 2016 +0000
@@ -74,7 +74,7 @@
     /**
      * Grouping for snippets which persist and influence future code.
      * They are keyed off at least the name.  They may be Modified/Replaced
-     * with new input and can be dropped (JShell#drop).
+     * with new input.
      */
     static abstract class PersistentKey extends Key {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/PersistentSnippet.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/PersistentSnippet.java	Thu Oct 13 23:03:01 2016 +0000
@@ -28,8 +28,8 @@
 /**
  * Grouping for Snippets which persist and influence future code.
  * A persistent snippet can be
- * {@linkplain jdk.jshell.Snippet.Status#OVERWRITTEN overwritten)}
- * with new input and can be dropped {@link JShell#drop}.
+ * {@linkplain jdk.jshell.Snippet.Status#OVERWRITTEN overwritten}
+ * with new input.
  * <p>
  * <code>PersistentSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Snippet.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Snippet.java	Thu Oct 13 23:03:01 2016 +0000
@@ -443,9 +443,7 @@
 
         /**
          * The snippet is inactive because of an explicit call to
-         * the {@link JShell#drop(PersistentSnippet)}.
-         * Only a {@link jdk.jshell.PersistentSnippet} can have this
-         * {@code Status}.
+         * the {@link JShell#drop(Snippet)}.
          * <p>
          * The snippet is not visible to other snippets
          * ({@link Status#isDefined() isDefined() == false})
@@ -525,10 +523,11 @@
 
         /**
          * Indicates whether the Snippet is active, that is,
-         * will the snippet be re-evaluated when a new
+         * will a {@linkplain jdk.jshell.PersistentSnippet persistent}
+         * snippet be re-evaluated when a new
          * {@link JShell#eval(java.lang.String) JShell.eval(String)} or
-         * {@link JShell#drop(jdk.jshell.PersistentSnippet)
-         * JShell.drop(PersistentSnippet)} that could change
+         * {@link JShell#drop(jdk.jshell.Snippet)
+         * JShell.drop(Snippet)} that could change
          * its status is invoked.  This is more broad than
          * {@link Status#isDefined()} since a Snippet which is
          * {@link Status#RECOVERABLE_NOT_DEFINED}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java	Thu Oct 13 23:03:01 2016 +0000
@@ -30,7 +30,7 @@
 /**
  * A description of a change to a Snippet. These are generated by direct changes
  * to state with {@link JShell#eval(java.lang.String) JShell.eval(String)} or
- * {@link JShell#drop(jdk.jshell.PersistentSnippet) JShell.drop(PersistentSnippet)},
+ * {@link JShell#drop(jdk.jshell.Snippet) JShell.drop(Snippet)},
  * or indirectly by these same methods as
  * dependencies change or Snippets are overwritten. For direct changes, the
  * {@link SnippetEvent#causeSnippet()} is {@code null}.
@@ -108,7 +108,7 @@
      * creation of a new Snippet via
      * {@link jdk.jshell.JShell#eval(java.lang.String) eval} or it is the
      * explicit drop of a Snippet with
-     * {@link jdk.jshell.JShell#drop(jdk.jshell.PersistentSnippet) drop}.
+     * {@link jdk.jshell.JShell#drop(jdk.jshell.Snippet) drop}.
      *
      * @return the Snippet which caused this change or {@code null} if
      * directly caused by an API action.
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/package-info.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/package-info.java	Thu Oct 13 23:03:01 2016 +0000
@@ -46,7 +46,7 @@
  * {@link jdk.jshell.SnippetEvent}.  There are three major kinds of
  * changes to the status of a snippet: it can created with <code>eval</code>,
  * it can be dropped from the active source state with
- * {@link jdk.jshell.JShell#drop(jdk.jshell.PersistentSnippet)}, and it can have
+ * {@link jdk.jshell.JShell#drop(jdk.jshell.Snippet)}, and it can have
  * its status updated as a result of a status change in another snippet.
  * For
  * example: given <code>js</code>, an instance of <code>JShell</code>, executing
--- a/langtools/test/Makefile	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/Makefile	Thu Oct 13 23:03:01 2016 +0000
@@ -321,6 +321,7 @@
 	  $(JTREG_EXCLUSIONS) \
 	  $(JTREG_OPTIONS) \
 	  $(JTREG_TESTDIRS) \
+	    2>&1 | tee $(JTREG_OUTPUT_DIR)/output.txt \
 	|| ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \
 	    echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \
 	)
--- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Thu Oct 13 23:03:01 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8141492 8071982
+ * @bug 8141492 8071982 8141636
  * @summary Test the search feature of javadoc.
  * @author bpatel
  * @library ../lib
@@ -45,6 +45,7 @@
         checkExit(Exit.OK);
         checkSearchOutput("UnnamedPkgClass.html", true);
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(false,
                 "package-search-index.zip",
                 "tag-search-index.zip");
@@ -62,6 +63,7 @@
         checkSearchOutput(true);
         checkSingleIndex(true);
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(true,
                 "member-search-index.zip",
                 "package-search-index.zip",
@@ -78,6 +80,7 @@
         checkSearchOutput(true);
         checkSingleIndex(true);
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(true,
                 "member-search-index.zip",
                 "package-search-index.zip",
@@ -110,6 +113,7 @@
         checkSearchOutput(true);
         checkSingleIndex(true);
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(true,
                 "member-search-index.zip",
                 "package-search-index.zip",
@@ -142,6 +146,7 @@
         checkSearchOutput(true);
         checkIndexNoComment();
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(true,
                 "member-search-index.zip",
                 "package-search-index.zip",
@@ -158,6 +163,7 @@
         checkSearchOutput(true);
         checkIndexNoDeprecated();
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(true,
                 "member-search-index.zip",
                 "package-search-index.zip",
@@ -174,6 +180,7 @@
         checkSearchOutput(true);
         checkSplitIndex();
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(true,
                 "member-search-index.zip",
                 "package-search-index.zip",
@@ -189,6 +196,7 @@
         checkSearchOutput(true);
         checkJavaFXOutput();
         checkJqueryAndImageFiles(true);
+        checkSearchJS();
         checkFiles(false,
                 "tag-search-index.zip");
         checkFiles(true,
@@ -420,4 +428,11 @@
                 "resources/x.png",
                 "resources/glass.png");
     }
+
+    void checkSearchJS() {
+        checkOutput("search.js", true,
+                "camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join(\"([a-z0-9_$]*?)\");",
+                "var camelCaseMatcher = new RegExp(\"^\" + camelCaseRegexp);",
+                "camelCaseMatcher.test(item.l)");
+    }
 }
--- a/langtools/test/jdk/jshell/DropTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/DropTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -23,14 +23,14 @@
 
 /*
  * @test
- * @bug 8081431 8080069
+ * @bug 8081431 8080069 8167128
  * @summary Test of JShell#drop().
  * @build KullaTesting TestingInputStream
  * @run testng DropTest
  */
 
 import jdk.jshell.DeclarationSnippet;
-import jdk.jshell.PersistentSnippet;
+import jdk.jshell.Snippet;
 import jdk.jshell.VarSnippet;
 import org.testng.annotations.Test;
 
@@ -40,9 +40,9 @@
 public class DropTest extends KullaTesting {
 
     public void testDrop() {
-        PersistentSnippet var = varKey(assertEval("int x;"));
-        PersistentSnippet method = methodKey(assertEval("int mu() { return x * 4; }"));
-        PersistentSnippet clazz = classKey(assertEval("class C { String v() { return \"#\" + mu(); } }"));
+        Snippet var = varKey(assertEval("int x;"));
+        Snippet method = methodKey(assertEval("int mu() { return x * 4; }"));
+        Snippet clazz = classKey(assertEval("class C { String v() { return \"#\" + mu(); } }"));
         assertDrop(var,
                 ste(var, VALID, DROPPED, true, null),
                 ste(method, VALID, RECOVERABLE_DEFINED, false, var));
@@ -62,7 +62,7 @@
         assertEval("int x = 10;", "10",
                 added(VALID),
                 ste(method, RECOVERABLE_DEFINED, VALID, false, MAIN_SNIPPET));
-        PersistentSnippet c0 = varKey(assertEval("C c0 = new C();"));
+        Snippet c0 = varKey(assertEval("C c0 = new C();"));
         assertEval("c0.v();", "\"#40\"");
         assertEval("C c = new C();",
                 ste(MAIN_SNIPPET, VALID, VALID, false, null),
@@ -88,8 +88,8 @@
     }
 
     public void testDropImport() {
-        PersistentSnippet imp = importKey(assertEval("import java.util.*;"));
-        PersistentSnippet decl = varKey(
+        Snippet imp = importKey(assertEval("import java.util.*;"));
+        Snippet decl = varKey(
                 assertEval("List<Integer> list = Arrays.asList(1, 2, 3);", "[1, 2, 3]"));
         assertEval("list;", "[1, 2, 3]");
         assertDrop(imp,
@@ -100,8 +100,13 @@
         assertDeclareFail("list;", "compiler.err.cant.resolve.location");
     }
 
+    public void testDropStatement() {
+        Snippet x = key(assertEval("if (true);"));
+        assertDrop(x, ste(x, VALID, DROPPED, true, null));
+    }
+
     public void testDropVarToMethod() {
-        PersistentSnippet x = varKey(assertEval("int x;"));
+        Snippet x = varKey(assertEval("int x;"));
         DeclarationSnippet method = methodKey(assertEval("double mu() { return x * 4; }"));
         assertEval("x == 0;", "true");
         assertEval("mu() == 0.0;", "true");
@@ -118,7 +123,7 @@
     }
 
     public void testDropMethodToMethod() {
-        PersistentSnippet a = methodKey(assertEval("double a() { return 2; }"));
+        Snippet a = methodKey(assertEval("double a() { return 2; }"));
         DeclarationSnippet b = methodKey(assertEval("double b() { return a() * 10; }"));
         assertEval("double c() { return b() * 3; }");
         DeclarationSnippet d = methodKey(assertEval("double d() { return c() + 1000; }"));
@@ -134,7 +139,7 @@
     }
 
     public void testDropClassToMethod() {
-        PersistentSnippet c = classKey(assertEval("class C { int f() { return 7; } }"));
+        Snippet c = classKey(assertEval("class C { int f() { return 7; } }"));
         DeclarationSnippet m = methodKey(assertEval("int m() { return new C().f(); }"));
         assertDrop(c,
                 ste(c, VALID, DROPPED, true, null),
@@ -145,7 +150,7 @@
     }
 
     public void testDropVarToClass() {
-        PersistentSnippet x = varKey(assertEval("int x;"));
+        Snippet x = varKey(assertEval("int x;"));
         DeclarationSnippet a = classKey(assertEval("class A { double a = 4 * x; }"));
         assertDrop(x,
                 DiagCheck.DIAG_OK,
@@ -160,7 +165,7 @@
     }
 
     public void testDropMethodToClass() {
-        PersistentSnippet x = methodKey(assertEval("int x() { return 0; }"));
+        Snippet x = methodKey(assertEval("int x() { return 0; }"));
         DeclarationSnippet a = classKey(assertEval("class A { double a = 4 * x(); }"));
         assertDrop(x,
                 DiagCheck.DIAG_OK,
@@ -174,10 +179,10 @@
     }
 
     public void testDropClassToClass() {
-        PersistentSnippet a = classKey(assertEval("class A {}"));
-        PersistentSnippet b = classKey(assertEval("class B extends A {}"));
-        PersistentSnippet c = classKey(assertEval("class C extends B {}"));
-        PersistentSnippet d = classKey(assertEval("class D extends C {}"));
+        Snippet a = classKey(assertEval("class A {}"));
+        Snippet b = classKey(assertEval("class B extends A {}"));
+        Snippet c = classKey(assertEval("class C extends B {}"));
+        Snippet d = classKey(assertEval("class D extends C {}"));
         assertDrop(a,
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
@@ -201,9 +206,9 @@
     public void testDropNoUpdate() {
         String as1 = "class A {}";
         String as2 = "class A extends java.util.ArrayList<Boolean> {}";
-        PersistentSnippet a = classKey(assertEval(as1, added(VALID)));
-        PersistentSnippet b = classKey(assertEval("class B extends A {}", added(VALID)));
-        PersistentSnippet ax = classKey(assertEval(as2,
+        Snippet a = classKey(assertEval(as1, added(VALID)));
+        Snippet b = classKey(assertEval("class B extends A {}", added(VALID)));
+        Snippet ax = classKey(assertEval(as2,
                 ste(MAIN_SNIPPET, VALID, VALID, true, null),
                 ste(a, VALID, OVERWRITTEN, false, MAIN_SNIPPET),
                 ste(b, VALID, VALID, true, MAIN_SNIPPET)));
--- a/langtools/test/jdk/jshell/IdGeneratorTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/IdGeneratorTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -35,7 +35,6 @@
 
 import jdk.jshell.EvalException;
 import jdk.jshell.JShell;
-import jdk.jshell.PersistentSnippet;
 import jdk.jshell.SnippetEvent;
 import jdk.jshell.UnresolvedReferenceException;
 import jdk.jshell.VarSnippet;
@@ -88,7 +87,7 @@
         try (JShell jShell = builder.build()) {
             List<SnippetEvent> eval = jShell.eval("int a, b;");
             checkIds(eval);
-            checkIds(jShell.drop((PersistentSnippet) eval.get(0).snippet()));
+            checkIds(jShell.drop(eval.get(0).snippet()));
         }
     }
 
--- a/langtools/test/jdk/jshell/IllegalArgumentExceptionTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/IllegalArgumentExceptionTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -31,7 +31,6 @@
 import java.util.function.Consumer;
 
 import jdk.jshell.DeclarationSnippet;
-import jdk.jshell.PersistentSnippet;
 import jdk.jshell.Snippet;
 import jdk.jshell.VarSnippet;
 import org.testng.annotations.Test;
@@ -64,7 +63,7 @@
     }
 
     public void testDrop() {
-        testIllegalArgumentException((key) -> getState().drop((PersistentSnippet) key));
+        testIllegalArgumentException((key) -> getState().drop(key));
     }
 
     public void testUnresolved() {
--- a/langtools/test/jdk/jshell/JShellStateClosedTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/JShellStateClosedTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -33,7 +33,6 @@
 import jdk.jshell.DeclarationSnippet;
 import jdk.jshell.ImportSnippet;
 import jdk.jshell.MethodSnippet;
-import jdk.jshell.PersistentSnippet;
 import jdk.jshell.Snippet;
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
@@ -127,7 +126,7 @@
     }
 
     public void testDrop() {
-        testStateClosedException((key) -> getState().drop((PersistentSnippet) key));
+        testStateClosedException((key) -> getState().drop(key));
     }
 
     public void testUnresolved() {
--- a/langtools/test/jdk/jshell/KullaTesting.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/KullaTesting.java	Thu Oct 13 23:03:01 2016 +0000
@@ -54,7 +54,6 @@
 import jdk.jshell.ImportSnippet;
 import jdk.jshell.Snippet.Kind;
 import jdk.jshell.MethodSnippet;
-import jdk.jshell.PersistentSnippet;
 import jdk.jshell.Snippet.Status;
 import jdk.jshell.Snippet.SubKind;
 import jdk.jshell.TypeDeclSnippet;
@@ -733,15 +732,15 @@
         assertEquals(expectedSubKind.kind(), expectedKind, "Checking kind: ");
     }
 
-    public void assertDrop(PersistentSnippet key, STEInfo mainInfo, STEInfo... updates) {
+    public void assertDrop(Snippet key, STEInfo mainInfo, STEInfo... updates) {
         assertDrop(key, DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, mainInfo, updates);
     }
 
-    public void assertDrop(PersistentSnippet key, DiagCheck diagMain, DiagCheck diagUpdates, STEInfo mainInfo, STEInfo... updates) {
+    public void assertDrop(Snippet key, DiagCheck diagMain, DiagCheck diagUpdates, STEInfo mainInfo, STEInfo... updates) {
         assertDrop(key, diagMain, diagUpdates, new EventChain(mainInfo, null, null, updates));
     }
 
-    public void assertDrop(PersistentSnippet key, DiagCheck diagMain, DiagCheck diagUpdates, EventChain... eventChains) {
+    public void assertDrop(Snippet key, DiagCheck diagMain, DiagCheck diagUpdates, EventChain... eventChains) {
         checkEvents(() -> getState().drop(key), "drop(" + key + ")", diagMain, diagUpdates, eventChains);
     }
 
--- a/langtools/test/jdk/jshell/ReplaceTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/ReplaceTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -33,7 +33,6 @@
 import java.util.stream.Stream;
 import jdk.jshell.Snippet;
 import jdk.jshell.MethodSnippet;
-import jdk.jshell.PersistentSnippet;
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
 import jdk.jshell.DeclarationSnippet;
@@ -585,14 +584,14 @@
     }
 
     public void testForwardSingleImportMethodToClass1() {
-        PersistentSnippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
+        Snippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.String.format;",
                 added(VALID),
                 ste(a, RECOVERABLE_DEFINED, VALID, false, null));
         assertEval("new A().s;", "\"10\"");
-        PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
+        Snippet format = methodKey(assertEval("void format(String s, int d) { }",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -605,14 +604,14 @@
     }
 
     public void testForwardSingleImportMethodToClass2() {
-        PersistentSnippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
+        Snippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.String.format;",
                 added(VALID),
                 ste(a, RECOVERABLE_DEFINED, VALID, false, null));
         assertEval("new A().s();", "\"10\"");
-        PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
+        Snippet format = methodKey(assertEval("void format(String s, int d) { }",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -625,7 +624,7 @@
     }
 
     public void testForwardSingleImportClassToClass1() {
-        PersistentSnippet a = classKey(assertEval("class A { static List<Integer> list; }",
+        Snippet a = classKey(assertEval("class A { static List<Integer> list; }",
                 added(RECOVERABLE_NOT_DEFINED)));
         assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
         assertEval("import java.util.List;",
@@ -634,7 +633,7 @@
         assertEval("import java.util.Arrays;", added(VALID));
         assertEval("A.list = Arrays.asList(1, 2, 3);", "[1, 2, 3]");
 
-        PersistentSnippet list = classKey(assertEval("class List {}",
+        Snippet list = classKey(assertEval("class List {}",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -647,7 +646,7 @@
     }
 
     public void testForwardSingleImportClassToClass2() {
-        PersistentSnippet clsA = classKey(assertEval("class A extends ArrayList<Integer> { }",
+        Snippet clsA = classKey(assertEval("class A extends ArrayList<Integer> { }",
                 added(RECOVERABLE_NOT_DEFINED)));
         assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
         assertEval("import java.util.ArrayList;",
@@ -655,7 +654,7 @@
                 ste(clsA, RECOVERABLE_NOT_DEFINED, VALID, true, MAIN_SNIPPET));
         Snippet vara = varKey(assertEval("A a = new A();", "[]"));
 
-        PersistentSnippet arraylist = classKey(assertEval("class ArrayList {}",
+        Snippet arraylist = classKey(assertEval("class ArrayList {}",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -671,7 +670,7 @@
     }
 
     public void testForwardImportOnDemandMethodToClass1() {
-        PersistentSnippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
+        Snippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.String.*;",
@@ -679,7 +678,7 @@
                 ste(a, RECOVERABLE_DEFINED, VALID, false, null));
         assertEval("A x = new A();");
         assertEval("x.s;", "\"10\"");
-        PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
+        Snippet format = methodKey(assertEval("void format(String s, int d) { }",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -693,14 +692,14 @@
     }
 
     public void testForwardImportOnDemandMethodToClass2() {
-        PersistentSnippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
+        Snippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.String.*;",
                 added(VALID),
                 ste(a, RECOVERABLE_DEFINED, VALID, false, null));
         assertEval("new A().s();", "\"10\"");
-        PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
+        Snippet format = methodKey(assertEval("void format(String s, int d) { }",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -713,7 +712,7 @@
     }
 
     public void testForwardImportOnDemandClassToClass1() {
-        PersistentSnippet a = classKey(assertEval("class A { static List<Integer> list; }",
+        Snippet a = classKey(assertEval("class A { static List<Integer> list; }",
                 added(RECOVERABLE_NOT_DEFINED)));
         assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
         assertEval("import java.util.*;",
@@ -721,7 +720,7 @@
                 ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
         assertEval("A.list = Arrays.asList(1, 2, 3);", "[1, 2, 3]");
 
-        PersistentSnippet list = classKey(assertEval("class List {}",
+        Snippet list = classKey(assertEval("class List {}",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -734,7 +733,7 @@
     }
 
     public void testForwardImportOnDemandClassToClass2() {
-        PersistentSnippet clsA = classKey(assertEval("class A extends ArrayList<Integer> { }",
+        Snippet clsA = classKey(assertEval("class A extends ArrayList<Integer> { }",
                 added(RECOVERABLE_NOT_DEFINED)));
         assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
         assertEval("import java.util.*;",
@@ -742,7 +741,7 @@
                 ste(clsA, RECOVERABLE_NOT_DEFINED, VALID, true, MAIN_SNIPPET));
         Snippet vara = varKey(assertEval("A a = new A();", "[]"));
 
-        PersistentSnippet arraylist = classKey(assertEval("class ArrayList {}",
+        Snippet arraylist = classKey(assertEval("class ArrayList {}",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -757,7 +756,7 @@
     }
 
     public void testForwardSingleImportFieldToClass1() {
-        PersistentSnippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
+        Snippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.Math.PI;",
@@ -765,7 +764,7 @@
                 ste(a, RECOVERABLE_DEFINED, VALID, false, null));
         assertEval("Math.abs(A.pi() - 3.1415) < 0.001;", "true");
 
-        PersistentSnippet list = varKey(assertEval("String PI;",
+        Snippet list = varKey(assertEval("String PI;",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -778,7 +777,7 @@
     }
 
     public void testForwardSingleImportFieldToClass2() {
-        PersistentSnippet a = classKey(assertEval("class A { static double pi = PI; }",
+        Snippet a = classKey(assertEval("class A { static double pi = PI; }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.Math.PI;",
@@ -786,7 +785,7 @@
                 ste(a, RECOVERABLE_DEFINED, VALID, true, null));
         assertEval("Math.abs(A.pi - 3.1415) < 0.001;", "true");
 
-        PersistentSnippet list = varKey(assertEval("String PI;",
+        Snippet list = varKey(assertEval("String PI;",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -799,7 +798,7 @@
     }
 
     public void testForwardImportOnDemandFieldToClass1() {
-        PersistentSnippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
+        Snippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.Math.*;",
@@ -807,7 +806,7 @@
                 ste(a, RECOVERABLE_DEFINED, VALID, false, null));
         assertEval("Math.abs(A.pi() - 3.1415) < 0.001;", "true");
 
-        PersistentSnippet list = varKey(assertEval("String PI;",
+        Snippet list = varKey(assertEval("String PI;",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
@@ -820,7 +819,7 @@
     }
 
     public void testForwardImportOnDemandFieldToClass2() {
-        PersistentSnippet a = classKey(assertEval("class A { static double pi = PI; }",
+        Snippet a = classKey(assertEval("class A { static double pi = PI; }",
                 added(RECOVERABLE_DEFINED)));
         assertEvalUnresolvedException("new A();", "A", 1, 0);
         assertEval("import static java.lang.Math.*;",
@@ -828,7 +827,7 @@
                 ste(a, RECOVERABLE_DEFINED, VALID, true, null));
         assertEval("Math.abs(A.pi - 3.1415) < 0.001;", "true");
 
-        PersistentSnippet list = varKey(assertEval("String PI;",
+        Snippet list = varKey(assertEval("String PI;",
                 DiagCheck.DIAG_OK,
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
--- a/langtools/test/jdk/jshell/ToolCommandOptionTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/ToolCommandOptionTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -23,7 +23,7 @@
 
  /*
  * @test
- * @bug 8157395 8157393 8157517 8158738
+ * @bug 8157395 8157393 8157517 8158738  8167128
  * @summary Tests of jshell comand options, and undoing operations
  * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build ToolCommandOptionTest ReplToolTesting
@@ -101,13 +101,17 @@
                         "|  Unknown option: -all -- /drop -all"),
                 (a) -> assertCommandOutputStartsWith(a, "/drop z",
                         "|  No such snippet: z"),
-                (a) -> assertCommandOutputStartsWith(a, "/drop 2",
-                        "|  This command does not accept the snippet '2' : x"),
+                (a) -> assertCommand(a, "/drop 2",
+                        ""),
+                (a) -> assertCommandOutputStartsWith(a, "23qwl",
+                        "|  Error:"),
+                (a) -> assertCommandOutputStartsWith(a, "/drop e1",
+                        "|  This command does not accept the snippet 'e1' : 23qwl"),
                 (a) -> assertCommand(a, "/dr x y",
                         "|  dropped variable x\n" +
                         "|  dropped variable y"),
                 (a) -> assertCommand(a, "/list",
-                        "2 : x")
+                        "")
         );
     }
 
--- a/langtools/test/jdk/jshell/ToolSimpleTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/jdk/jshell/ToolSimpleTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -217,6 +217,9 @@
                 a -> dropClass(a, "/drop 3", "class A", "|  dropped class A"),
                 a -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
                 a -> dropImport(a, "/drop 4", "import java.util.stream.*", ""),
+                a -> assertCommand(a, "for (int i = 0; i < 10; ++i) {}", ""),
+                a -> assertCommand(a, "/drop 5", ""),
+                a -> assertCommand(a, "/list", ""),
                 a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
                 a -> assertCommandCheckOutput(a, "/types", assertClasses()),
@@ -244,6 +247,7 @@
                         assertStartsWith("|  In the /drop argument, please specify an import, variable, method, or class to drop.")),
                 a -> assertVariable(a, "int", "a"),
                 a -> assertCommand(a, "a", "a ==> 0"),
+                a -> assertCommand(a, "/drop 2", ""),
                 a -> assertCommand(a, "/drop 2",
                         "|  This command does not accept the snippet '2' : a\n" +
                         "|  See /types, /methods, /vars, or /list")
--- a/langtools/test/tools/javac/modules/EdgeCases.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/tools/javac/modules/EdgeCases.java	Thu Oct 13 23:03:01 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154283
+ * @bug 8154283 8167320
  * @summary tests for multi-module mode compilation
  * @library /tools/lib
  * @modules
@@ -54,6 +54,7 @@
 //import com.sun.source.util.JavacTask; // conflicts with toolbox.JavacTask
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
+import com.sun.tools.javac.code.Symtab;
 
 import toolbox.JarTask;
 import toolbox.JavacTask;
@@ -449,4 +450,12 @@
         }
     }
 
+    @Test
+    public void testGetDirectivesComplete(Path base) throws Exception {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, null, null, null);
+        Symtab syms = Symtab.instance(task.getContext());
+
+        syms.java_base.getDirectives();
+    }
 }
--- a/langtools/test/tools/javac/modules/ModulePathTest.java	Thu Oct 13 21:01:13 2016 +0000
+++ b/langtools/test/tools/javac/modules/ModulePathTest.java	Thu Oct 13 23:03:01 2016 +0000
@@ -29,7 +29,7 @@
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
  *      jdk.jdeps/com.sun.tools.javap
- *      jdk.jlink/jdk.tools.jmod
+ *      jdk.jlink
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask toolbox.ModuleBuilder
  *      ModuleTestBase
  * @run main ModulePathTest
@@ -39,6 +39,7 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.spi.ToolProvider;
 
 import toolbox.JarTask;
 import toolbox.JavacTask;
@@ -420,6 +421,9 @@
                 "--class-path", dir.toString(),
                 jmod.toString()
         };
-        jdk.tools.jmod.Main.run(args, System.out);
+        ToolProvider jmodTool = ToolProvider.findFirst("jmod").orElseThrow(() ->
+                new RuntimeException("jmod tool not found")
+        );
+        jmodTool.run(System.out, System.err, args);
     }
 }