Merge
authorddehaven
Fri, 16 Dec 2016 11:58:18 -0800
changeset 42836 1d55dcc9a118
parent 42831 feff6f296019 (diff)
parent 42835 1dc3889eb057 (current diff)
child 42837 03ee805ba348
Merge
langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java
--- a/langtools/.hgtags	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/.hgtags	Fri Dec 16 11:58:18 2016 -0800
@@ -391,3 +391,4 @@
 26f972dc2d174a75bc32131c29661c78568586b0 jdk-9+146
 76389430a13e82a9321cdc085216f6bff526e316 jdk-9+147
 586c93260d3b2f91a055b96118b141c05841694f jdk-9+148
+4d4cd7cd731c1952d7330ea5bcfda8bd26820fa5 jdk-9+149
--- a/langtools/make/tools/anttasks/SelectToolTask.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/make/tools/anttasks/SelectToolTask.java	Fri Dec 16 11:58:18 2016 -0800
@@ -203,14 +203,11 @@
         if (toolName != null) {
             toolChoice.setSelectedItem(tool);
         }
-        toolChoice.addItemListener(new ItemListener() {
-            @Override
-            public void itemStateChanged(ItemEvent e) {
-                ToolChoices tool = (ToolChoices)e.getItem();
-                argsField.setText(getDefaultArgsForTool(props, tool));
-                if (toolProperty != null)
-                    okButton.setEnabled(tool != ToolChoices.NONE);
-            }
+        toolChoice.addItemListener(e -> {
+            ToolChoices tool1 = (ToolChoices)e.getItem();
+            argsField.setText(getDefaultArgsForTool(props, tool1));
+            if (toolProperty != null)
+                okButton.setEnabled(tool1 != ToolChoices.NONE);
         });
         fc.anchor = GridBagConstraints.EAST;
 
@@ -248,12 +245,9 @@
         final JOptionPane p = new JOptionPane(body);
         okButton = new JButton("OK");
         okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
-        okButton.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
-                d.setVisible(false);
-            }
+        okButton.addActionListener(e -> {
+            JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
+            d.setVisible(false);
         });
         p.setOptions(new Object[] { okButton });
 
--- a/langtools/make/tools/crules/MutableFieldsAnalyzer.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/make/tools/crules/MutableFieldsAnalyzer.java	Fri Dec 16 11:58:18 2016 -0800
@@ -107,6 +107,8 @@
                 "layerClass", "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$Module",
                 "addExportsMethod", "addUsesMethod", "getModuleMethod", "getUnnamedModuleMethod");
+        ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$ModuleDescriptor$Version",
+                "versionClass", "parseMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$ServiceLoaderHelper",
                 "loadMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$VMHelper",
--- a/langtools/make/tools/propertiesparser/PropertiesParser.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/make/tools/propertiesparser/PropertiesParser.java	Fri Dec 16 11:58:18 2016 -0800
@@ -57,7 +57,7 @@
     }
 
     public static boolean run(String[] args, PrintStream out) {
-        PropertiesParser pp = new PropertiesParser(msg -> out.println(msg));
+        PropertiesParser pp = new PropertiesParser(out::println);
         return pp.run(args);
     }
 
@@ -76,7 +76,7 @@
             return false;
         }
         try {
-            optionsMap.forEach((propfile, outfile) -> compilePropertyFile(propfile, outfile));
+            optionsMap.forEach(this::compilePropertyFile);
             return true;
         } catch (RuntimeException ex) {
             ex.printStackTrace();
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/Filer.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/Filer.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -66,7 +66,8 @@
  * allow the <em>originating elements</em> to be provided as hints to
  * the tool infrastructure to better manage dependencies.  The
  * originating elements are the types or packages (representing {@code
- * package-info} files) which caused an annotation processor to
+ * package-info} files) or modules (representing {@code
+ * module-info} files) which caused an annotation processor to
  * attempt to create a new file.  For example, if an annotation
  * processor tries to create a source file, {@code
  * GeneratedFromUserSource}, in response to processing
@@ -111,10 +112,10 @@
  * to overwrite existing files that were not generated.
  *
  * <p> Processors can indicate a source or class file is generated by
- * including an {@link javax.annotation.Generated @Generated}
- * annotation.
+ * including a {@code javax.annotation.Generated} annotation if the
+ * environment is configured so that that type is accessible.
  *
- * <p> Note that some of the effect of overwriting a file can be
+ * @apiNote Some of the effect of overwriting a file can be
  * achieved by using a <i>decorator</i>-style pattern.  Instead of
  * modifying a class directly, the class is designed so that either
  * its superclass is generated by annotation processing or subclasses
@@ -131,18 +132,35 @@
 public interface Filer {
     /**
      * Creates a new source file and returns an object to allow
-     * writing to it.  The file's name and path (relative to the
-     * {@linkplain StandardLocation#SOURCE_OUTPUT root output location
-     * for source files}) are based on the type to be declared in that
-     * file.  If more than one type is being declared, the name of the
-     * principal top-level type (the public one, for example) should
-     * be used.  A source file can also be created to hold information
-     * about a package, including package annotations.  To create a
-     * source file for a named package, have {@code name} be the
+     * writing to it. A source file for a type, or a package can
+     * be created.
+     *
+     * The file's name and path (relative to the {@linkplain
+     * StandardLocation#SOURCE_OUTPUT root output location for source
+     * files}) are based on the name of the item to be declared in
+     * that file as well as the specified module for the item (if
+     * any).
+     *
+     * If more than one type is being declared in a single file (that
+     * is, a single compilation unit), the name of the file should
+     * correspond to the name of the principal top-level type (the
+     * public one, for example).
+     *
+     * <p>A source file can also be created to hold information about
+     * a package, including package annotations.  To create a source
+     * file for a named package, have the {@code name} argument be the
      * package's name followed by {@code ".package-info"}; to create a
      * source file for an unnamed package, use {@code "package-info"}.
      *
-     * <p> Note that to use a particular {@linkplain
+     * <p>The optional module name is prefixed to the type name or
+     * package name and separated using a "{@code /}" character. For
+     * example, to create a source file for type {@code a.B} in module
+     * {@code foo}, use a {@code name} argument of {@code "foo/a.B"}.
+     *
+     * <p>Creating a source file in or for an unnamed package in a named
+     * module is <em>not</em> supported.
+     *
+     * @apiNote To use a particular {@linkplain
      * java.nio.charset.Charset charset} to encode the contents of the
      * file, an {@code OutputStreamWriter} with the chosen charset can
      * be created from the {@code OutputStream} from the returned
@@ -161,37 +179,51 @@
      * @param name  canonical (fully qualified) name of the principal type
      *          being declared in this file or a package name followed by
      *          {@code ".package-info"} for a package information file
-     * @param originatingElements type or package elements causally
+     * @param originatingElements type or package or module elements causally
      * associated with the creation of this file, may be elided or
      * {@code null}
      * @return a {@code JavaFileObject} to write the new source file
      * @throws FilerException if the same pathname has already been
      * created, the same type has already been created, or the name is
-     * not valid for a type
+     * otherwise not valid for the entity requested to being created
      * @throws IOException if the file cannot be created
+     * @jls 7.3 Compilation Units
      */
     JavaFileObject createSourceFile(CharSequence name,
                                     Element... originatingElements) throws IOException;
 
     /**
      * Creates a new class file, and returns an object to allow
-     * writing to it.  The file's name and path (relative to the
-     * {@linkplain StandardLocation#CLASS_OUTPUT root output location
-     * for class files}) are based on the name of the type being
-     * written.  A class file can also be created to hold information
-     * about a package, including package annotations.  To create a
-     * class file for a named package, have {@code name} be the
+     * writing to it. A class file for a type, or a package can
+     * be created.
+     *
+     * The file's name and path (relative to the {@linkplain
+     * StandardLocation#CLASS_OUTPUT root output location for class
+     * files}) are based on the name of the item to be declared as
+     * well as the specified module for the item (if any).
+     *
+     * <p>A class file can also be created to hold information about a
+     * package, including package annotations. To create a class file
+     * for a named package, have the {@code name} argument be the
      * package's name followed by {@code ".package-info"}; creating a
      * class file for an unnamed package is not supported.
      *
-     * <p>To avoid subsequent errors, the contents of the class file
-     * should be compatible with the {@linkplain
-     * ProcessingEnvironment#getSourceVersion source version} being used
-     * for this run.
+     * <p>The optional module name is prefixed to the type name or
+     * package name and separated using a "{@code /}" character. For
+     * example, to create a class file for type {@code a.B} in module
+     * {@code foo}, use a {@code name} argument of {@code "foo/a.B"}.
+     *
+     * <p>Creating a class file in or for an unnamed package in a named
+     * module is <em>not</em> supported.
+     *
+     * @apiNote To avoid subsequent errors, the contents of the class
+     * file should be compatible with the {@linkplain
+     * ProcessingEnvironment#getSourceVersion source version} being
+     * used for this run.
      *
      * @param name binary name of the type being written or a package name followed by
      *          {@code ".package-info"} for a package information file
-     * @param originatingElements type or package elements causally
+     * @param originatingElements type or package or module elements causally
      * associated with the creation of this file, may be elided or
      * {@code null}
      * @return a {@code JavaFileObject} to write the new class file
@@ -210,20 +242,27 @@
      * other supported location.  The locations {@link
      * StandardLocation#CLASS_OUTPUT CLASS_OUTPUT} and {@link
      * StandardLocation#SOURCE_OUTPUT SOURCE_OUTPUT} must be
-     * supported.  The resource may be named relative to some package
-     * (as are source and class files), and from there by a relative
-     * pathname.  In a loose sense, the full pathname of the new file
-     * will be the concatenation of {@code location}, {@code pkg}, and
-     * {@code relativeName}.
+     * supported. The resource may be named relative to some module
+     * and/or package (as are source and class files), and from there
+     * by a relative pathname.  In a loose sense, the full pathname of
+     * the new file will be the concatenation of {@code location},
+     * {@code moduleAndPkg}, and {@code relativeName}.
      *
-     * <p>Files created via this method are not registered for
+     * If {@code moduleAndPkg} contains a "{@code /}" character, the
+     * prefix before the "{@code /}" character is the module name and
+     * the suffix after the "{@code /}" character is the package
+     * name. The package suffix may be empty. If {@code moduleAndPkg}
+     * does not contain a "{@code /}" character, the entire argument
+     * is interpreted as a package name.
+     *
+     * <p>Files created via this method are <em>not</em> registered for
      * annotation processing, even if the full pathname of the file
      * would correspond to the full pathname of a new source file
      * or new class file.
      *
      * @param location location of the new file
-     * @param pkg package relative to which the file should be named,
-     *          or the empty string if none
+     * @param moduleAndPkg module and/or package relative to which the file
+     *           should be named, or the empty string if none
      * @param relativeName final pathname components of the file
      * @param originatingElements type or package elements causally
      * associated with the creation of this file, may be elided or
@@ -233,10 +272,11 @@
      * @throws FilerException if the same pathname has already been
      * created
      * @throws IllegalArgumentException for an unsupported location
+     * @throws IllegalArgumentException if {@code moduleAndPkg} is ill-formed
      * @throws IllegalArgumentException if {@code relativeName} is not relative
      */
    FileObject createResource(JavaFileManager.Location location,
-                             CharSequence pkg,
+                             CharSequence moduleAndPkg,
                              CharSequence relativeName,
                              Element... originatingElements) throws IOException;
 
@@ -246,18 +286,27 @@
      * and {@link StandardLocation#SOURCE_OUTPUT SOURCE_OUTPUT} must
      * be supported.
      *
+     * <p>If {@code moduleAndPkg} contains a "{@code /}" character, the
+     * prefix before the "{@code /}" character is the module name and
+     * the suffix after the "{@code /}" character is the package
+     * name. The package suffix may be empty; however, if a module
+     * name is present, it must be nonempty. If {@code moduleAndPkg}
+     * does not contain a "{@code /}" character, the entire argument
+     * is interpreted as a package name.
+     *
      * @param location location of the file
-     * @param pkg package relative to which the file should be searched,
-     *          or the empty string if none
+     * @param moduleAndPkg module and/or package relative to which the file
+     *          should be searched for, or the empty string if none
      * @param relativeName final pathname components of the file
      * @return an object to read the file
      * @throws FilerException if the same pathname has already been
      * opened for writing
      * @throws IOException if the file cannot be opened
      * @throws IllegalArgumentException for an unsupported location
+     * @throws IllegalArgumentException if {@code moduleAndPkg} is ill-formed
      * @throws IllegalArgumentException if {@code relativeName} is not relative
      */
     FileObject getResource(JavaFileManager.Location location,
-                           CharSequence pkg,
+                           CharSequence moduleAndPkg,
                            CharSequence relativeName) throws IOException;
 }
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, 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
@@ -115,7 +115,17 @@
  * the root elements of a round. For this purpose, a type parameter is
  * considered to be enclosed by its {@linkplain
  * TypeParameterElement#getGenericElement generic
- * element}. Annotations on {@linkplain
+ * element}.
+
+ * For this purpose, a package element is <em>not</em> considered to
+ * enclose the top-level types within that package. (A root element
+ * representing a package is created when a {@code package-info} file
+ * is processed.) Likewise, for this purpose, a module element is
+ * <em>not</em> considered to enclose the packages within that
+ * module. (A root element representing a module is created when a
+ * {@code module-info} file is processed.)
+ *
+ * Annotations on {@linkplain
  * java.lang.annotation.ElementType#TYPE_USE type uses}, as opposed to
  * annotations on elements, are ignored when computing whether or not
  * an annotation type is present.
@@ -235,12 +245,20 @@
      * (fully qualified) name of a supported annotation type.
      * Alternately it may be of the form &quot;<tt><i>name</i>.*</tt>&quot;
      * representing the set of all annotation types with canonical
-     * names beginning with &quot;<tt><i>name.</i></tt>&quot;.  Finally, {@code
-     * "*"} by itself represents the set of all annotation types,
-     * including the empty set.  Note that a processor should not
-     * claim {@code "*"} unless it is actually processing all files;
-     * claiming unnecessary annotations may cause a performance
-     * slowdown in some environments.
+     * names beginning with &quot;<tt><i>name.</i></tt>&quot;.
+     *
+     * In either of those cases, the name of the annotation type can
+     * be optionally preceded by a module name followed by a {@code
+     * "/"} character. For example, if a processor supports {@code
+     * "a.B"}, this can include multiple annotation types named {@code
+     * a.B} which reside in different modules. To only support {@code
+     * a.B} in the {@code Foo} module, instead use {@code "Foo/a.B"}.
+     *
+     * Finally, {@code "*"} by itself represents the set of all
+     * annotation types, including the empty set.  Note that a
+     * processor should not claim {@code "*"} unless it is actually
+     * processing all files; claiming unnecessary annotations may
+     * cause a performance slowdown in some environments.
      *
      * <p>Each string returned in the set must be accepted by the
      * following grammar:
@@ -248,9 +266,12 @@
      * <blockquote>
      * <dl>
      * <dt><i>SupportedAnnotationTypeString:</i>
-     * <dd><i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
+     * <dd><i>ModulePrefix</i><sub><i>opt</i></sub> <i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
      * <dd><tt>*</tt>
      *
+     * <dt><i>ModulePrefix:</i>
+     * <dd><i>TypeName</i> <tt>/</tt>
+     *
      * <dt><i>DotStar:</i>
      * <dd><tt>.</tt> <tt>*</tt>
      * </dl>
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java	Fri Dec 16 11:58:18 2016 -0800
@@ -76,14 +76,17 @@
     /**
      * Returns the elements annotated with the given annotation type.
      * The annotation may appear directly or be inherited.  Only
-     * package elements and type elements <i>included</i> in this
+     * package elements, module elements, and type elements <i>included</i> in this
      * round of annotation processing, or declarations of members,
      * constructors, parameters, or type parameters declared within
      * those, are returned.  Included type elements are {@linkplain
      * #getRootElements root types} and any member types nested within
-     * them.  Elements in a package are not considered included simply
+     * them.  Elements of a package are not considered included simply
      * because a {@code package-info} file for that package was
      * created.
+     * Likewise, elements of a module are not considered included
+     * simply because a {@code module-info} file for that module was
+     * created
      *
      * @param a  annotation type being requested
      * @return the elements annotated with the given annotation type,
@@ -128,7 +131,7 @@
     /**
      * Returns the elements annotated with the given annotation type.
      * The annotation may appear directly or be inherited.  Only
-     * package elements and type elements <i>included</i> in this
+     * package elements, module elements, and type elements <i>included</i> in this
      * round of annotation processing, or declarations of members,
      * constructors, parameters, or type parameters declared within
      * those, are returned.  Included type elements are {@linkplain
@@ -136,6 +139,9 @@
      * them.  Elements in a package are not considered included simply
      * because a {@code package-info} file for that package was
      * created.
+     * Likewise, elements of a module are not considered included
+     * simply because a {@code module-info} file for that module was
+     * created
      *
      * @param a  annotation type being requested
      * @return the elements annotated with the given annotation type,
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/package-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/package-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, 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
@@ -53,7 +53,9 @@
  * Names of parameters may not be recoverable from class files.
  *
  * The {@linkplain javax.lang.model.element.Modifier modifiers} on an
- * element may differ in some cases including:
+ * element created from a class file may differ in some cases from an
+ * element for the same declaration created from a source file
+ * including:
  *
  * <ul>
  * <li> {@code strictfp} on a class or interface
@@ -61,10 +63,19 @@
  * <li> {@code protected}, {@code private}, and {@code static} on classes and interfaces
  * </ul>
  *
- * Additionally, synthetic constructs in a class file, such as
- * accessor methods used in implementing nested classes and bridge
- * methods used in implementing covariant returns, are translation
- * artifacts outside of this model.
+ * Some elements which are {@linkplain
+ * javax.lang.model.util.Elements.Origin#MANDATED mandated} may not be
+ * marked as such when created from class files.
+ *
+ * Additionally, {@linkplain
+ * javax.lang.model.util.Elements.Origin#SYNTHETIC synthetic}
+ * constructs in a class file, such as accessor methods used in
+ * implementing nested classes and {@linkplain
+ * javax.lang.model.util.Elements.Origin#isBridge(ExecutableElement)
+ * bridge methods} used in implementing covariant returns, are
+ * translation artifacts strictly outside of this model. However, when
+ * operating on class files, it is helpful be able to operate on such
+ * elements, screening them out when appropriate.
  *
  * <p>During annotation processing, operating on incomplete or
  * erroneous programs is necessary; however, there are fewer
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, 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
@@ -36,6 +36,7 @@
 import javax.lang.model.element.ModuleElement.Directive;
 import javax.lang.model.element.ModuleElement.DirectiveKind;
 import javax.lang.model.element.ModuleElement.ExportsDirective;
+import javax.lang.model.element.ModuleElement.OpensDirective;
 import javax.lang.model.element.ModuleElement.ProvidesDirective;
 import javax.lang.model.element.ModuleElement.RequiresDirective;
 import javax.lang.model.element.ModuleElement.UsesDirective;
@@ -239,11 +240,9 @@
         return set;
     }
 
-
-
     /**
-     * Returns a list of export directives in {@code directives}.
-     * @return a list of export directives in {@code directives}
+     * Returns a list of {@code exports} directives in {@code directives}.
+     * @return a list of {@code exports} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
      */
@@ -253,8 +252,19 @@
     }
 
     /**
-     * Returns a list of provides directives in {@code directives}.
-     * @return a list of provides directives in {@code directives}
+     * Returns a list of {@code opens} directives in {@code directives}.
+     * @return a list of {@code opens} directives in {@code directives}
+     * @param directives the directives to filter
+     * @since 9
+     */
+    public static List<OpensDirective>
+            opensIn(Iterable<? extends Directive> directives) {
+        return listFilter(directives, DirectiveKind.OPENS, OpensDirective.class);
+    }
+
+    /**
+     * Returns a list of {@code provides} directives in {@code directives}.
+     * @return a list of {@code provides} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
      */
@@ -264,8 +274,8 @@
     }
 
     /**
-     * Returns a list of requires directives in {@code directives}.
-     * @return a list of requires directives in {@code directives}
+     * Returns a list of {@code requires} directives in {@code directives}.
+     * @return a list of {@code requires} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
      */
@@ -275,8 +285,8 @@
     }
 
     /**
-     * Returns a list of uses directives in {@code directives}.
-     * @return a list of uses directives in {@code directives}
+     * Returns a list of {@code uses} directives in {@code directives}.
+     * @return a list of {@code uses} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
      */
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/Elements.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/Elements.java	Fri Dec 16 11:58:18 2016 -0800
@@ -29,6 +29,7 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.lang.model.AnnotatedConstruct;
 import javax.lang.model.element.*;
 
 
@@ -47,10 +48,11 @@
 public interface Elements {
 
     /**
-     * Returns a package given its fully qualified name.
+     * Returns a package given its fully qualified name if the package is unique in the environment.
+     * If running with modules, all modules in the modules graph are searched for matching packages.
      *
      * @param name  fully qualified package name, or an empty string for an unnamed package
-     * @return the named package, or {@code null} if it cannot be found
+     * @return the named package, or {@code null} if it cannot be uniquely found
      */
     PackageElement getPackageElement(CharSequence name);
 
@@ -65,10 +67,12 @@
     PackageElement getPackageElement(ModuleElement module, CharSequence name);
 
     /**
-     * Returns a type element given its canonical name.
+     * Returns a type element given its canonical name if the type element is unique in the environment.
+     * If running with modules, all modules in the modules graph are searched for matching
+     * type elements.
      *
      * @param name  the canonical name
-     * @return the named type element, or {@code null} if it cannot be found
+     * @return the named type element, or {@code null} if it cannot be uniquely found
      */
     TypeElement getTypeElement(CharSequence name);
 
@@ -84,6 +88,10 @@
 
     /**
      * Returns a module element given its fully qualified name.
+     * If the named module cannot be found, null is returned. One situation where a module
+     * cannot be found is if the environment does not include modules, such as
+     * an annotation processing environment configured for
+     * a {@linkplain ProcessingEnvironment#getSourceVersion source version} without modules.      *
      *
      * @param name  the name
      * @return the named module element, or {@code null} if it cannot be found
@@ -136,6 +144,167 @@
     boolean isDeprecated(Element e);
 
     /**
+     * Returns the <em>origin</em> of the given element.
+     *
+     * <p>Note that if this method returns {@link Origin#EXPLICIT
+     * EXPLICIT} and the element was created from a class file, then
+     * the element may not, in fact, correspond to an explicitly
+     * declared construct in source code. This is due to limitations
+     * of the fidelity of the class file format in preserving
+     * information from source code. For example, at least some
+     * versions of the class file format do not preserve whether a
+     * constructor was explicitly declared by the programmer or was
+     * implicitly declared as the <em>default constructor</em>.
+     *
+     * @implSpec The default implementation of this method returns
+     * {@link Origin#EXPLICIT EXPLICIT}.
+     *
+     * @param e  the element being examined
+     * @return the origin of the given element
+     * @since 9
+     */
+    default Origin getOrigin(Element e) {
+        return Origin.EXPLICIT;
+    }
+
+    /**
+     * Returns the <em>origin</em> of the given annotation mirror.
+     *
+     * An annotation mirror is {@linkplain Origin#MANDATED mandated}
+     * if it is an implicitly declared <em>container annotation</em>
+     * used to hold repeated annotations of a repeatable annotation
+     * type.
+     *
+     * <p>Note that if this method returns {@link Origin#EXPLICIT
+     * EXPLICIT} and the annotation mirror was created from a class
+     * file, then the element may not, in fact, correspond to an
+     * explicitly declared construct in source code. This is due to
+     * limitations of the fidelity of the class file format in
+     * preserving information from source code. For example, at least
+     * some versions of the class file format do not preserve whether
+     * an annotation was explicitly declared by the programmer or was
+     * implicitly declared as a <em>container annotation</em>.
+     *
+     * @implSpec The default implementation of this method returns
+     * {@link Origin#EXPLICIT EXPLICIT}.
+     *
+     * @param c the construct the annotation mirror modifies
+     * @param a the annotation mirror being examined
+     * @return the origin of the given annotation mirror
+     * @jls 9.6.3 Repeatable Annotation Types
+     * @jls 9.7.5 Multiple Annotations of the Same Type
+     * @since 9
+     */
+    default Origin getOrigin(AnnotatedConstruct c,
+                             AnnotationMirror a) {
+        return Origin.EXPLICIT;
+    }
+
+    /**
+     * Returns the <em>origin</em> of the given module directive.
+     *
+     * <p>Note that if this method returns {@link Origin#EXPLICIT
+     * EXPLICIT} and the module directive was created from a class
+     * file, then the module directive may not, in fact, correspond to
+     * an explicitly declared construct in source code. This is due to
+     * limitations of the fidelity of the class file format in
+     * preserving information from source code. For example, at least
+     * some versions of the class file format do not preserve whether
+     * a {@code uses} directive was explicitly declared by the
+     * programmer or was added as a synthetic construct.
+     *
+     * <p>Note that an implementation may not be able to reliably
+     * determine the origin status of the directive if the directive
+     * is created from a class file due to limitations of the fidelity
+     * of the class file format in preserving information from source
+     * code.
+     *
+     * @implSpec The default implementation of this method returns
+     * {@link Origin#EXPLICIT EXPLICIT}.
+     *
+     * @param m the module of the directive
+     * @param directive  the module directive being examined
+     * @return the origin of the given directive
+     * @since 9
+     */
+    default Origin getOrigin(ModuleElement m,
+                             ModuleElement.Directive directive) {
+        return Origin.EXPLICIT;
+    }
+
+    /**
+     * The <em>origin</em> of an element or other language model
+     * item. The origin of an element or item models how a construct
+     * in a program is declared in the source code, explicitly,
+     * implicitly, etc.
+     *
+     * <p>Note that it is possible additional kinds of origin values
+     * will be added in future versions of the platform.
+     *
+     * @jls 13.1 The Form of a Binary
+     * @since 9
+     */
+    public enum Origin {
+        /**
+         * Describes a construct explicitly declared in source code.
+         */
+        EXPLICIT,
+
+       /**
+         * A mandated construct is one that is not explicitly declared
+         * in the source code, but whose presence is mandated by the
+         * specification. Such a construct is said to be implicitly
+         * declared.
+         *
+         * One example of a mandated element is a <em>default
+         * constructor</em> in a class that contains no explicit
+         * constructor declarations.
+         *
+         * Another example of a mandated construct is an implicitly
+         * declared <em>container annotation</em> used to hold
+         * multiple annotations of a repeatable annotation type.
+         *
+         * @jls 8.8.9 Default Constructor
+         * @jls 9.6.3 Repeatable Annotation Types
+         * @jls 9.7.5 Multiple Annotations of the Same Type
+         */
+        MANDATED,
+
+       /**
+         * A synthetic construct is one that is neither implicitly nor
+         * explicitly declared in the source code. Such a construct is
+         * typically a translation artifact created by a compiler.
+         */
+        SYNTHETIC;
+
+        /**
+         * Returns {@code true} for values corresponding to constructs
+         * that are implicitly or explicitly declared, {@code false}
+         * otherwise.
+         * @return {@code true} for {@link EXPLICIT} and {@link
+         * MANDATED}, {@code false} otherwise.
+         */
+        public boolean isDeclared() {
+            return this != SYNTHETIC;
+        }
+    }
+
+    /**
+     * Returns {@code true} if the executable element is a bridge
+     * method, {@code false} otherwise.
+     *
+     * @implSpec The default implementation of this method returns {@code false}.
+     *
+     * @param e  the executable being examined
+     * @return {@code true} if the executable element is a bridge
+     * method, {@code false} otherwise
+     * @since 9
+     */
+    default boolean isBridge(ExecutableElement e) {
+        return false;
+    }
+
+    /**
      * Returns the <i>binary name</i> of a type element.
      *
      * @param type  the type element being examined
@@ -159,6 +328,10 @@
     /**
      * Returns the module of an element.  The module of a module is
      * itself.
+     * If there is no module for the element, null is returned. One situation where there is
+     * no module for an element is if the environment does not include modules, such as
+     * an annotation processing environment configured for
+     * a {@linkplain ProcessingEnvironment#getSourceVersion source version} without modules.      *
      *
      * @param type the element being examined
      * @return the module of an element
--- a/langtools/src/java.compiler/share/classes/javax/tools/JavaFileManager.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/java.compiler/share/classes/javax/tools/JavaFileManager.java	Fri Dec 16 11:58:18 2016 -0800
@@ -479,8 +479,10 @@
 
     /**
      * Gets a location for the module containing a specific file representing a Java
-     * source or class, to be found in a module-oriented location.
-     * The result will be a package-oriented location.
+     * source or class, to be found within a location, which may be either
+     * a module-oriented location or an output location.
+     * The result will be an output location if the given location is
+     * an output location, or it will be a package-oriented location.
      *
      * @apiNote the package name is used to identify the position of the file object
      * within the <em>module/package/class</em> hierarchy identified by by the location.
@@ -494,7 +496,8 @@
      *
      * @throws IOException if an I/O error occurred
      * @throws UnsupportedOperationException if this operation if not supported by this file manager
-     * @throws IllegalArgumentException if the location is not a module-oriented location
+     * @throws IllegalArgumentException if the location is neither an output location nor a
+     * module-oriented location
      * @since 9
      */
     default Location getLocationForModule(Location location, JavaFileObject fo, String pkgName) throws IOException {
@@ -543,8 +546,9 @@
     }
 
     /**
-     * Lists the locations for all the modules in a module-oriented location.
-     * The locations that are returned will be package-oriented locations.
+     * Lists the locations for all the modules in a module-oriented location or an output location.
+     * The locations that are returned will be output locations if the given location is an output,
+     * or it will be a package-oriented locations.
      *
      * @implSpec This implementation throws {@code UnsupportedOperationException}.
      *
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -150,6 +150,12 @@
         PARAM("param"),
 
         /**
+         * Used for instances of {@link ProvidesTree}
+         * representing an @provides tag.
+         */
+        PROVIDES("provides"),
+
+        /**
          * Used for instances of {@link ReferenceTree}
          * representing a reference to a element in the
          * Java programming language.
@@ -223,6 +229,12 @@
         UNKNOWN_INLINE_TAG,
 
         /**
+         * Used for instances of {@link UsesTree}
+         * representing an @uses tag.
+         */
+        USES("uses"),
+
+        /**
          * Used for instances of {@link ValueTree}
          * representing an @value tag.
          */
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Fri Dec 16 11:58:18 2016 -0800
@@ -185,6 +185,14 @@
     R visitParam(ParamTree node, P p);
 
     /**
+     * Visits a ProvidesTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
+    R visitProvides(ProvidesTree node, P p);
+
+    /**
      * Visits a ReferenceTree node.
      * @param node the node being visited
      * @param p a parameter value
@@ -281,6 +289,14 @@
     R visitUnknownInlineTag(UnknownInlineTagTree node, P p);
 
     /**
+     * Visits a UsesTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
+    R visitUses(UsesTree node, P p);
+
+    /**
      * Visits a ValueTree node.
      * @param node the node being visited
      * @param p a parameter value
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/ProvidesTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,51 @@
+/*
+ * 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 com.sun.source.doctree;
+
+import java.util.List;
+
+/**
+ *
+ * A tree node for a @provides block tag.
+ *
+ * <p>
+ * &#064;provides service-type description
+ *
+ * @since 9
+ */
+public interface ProvidesTree extends BlockTagTree {
+    /**
+     * Returns the name of the service type being documented.
+     * @return the name of the service type
+     */
+    ReferenceTree getServiceType();
+
+    /**
+     * Returns a description of the service type being provided by the module.
+     * @return the description
+     */
+    List<? extends DocTree> getDescription();
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/ThrowsTree.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/ThrowsTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -40,13 +40,13 @@
  */
 public interface ThrowsTree extends BlockTagTree {
     /**
-     * Returns a name of the exception being documented.
+     * Returns the name of the exception being documented.
      * @return the name of the exception
      */
     ReferenceTree getExceptionName();
 
     /**
-     * Returns the description of the reasons why the
+     * Returns a description of the reasons why the
      * exception may be thrown.
      * @return the description
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/UsesTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,51 @@
+/*
+ * 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 com.sun.source.doctree;
+
+import java.util.List;
+
+/**
+ *
+ * A tree node for an @uses block tag.
+ *
+ * <p>
+ * &#064;uses service-type description
+ *
+ * @since 9
+ */
+public interface UsesTree extends BlockTagTree {
+    /**
+     * Returns the name of the service type being documented.
+     * @return the name of the service type
+     */
+    ReferenceTree getServiceType();
+
+    /**
+     * Returns a description of the use of service type within the module.
+     * @return the description
+     */
+    List<? extends DocTree> getDescription();
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Fri Dec 16 11:58:18 2016 -0800
@@ -49,6 +49,7 @@
 import com.sun.source.doctree.LinkTree;
 import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.ParamTree;
+import com.sun.source.doctree.ProvidesTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.ReturnTree;
 import com.sun.source.doctree.SeeTree;
@@ -61,6 +62,7 @@
 import com.sun.source.doctree.ThrowsTree;
 import com.sun.source.doctree.UnknownBlockTagTree;
 import com.sun.source.doctree.UnknownInlineTagTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.doctree.ValueTree;
 import com.sun.source.doctree.VersionTree;
 
@@ -217,6 +219,14 @@
     ParamTree newParamTree(boolean isTypeParameter, IdentifierTree name, List<? extends DocTree> description);
 
     /**
+     * Create a new {@code ProvidesTree} object, to represent a {@code @provides } tag.
+     * @param name the name of the service type
+     * @param description a description of the service being provided
+     * @return a {@code ProvidesTree} object
+     */
+    ProvidesTree newProvidesTree(ReferenceTree name, List<? extends DocTree> description);
+
+    /**
      * Create a new {@code ReferenceTree} object, to represent a reference to an API element.
      *
      * @param signature the doc comment signature of the reference
@@ -309,6 +319,14 @@
     UnknownInlineTagTree newUnknownInlineTagTree(Name name, List<? extends DocTree> content);
 
     /**
+     * Create a new {@code UsesTree} object, to represent a {@code @uses } tag.
+     * @param name the name of the service type
+     * @param description a description of how the service will be used
+     * @return a {@code UsesTree} object
+     */
+    UsesTree newUsesTree(ReferenceTree name, List<? extends DocTree> description);
+
+    /**
      * Create a new {@code ValueTree} object, to represent a {@code {@value } } tag.
      * @param ref a reference to the value
      * @return a {@code ValueTree} object
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,7 +26,6 @@
 package com.sun.source.util;
 
 import com.sun.source.doctree.*;
-import com.sun.tools.javac.tree.DCTree.DCIndex;
 
 
 /**
@@ -326,6 +325,20 @@
     }
 
     /**
+     * {@inheritDoc} This implementation scans the children in left to right order.
+     *
+     * @param node  {@inheritDoc}
+     * @param p  {@inheritDoc}
+     * @return the result of scanning
+     */
+    @Override
+    public R visitProvides(ProvidesTree node, P p) {
+        R r = scan(node.getServiceType(), p);
+        r = scanAndReduce(node.getDescription(), p, r);
+        return r;
+    }
+
+    /**
      * {@inheritDoc} This implementation returns {@code null}.
      *
      * @param node  {@inheritDoc}
@@ -482,6 +495,20 @@
      * @return the result of scanning
      */
     @Override
+    public R visitUses(UsesTree node, P p) {
+        R r = scan(node.getServiceType(), p);
+        r = scanAndReduce(node.getDescription(), p, r);
+        return r;
+    }
+
+    /**
+     * {@inheritDoc} This implementation scans the children in left to right order.
+     *
+     * @param node  {@inheritDoc}
+     * @param p  {@inheritDoc}
+     * @return the result of scanning
+     */
+    @Override
     public R visitValue(ValueTree node, P p) {
         return scan(node.getReference(), p);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Fri Dec 16 11:58:18 2016 -0800
@@ -210,6 +210,7 @@
      * @param p {@inheritDoc}
      * @return the result of {@code defaultAction}
      */
+    @Override
     public R visitHidden(HiddenTree node, P p) {
         return defaultAction(node, p);
     }
@@ -294,6 +295,18 @@
      * @return  the result of {@code defaultAction}
      */
     @Override
+    public R visitProvides(ProvidesTree node, P p) {
+        return defaultAction(node, p);
+    }
+
+    /**
+     * {@inheritDoc} This implementation calls {@code defaultAction}.
+     *
+     * @param node {@inheritDoc}
+     * @param p {@inheritDoc}
+     * @return  the result of {@code defaultAction}
+     */
+    @Override
     public R visitReference(ReferenceTree node, P p) {
         return defaultAction(node, p);
     }
@@ -438,6 +451,18 @@
      * @return  the result of {@code defaultAction}
      */
     @Override
+    public R visitUses(UsesTree node, P p) {
+        return defaultAction(node, p);
+    }
+
+    /**
+     * {@inheritDoc} This implementation calls {@code defaultAction}.
+     *
+     * @param node {@inheritDoc}
+     * @param p {@inheritDoc}
+     * @return  the result of {@code defaultAction}
+     */
+    @Override
     public R visitValue(ValueTree node, P p) {
         return defaultAction(node, p);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Fri Dec 16 11:58:18 2016 -0800
@@ -63,6 +63,7 @@
 import com.sun.source.doctree.LinkTree;
 import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.ParamTree;
+import com.sun.source.doctree.ProvidesTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.ReturnTree;
 import com.sun.source.doctree.SerialDataTree;
@@ -73,6 +74,7 @@
 import com.sun.source.doctree.ThrowsTree;
 import com.sun.source.doctree.UnknownBlockTagTree;
 import com.sun.source.doctree.UnknownInlineTagTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.doctree.ValueTree;
 import com.sun.source.doctree.VersionTree;
 import com.sun.source.tree.Tree;
@@ -85,6 +87,7 @@
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.StringUtils;
+
 import static com.sun.tools.doclint.Messages.Group.*;
 
 
@@ -131,7 +134,7 @@
         }
     }
 
-    private Deque<TagStackItem> tagStack; // TODO: maybe want to record starting tree as well
+    private final Deque<TagStackItem> tagStack; // TODO: maybe want to record starting tree as well
     private HtmlTag currHeaderTag;
 
     private final int implicitHeaderLevel;
@@ -824,6 +827,20 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitProvides(ProvidesTree tree, Void ignore) {
+        Element e = env.trees.getElement(env.currPath);
+        if (e.getKind() != ElementKind.MODULE) {
+            env.messages.error(REFERENCE, tree, "dc.invalid.provides");
+        }
+        ReferenceTree serviceType = tree.getServiceType();
+        Element se = env.trees.getElement(new DocTreePath(getCurrentPath(), serviceType));
+        if (se == null) {
+            env.messages.error(REFERENCE, tree, "dc.service.not.found");
+        }
+        return super.visitProvides(tree, ignore);
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReference(ReferenceTree tree, Void ignore) {
         String sig = tree.getSignature();
         if (sig.contains("<") || sig.contains(">"))
@@ -938,6 +955,20 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitUses(UsesTree tree, Void ignore) {
+        Element e = env.trees.getElement(env.currPath);
+        if (e.getKind() != ElementKind.MODULE) {
+            env.messages.error(REFERENCE, tree, "dc.invalid.uses");
+        }
+        ReferenceTree serviceType = tree.getServiceType();
+        Element se = env.trees.getElement(new DocTreePath(getCurrentPath(), serviceType));
+        if (se == null) {
+            env.messages.error(REFERENCE, tree, "dc.service.not.found");
+        }
+        return super.visitUses(tree, ignore);
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitValue(ValueTree tree, Void ignore) {
         ReferenceTree ref = tree.getReference();
         if (ref == null || ref.getSignature().isEmpty()) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlTag.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlTag.java	Fri Dec 16 11:58:18 2016 -0800
@@ -556,11 +556,11 @@
     private final Map<Attr,AttrKind> attrs;
 
     HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
-        this(HtmlVersion.ALL, blockType, endKind, Collections.<Flag>emptySet(), attrMaps);
+        this(HtmlVersion.ALL, blockType, endKind, Collections.emptySet(), attrMaps);
     }
 
     HtmlTag(HtmlVersion allowedVersion, BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
-        this(allowedVersion, blockType, endKind, Collections.<Flag>emptySet(), attrMaps);
+        this(allowedVersion, blockType, endKind, Collections.emptySet(), attrMaps);
     }
 
     HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Messages.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Messages.java	Fri Dec 16 11:58:18 2016 -0800
@@ -315,12 +315,7 @@
          */
         private static class Table {
 
-            private static final Comparator<Integer> DECREASING = new Comparator<Integer>() {
-
-                public int compare(Integer o1, Integer o2) {
-                    return o2.compareTo(o1);
-                }
-            };
+            private static final Comparator<Integer> DECREASING = (o1, o2) -> o2.compareTo(o1);
             private final TreeMap<Integer, Set<String>> map = new TreeMap<>(DECREASING);
 
             void put(String label, int n) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Fri Dec 16 11:58:18 2016 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 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,8 +41,10 @@
 dc.exception.not.thrown = exception not thrown: {0}
 dc.invalid.anchor = invalid name for anchor: "{0}"
 dc.invalid.param = invalid use of @param
+dc.invalid.provides = invalid use of @provides
 dc.invalid.return = invalid use of @return
 dc.invalid.throws = invalid use of @throws
+dc.invalid.uses = invalid use of @uses
 dc.invalid.uri = invalid uri: "{0}"
 dc.missing.comment = no comment
 dc.missing.param = no @param for {0}
@@ -52,6 +54,7 @@
 dc.no.summary.or.caption.for.table=no summary or caption for table
 dc.param.name.not.found = @param name not found
 dc.ref.not.found = reference not found
+dc.service.not.found = service-type not found
 dc.tag.code.within.code = '{@code'} within <code>
 dc.tag.empty = empty <{0}> tag
 dc.tag.end.not.permitted = invalid end tag: </{0}>
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -97,15 +97,12 @@
     /* Internal version of call exposing Main.Result. */
     public Main.Result doCall() {
         try {
-            return handleExceptions(new Callable<Main.Result>() {
-                @Override
-                public Main.Result call() throws Exception {
-                    prepareCompiler(false);
-                    if (compiler.errorCount() > 0)
-                        return Main.Result.ERROR;
-                    compiler.compile(args.getFileObjects(), args.getClassNames(), processors);
-                    return (compiler.errorCount() > 0) ? Main.Result.ERROR : Main.Result.OK; // FIXME?
-                }
+            return handleExceptions(() -> {
+                prepareCompiler(false);
+                if (compiler.errorCount() > 0)
+                    return Main.Result.ERROR;
+                compiler.compile(args.getFileObjects(), args.getClassNames(), processors);
+                return (compiler.errorCount() > 0) ? Main.Result.ERROR : Main.Result.OK; // FIXME?
             }, Main.Result.SYSERR, Main.Result.ABNORMAL);
         } finally {
             try {
@@ -228,12 +225,7 @@
 
     @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends CompilationUnitTree> parse() {
-        return handleExceptions(new Callable<Iterable<? extends CompilationUnitTree>>() {
-            @Override
-            public Iterable<? extends CompilationUnitTree> call() {
-                return parseInternal();
-            }
-        }, List.<CompilationUnitTree>nil(), List.<CompilationUnitTree>nil());
+        return handleExceptions(this::parseInternal, List.nil(), List.nil());
     }
 
     private Iterable<? extends CompilationUnitTree> parseInternal() {
@@ -360,12 +352,7 @@
 
     @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends Element> analyze() {
-        return handleExceptions(new Callable<Iterable<? extends Element>>() {
-            @Override
-            public Iterable<? extends Element> call() {
-                return analyze(null);
-            }
-        }, List.<Element>nil(), List.<Element>nil());
+        return handleExceptions(() -> analyze(null), List.nil(), List.nil());
     }
 
     /**
@@ -427,12 +414,7 @@
 
     @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends JavaFileObject> generate() {
-        return handleExceptions(new Callable<Iterable<? extends JavaFileObject>>() {
-            @Override
-            public Iterable<? extends JavaFileObject> call() {
-                return generate(null);
-            }
-        }, List.<JavaFileObject>nil(), List.<JavaFileObject>nil());
+        return handleExceptions(() -> generate(null), List.nil(), List.nil());
     }
 
     /**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Fri Dec 16 11:58:18 2016 -0800
@@ -437,7 +437,7 @@
                 Type t = attr.attribType(ref.qualifierExpression, env);
                 if (t.isErroneous()) {
                     JCCompilationUnit toplevel =
-                        treeMaker.TopLevel(List.<JCTree>nil());
+                        treeMaker.TopLevel(List.nil());
                     final ModuleSymbol msym = modules.getDefaultModule();
                     toplevel.modle = msym;
                     toplevel.packge = msym.unnamedPackage;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -163,12 +163,7 @@
     /**
      * Completer that delegates to the complete-method of this class.
      */
-    private final Completer thisCompleter = new Completer() {
-        @Override
-        public void complete(Symbol sym) throws CompletionFailure {
-            ClassFinder.this.complete(sym);
-        }
-    };
+    private final Completer thisCompleter = this::complete;
 
     public Completer getCompleter() {
         return thisCompleter;
@@ -516,7 +511,7 @@
 
         ModuleSymbol msym = p.modle;
 
-        Assert.checkNonNull(msym, () -> p.toString());
+        Assert.checkNonNull(msym, p::toString);
 
         msym.complete();
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java	Fri Dec 16 11:58:18 2016 -0800
@@ -118,6 +118,7 @@
             if (source.compareTo(Source.JDK1_9) >= 0) {
                 values.add(LintCategory.DEP_ANN);
             }
+            values.add(LintCategory.MODULE);
             values.add(LintCategory.REMOVAL);
         }
 
@@ -205,6 +206,11 @@
         FINALLY("finally"),
 
         /**
+         * Warn about module system related issues.
+         */
+        MODULE("module"),
+
+        /**
          * Warn about issues relating to use of command line options
          */
         OPTIONS("options"),
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Fri Dec 16 11:58:18 2016 -0800
@@ -143,12 +143,7 @@
     /** Returns true iff the given Symbol is in this scope, optionally checking outward scopes.
      */
     public boolean includes(final Symbol sym, LookupKind lookupKind) {
-        return getSymbolsByName(sym.name, new Filter<Symbol>() {
-            @Override
-            public boolean accepts(Symbol t) {
-                return t == sym;
-            }
-        }, lookupKind).iterator().hasNext();
+        return getSymbolsByName(sym.name, t -> t == sym, lookupKind).iterator().hasNext();
     }
 
     /** Returns true iff this scope does not contain any Symbol. Does not inspect outward scopes.
@@ -574,64 +569,56 @@
 
         public Iterable<Symbol> getSymbols(final Filter<Symbol> sf,
                                            final LookupKind lookupKind) {
-            return new Iterable<Symbol>() {
-                public Iterator<Symbol> iterator() {
-                    return new Iterator<Symbol>() {
-                        private ScopeImpl currScope = ScopeImpl.this;
-                        private Scope.Entry currEntry = elems;
-                        private int seenRemoveCount = currScope.removeCount;
-                        {
-                            update();
-                        }
+            return () -> new Iterator<Symbol>() {
+                private ScopeImpl currScope = ScopeImpl.this;
+                private Entry currEntry = elems;
+                private int seenRemoveCount = currScope.removeCount;
+                {
+                    update();
+                }
+
+                public boolean hasNext() {
+                    if (seenRemoveCount != currScope.removeCount &&
+                        currEntry != null &&
+                        !currEntry.scope.includes(currEntry.sym)) {
+                        doNext(); //skip entry that is no longer in the Scope
+                        seenRemoveCount = currScope.removeCount;
+                    }
+                    return currEntry != null;
+                }
 
-                        public boolean hasNext() {
-                            if (seenRemoveCount != currScope.removeCount &&
-                                currEntry != null &&
-                                !currEntry.scope.includes(currEntry.sym)) {
-                                doNext(); //skip entry that is no longer in the Scope
-                                seenRemoveCount = currScope.removeCount;
-                            }
-                            return currEntry != null;
-                        }
+                public Symbol next() {
+                    if (!hasNext()) {
+                        throw new NoSuchElementException();
+                    }
 
-                        public Symbol next() {
-                            if (!hasNext()) {
-                                throw new NoSuchElementException();
-                            }
+                    return doNext();
+                }
+                private Symbol doNext() {
+                    Symbol sym = (currEntry == null ? null : currEntry.sym);
+                    if (currEntry != null) {
+                        currEntry = currEntry.sibling;
+                    }
+                    update();
+                    return sym;
+                }
 
-                            return doNext();
+                private void update() {
+                    skipToNextMatchingEntry();
+                    if (lookupKind == RECURSIVE) {
+                        while (currEntry == null && currScope.next != null) {
+                            currScope = currScope.next;
+                            currEntry = currScope.elems;
+                            seenRemoveCount = currScope.removeCount;
+                            skipToNextMatchingEntry();
                         }
-                        private Symbol doNext() {
-                            Symbol sym = (currEntry == null ? null : currEntry.sym);
-                            if (currEntry != null) {
-                                currEntry = currEntry.sibling;
-                            }
-                            update();
-                            return sym;
-                        }
-
-                        public void remove() {
-                            throw new UnsupportedOperationException();
-                        }
+                    }
+                }
 
-                        private void update() {
-                            skipToNextMatchingEntry();
-                            if (lookupKind == RECURSIVE) {
-                                while (currEntry == null && currScope.next != null) {
-                                    currScope = currScope.next;
-                                    currEntry = currScope.elems;
-                                    seenRemoveCount = currScope.removeCount;
-                                    skipToNextMatchingEntry();
-                                }
-                            }
-                        }
-
-                        void skipToNextMatchingEntry() {
-                            while (currEntry != null && sf != null && !sf.accepts(currEntry.sym)) {
-                                currEntry = currEntry.sibling;
-                            }
-                        }
-                    };
+                void skipToNextMatchingEntry() {
+                    while (currEntry != null && sf != null && !sf.accepts(currEntry.sym)) {
+                        currEntry = currEntry.sibling;
+                    }
                 }
             };
         }
@@ -639,40 +626,36 @@
         public Iterable<Symbol> getSymbolsByName(final Name name,
                                                  final Filter<Symbol> sf,
                                                  final LookupKind lookupKind) {
-            return new Iterable<Symbol>() {
-                public Iterator<Symbol> iterator() {
-                     return new Iterator<Symbol>() {
-                        Scope.Entry currentEntry = lookup(name, sf);
-                        int seenRemoveCount = currentEntry.scope != null ?
-                                currentEntry.scope.removeCount : -1;
+            return () -> new Iterator<Symbol>() {
+               Entry currentEntry = lookup(name, sf);
+               int seenRemoveCount = currentEntry.scope != null ?
+                       currentEntry.scope.removeCount : -1;
 
-                        public boolean hasNext() {
-                            if (currentEntry.scope != null &&
-                                seenRemoveCount != currentEntry.scope.removeCount &&
-                                !currentEntry.scope.includes(currentEntry.sym)) {
-                                doNext(); //skip entry that is no longer in the Scope
-                            }
-                            return currentEntry.scope != null &&
-                                    (lookupKind == RECURSIVE ||
-                                     currentEntry.scope == ScopeImpl.this);
-                        }
-                        public Symbol next() {
-                            if (!hasNext()) {
-                                throw new NoSuchElementException();
-                            }
-                            return doNext();
-                        }
-                        private Symbol doNext() {
-                            Scope.Entry prevEntry = currentEntry;
-                            currentEntry = currentEntry.next(sf);
-                            return prevEntry.sym;
-                        }
-                        public void remove() {
-                            throw new UnsupportedOperationException();
-                        }
-                    };
-                }
-            };
+               public boolean hasNext() {
+                   if (currentEntry.scope != null &&
+                       seenRemoveCount != currentEntry.scope.removeCount &&
+                       !currentEntry.scope.includes(currentEntry.sym)) {
+                       doNext(); //skip entry that is no longer in the Scope
+                   }
+                   return currentEntry.scope != null &&
+                           (lookupKind == RECURSIVE ||
+                            currentEntry.scope == ScopeImpl.this);
+               }
+               public Symbol next() {
+                   if (!hasNext()) {
+                       throw new NoSuchElementException();
+                   }
+                   return doNext();
+               }
+               private Symbol doNext() {
+                   Entry prevEntry = currentEntry;
+                   currentEntry = currentEntry.next(sf);
+                   return prevEntry.sym;
+               }
+               public void remove() {
+                   throw new UnsupportedOperationException();
+               }
+           };
         }
 
         public Scope getOrigin(Symbol s) {
@@ -826,7 +809,7 @@
 
             @Override
             public Iterable<Symbol> getSymbols(Filter<Symbol> sf, LookupKind lookupKind) {
-                return sf == null || sf.accepts(sym) ? content : Collections.<Symbol>emptyList();
+                return sf == null || sf.accepts(sym) ? content : Collections.emptyList();
             }
 
             @Override
@@ -834,7 +817,7 @@
                                                      Filter<Symbol> sf,
                                                      LookupKind lookupKind) {
                 return sym.name == name &&
-                       (sf == null || sf.accepts(sym)) ? content : Collections.<Symbol>emptyList();
+                       (sf == null || sf.accepts(sym)) ? content : Collections.emptyList();
             }
 
             @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Fri Dec 16 11:58:18 2016 -0800
@@ -209,6 +209,9 @@
     public boolean allowPostApplicabilityVarargsAccessCheck() {
         return compareTo(JDK1_8) >= 0;
     }
+    public boolean mapCapturesToBounds() {
+        return compareTo(JDK1_8) < 0;
+    }
     public boolean allowPrivateSafeVarargs() {
         return compareTo(JDK1_9) >= 0;
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Dec 16 11:58:18 2016 -0800
@@ -140,7 +140,7 @@
      */
     public List<Attribute.Compound> getRawAttributes() {
         return (metadata == null)
-                ? List.<Attribute.Compound>nil()
+                ? List.nil()
                 : metadata.getDeclarationAttributes();
     }
 
@@ -150,7 +150,7 @@
      */
     public List<Attribute.TypeCompound> getRawTypeAttributes() {
         return (metadata == null)
-                ? List.<Attribute.TypeCompound>nil()
+                ? List.nil()
                 : metadata.getTypeAttributes();
     }
 
@@ -192,13 +192,13 @@
 
     public List<Attribute.TypeCompound> getClassInitTypeAttributes() {
         return (metadata == null)
-                ? List.<Attribute.TypeCompound>nil()
+                ? List.nil()
                 : metadata.getClassInitTypeAttributes();
     }
 
     public List<Attribute.TypeCompound> getInitTypeAttributes() {
         return (metadata == null)
-                ? List.<Attribute.TypeCompound>nil()
+                ? List.nil()
                 : metadata.getInitTypeAttributes();
     }
 
@@ -212,7 +212,7 @@
 
     public List<Attribute.Compound> getDeclarationAttributes() {
         return (metadata == null)
-                ? List.<Attribute.Compound>nil()
+                ? List.nil()
                 : metadata.getDeclarationAttributes();
     }
 
@@ -925,6 +925,7 @@
 
         public Completer usesProvidesCompleter = Completer.NULL_COMPLETER;
         public final Set<ModuleFlags> flags = EnumSet.noneOf(ModuleFlags.class);
+        public final Set<ModuleResolutionFlags> resolutionFlags = EnumSet.noneOf(ModuleResolutionFlags.class);
 
         /**
          * Create a ModuleSymbol with an associated module-info ClassSymbol.
@@ -1037,7 +1038,26 @@
         }
 
         public final int value;
+    }
 
+    public enum ModuleResolutionFlags {
+        DO_NOT_RESOLVE_BY_DEFAULT(0x0001),
+        WARN_DEPRECATED(0x0002),
+        WARN_DEPRECATED_REMOVAL(0x0004),
+        WARN_INCUBATOR(0x0008);
+
+        public static int value(Set<ModuleResolutionFlags> s) {
+            int v = 0;
+            for (ModuleResolutionFlags f: s)
+                v |= f.value;
+            return v;
+        }
+
+        private ModuleResolutionFlags(int value) {
+            this.value = value;
+        }
+
+        public final int value;
     }
 
     /** A class for package symbols
@@ -1228,7 +1248,7 @@
         public Type erasure(Types types) {
             if (erasure_field == null)
                 erasure_field = new ClassType(types.erasure(type.getEnclosingType()),
-                                              List.<Type>nil(), this,
+                                              List.nil(), this,
                                               type.getMetadata());
             return erasure_field;
         }
@@ -1529,11 +1549,7 @@
                                       final Attr attr,
                                       final JCVariableDecl variable)
         {
-            setData(new Callable<Object>() {
-                public Object call() {
-                    return attr.attribLazyConstantValue(env, variable, type);
-                }
-            });
+            setData((Callable<Object>)() -> attr.attribLazyConstantValue(env, variable, type));
         }
 
         /**
@@ -1836,12 +1852,8 @@
             return implementation(origin, types, checkResult, implementation_filter);
         }
         // where
-            public static final Filter<Symbol> implementation_filter = new Filter<Symbol>() {
-                public boolean accepts(Symbol s) {
-                    return s.kind == MTH &&
-                            (s.flags() & SYNTHETIC) == 0;
-                }
-            };
+            public static final Filter<Symbol> implementation_filter = s ->
+                    s.kind == MTH && (s.flags() & SYNTHETIC) == 0;
 
         public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult, Filter<Symbol> implFilter) {
             MethodSymbol res = types.implementation(this, origin, checkResult, implFilter);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/SymbolMetadata.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/SymbolMetadata.java	Fri Dec 16 11:58:18 2016 -0800
@@ -72,19 +72,19 @@
      * Type attributes for this symbol.
      * This field should never be null.
      */
-    private List<Attribute.TypeCompound> type_attributes = List.<Attribute.TypeCompound>nil();
+    private List<Attribute.TypeCompound> type_attributes = List.nil();
 
     /*
      * Type attributes of initializers in this class.
      * Unused if the current symbol is not a ClassSymbol.
      */
-    private List<Attribute.TypeCompound> init_type_attributes = List.<Attribute.TypeCompound>nil();
+    private List<Attribute.TypeCompound> init_type_attributes = List.nil();
 
     /*
      * Type attributes of class initializers in this class.
      * Unused if the current symbol is not a ClassSymbol.
      */
-    private List<Attribute.TypeCompound> clinit_type_attributes = List.<Attribute.TypeCompound>nil();
+    private List<Attribute.TypeCompound> clinit_type_attributes = List.nil();
 
     /*
      * The Symbol this SymbolMetadata instance belongs to
@@ -248,7 +248,7 @@
 
     private List<Attribute.Compound> filterDeclSentinels(List<Attribute.Compound> a) {
         return (a == DECL_IN_PROGRESS || a == DECL_NOT_STARTED)
-                ? List.<Attribute.Compound>nil()
+                ? List.nil()
                 : a;
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Dec 16 11:58:18 2016 -0800
@@ -309,14 +309,14 @@
                     MethodSymbol boxMethod =
                         new MethodSymbol(PUBLIC | STATIC, names.valueOf,
                                          new MethodType(List.of(type), sym.type,
-                                List.<Type>nil(), methodClass),
+                                List.nil(), methodClass),
                             sym);
                     sym.members().enter(boxMethod);
                     MethodSymbol unboxMethod =
                         new MethodSymbol(PUBLIC,
                             type.tsym.name.append(names.Value), // x.intValue()
-                            new MethodType(List.<Type>nil(), type,
-                                List.<Type>nil(), methodClass),
+                            new MethodType(List.nil(), type,
+                                List.nil(), methodClass),
                             sym);
                     sym.members().enter(unboxMethod);
                 }
@@ -514,8 +514,8 @@
         enumFinalFinalize =
             new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL,
                              names.finalize,
-                             new MethodType(List.<Type>nil(), voidType,
-                                            List.<Type>nil(), methodClass),
+                             new MethodType(List.nil(), voidType,
+                                            List.nil(), methodClass),
                              enumSym);
         listType = enterClass("java.util.List");
         collectionsType = enterClass("java.util.Collections");
@@ -538,7 +538,7 @@
         autoCloseableType = enterClass("java.lang.AutoCloseable");
         autoCloseableClose = new MethodSymbol(PUBLIC,
                              names.close,
-                             new MethodType(List.<Type>nil(), voidType,
+                             new MethodType(List.nil(), voidType,
                                             List.of(exceptionType), methodClass),
                              autoCloseableType.tsym);
         trustMeType = enterClass("java.lang.SafeVarargs");
@@ -584,13 +584,13 @@
         arrayCloneMethod = new MethodSymbol(
             PUBLIC,
             names.clone,
-            new MethodType(List.<Type>nil(), objectType,
-                           List.<Type>nil(), methodClass),
+            new MethodType(List.nil(), objectType,
+                           List.nil(), methodClass),
             arrayClass);
         arrayClass.members().enter(arrayCloneMethod);
 
         if (java_base != noModule)
-            java_base.completer = sym -> moduleCompleter.complete(sym); //bootstrap issues
+            java_base.completer = moduleCompleter::complete; //bootstrap issues
 
     }
 
@@ -624,7 +624,7 @@
     }
 
     public ClassSymbol getClass(ModuleSymbol msym, Name flatName) {
-        Assert.checkNonNull(msym, () -> flatName.toString());
+        Assert.checkNonNull(msym, flatName::toString);
         return classes.getOrDefault(flatName, Collections.emptyMap()).get(msym);
     }
 
@@ -757,7 +757,8 @@
                 }
             };
         unnamedPackage.modle = module;
-        unnamedPackage.completer = sym -> initialCompleter.complete(sym);
+        //we cannot use a method reference below, as initialCompleter might be null now
+        unnamedPackage.completer = s -> initialCompleter.complete(s);
         module.unnamedPackage = unnamedPackage;
     }
 
@@ -770,7 +771,7 @@
         if (msym == null) {
             msym = ModuleSymbol.create(name, names.module_info);
             addRootPackageFor(msym);
-            msym.completer = sym -> moduleCompleter.complete(sym); //bootstrap issues
+            msym.completer = s -> moduleCompleter.complete(s); //bootstrap issues
             modules.put(name, msym);
         }
         return msym;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1164,7 +1164,7 @@
     public static class ErasedClassType extends ClassType {
         public ErasedClassType(Type outer, TypeSymbol tsym,
                                TypeMetadata metadata) {
-            super(outer, List.<Type>nil(), tsym, metadata);
+            super(outer, List.nil(), tsym, metadata);
         }
 
         @Override
@@ -1235,7 +1235,7 @@
         public IntersectionClassType(List<Type> bounds, ClassSymbol csym, boolean allInterfaces) {
             // Presently no way to refer to this type directly, so we
             // cannot put annotations directly on it.
-            super(Type.noType, List.<Type>nil(), csym);
+            super(Type.noType, List.nil(), csym);
             this.allInterfaces = allInterfaces;
             Assert.check((csym.flags() & COMPOUND) != 0);
             supertype_field = bounds.head;
@@ -2082,6 +2082,21 @@
 
         /** add a bound of a given kind - this might trigger listener notification */
         public final void addBound(InferenceBound ib, Type bound, Types types) {
+            // Per JDK-8075793: in pre-8 sources, follow legacy javac behavior
+            // when capture variables are inferred as bounds: for lower bounds,
+            // map to the capture variable's upper bound; for upper bounds,
+            // if the capture variable has a lower bound, map to that type
+            if (types.mapCapturesToBounds) {
+                switch (ib) {
+                    case LOWER:
+                        bound = types.cvarUpperBound(bound);
+                        break;
+                    case UPPER:
+                        Type altBound = types.cvarLowerBound(bound);
+                        if (!altBound.hasTag(TypeTag.BOT)) bound = altBound;
+                        break;
+                }
+            }
             addBound(ib, bound, types, false);
         }
 
@@ -2123,11 +2138,9 @@
             UndetVarListener prevListener = listener;
             try {
                 //setup new listener for keeping track of changed bounds
-                listener = new UndetVarListener() {
-                    public void varBoundChanged(UndetVar uv, InferenceBound ib, Type t, boolean _ignored) {
-                        Assert.check(uv == UndetVar.this);
-                        boundsChanged.add(new Pair<>(ib, t));
-                    }
+                listener = (uv, ib, t, _ignored) -> {
+                    Assert.check(uv == UndetVar.this);
+                    boundsChanged.add(new Pair<>(ib, t));
                 };
                 for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
                     InferenceBound ib = _entry.getKey();
@@ -2303,14 +2316,14 @@
         }
 
         public ErrorType(Type originalType, TypeSymbol tsym) {
-            super(noType, List.<Type>nil(), null);
+            super(noType, List.nil(), null);
             this.tsym = tsym;
             this.originalType = (originalType == null ? noType : originalType);
         }
 
         private ErrorType(Type originalType, TypeSymbol tsym,
                           TypeMetadata metadata) {
-            super(noType, List.<Type>nil(), null, metadata);
+            super(noType, List.nil(), null, metadata);
             this.tsym = tsym;
             this.originalType = (originalType == null ? noType : originalType);
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Fri Dec 16 11:58:18 2016 -0800
@@ -88,6 +88,7 @@
     final Names names;
     final boolean allowObjectToPrimitiveCast;
     final boolean allowDefaultMethods;
+    final boolean mapCapturesToBounds;
     final Check chk;
     final Enter enter;
     JCDiagnostic.Factory diags;
@@ -112,6 +113,7 @@
         Source source = Source.instance(context);
         allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
         allowDefaultMethods = source.allowDefaultMethods();
+        mapCapturesToBounds = source.mapCapturesToBounds();
         chk = Check.instance(context);
         enter = Enter.instance(context);
         capturedName = names.fromString("<captured wildcard>");
@@ -586,7 +588,7 @@
         csym.members_field = WriteableScope.create(csym);
         MethodSymbol instDescSym = new MethodSymbol(descSym.flags(), descSym.name, descType, csym);
         csym.members_field.enter(instDescSym);
-        Type.ClassType ctype = new Type.ClassType(Type.noType, List.<Type>nil(), csym);
+        Type.ClassType ctype = new Type.ClassType(Type.noType, List.nil(), csym);
         ctype.supertype_field = syms.objectType;
         ctype.interfaces_field = targets;
         csym.type = ctype;
@@ -3160,7 +3162,7 @@
                                      t.getMetadata());
             // the new bound should use the new type variable in place
             // of the old
-            tv.bound = subst(bound1, List.<Type>of(t), List.<Type>of(tv));
+            tv.bound = subst(bound1, List.of(t), List.of(tv));
             return tv;
         }
     }
@@ -3760,7 +3762,7 @@
                 List<Type> lci = List.of(asSuper(ts[startIdx], erasedSupertype.tsym));
                 for (int i = startIdx + 1 ; i < ts.length ; i++) {
                     Type superType = asSuper(ts[i], erasedSupertype.tsym);
-                    lci = intersect(lci, superType != null ? List.of(superType) : List.<Type>nil());
+                    lci = intersect(lci, superType != null ? List.of(superType) : List.nil());
                 }
                 candidates = candidates.appendList(lci);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Dec 16 11:58:18 2016 -0800
@@ -484,7 +484,7 @@
         JCIdent left = (JCIdent)assign.lhs;
         Symbol method = resolve.resolveQualifiedMethod(elidedValue ? assign.rhs.pos() : left.pos(),
                 env, thisAnnotationType,
-                left.name, List.<Type>nil(), null);
+                left.name, List.nil(), null);
         left.sym = method;
         left.type = method.type;
         if (method.owner != thisAnnotationType.tsym && !badAnnotation)
@@ -626,7 +626,7 @@
         // Special case, implicit array
         if (!tree.hasTag(NEWARRAY)) {
             tree = make.at(tree.pos).
-                    NewArray(null, List.<JCExpression>nil(), List.of(tree));
+                    NewArray(null, List.nil(), List.of(tree));
         }
 
         JCNewArray na = (JCNewArray)tree;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1052,8 +1052,8 @@
                             !TreeInfo.isSelfCall(body.stats.head)) {
                         body.stats = body.stats.
                                 prepend(typeEnter.SuperCall(make.at(body.pos),
-                                        List.<Type>nil(),
-                                        List.<JCVariableDecl>nil(),
+                                        List.nil(),
+                                        List.nil(),
                                         false));
                     } else if ((env.enclClass.sym.flags() & ENUM) != 0 &&
                             (tree.mods.flags & GENERATEDCONSTR) == 0 &&
@@ -1453,8 +1453,8 @@
                         env,
                         types.skipTypeVars(resource, false),
                         names.close,
-                        List.<Type>nil(),
-                        List.<Type>nil());
+                        List.nil(),
+                        List.nil());
             }
             finally {
                 log.popDiagnosticHandler(discardHandler);
@@ -1915,7 +1915,7 @@
                     argtypes.isEmpty()) {
                 // as a special case, x.getClass() has type Class<? extends |X|>
                 return new ClassType(restype.getEnclosingType(),
-                        List.<Type>of(new WildcardType(types.erasure(qualifierType),
+                        List.of(new WildcardType(types.erasure(qualifierType),
                                 BoundKind.EXTENDS,
                                 syms.boundClass)),
                         restype.tsym,
@@ -1953,7 +1953,7 @@
         /** Obtain a method type with given argument types.
          */
         Type newMethodTemplate(Type restype, List<Type> argtypes, List<Type> typeargtypes) {
-            MethodType mt = new MethodType(argtypes, restype, List.<Type>nil(), syms.methodClass);
+            MethodType mt = new MethodType(argtypes, restype, List.nil(), syms.methodClass);
             return (typeargtypes == null) ? mt : (Type)new ForAll(typeargtypes, mt);
         }
 
@@ -2635,7 +2635,7 @@
                     return new MethodType(argtypes, Type.recoveryType,
                             List.of(syms.throwableType), syms.methodClass);
                 case REFERENCE:
-                    return new MethodType(List.<Type>nil(), Type.recoveryType,
+                    return new MethodType(List.nil(), Type.recoveryType,
                             List.of(syms.throwableType), syms.methodClass);
                 default:
                     Assert.error("Cannot get here!");
@@ -2651,12 +2651,8 @@
         private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env,
                 final InferenceContext inferenceContext, final List<Type> ts) {
             if (inferenceContext.free(ts)) {
-                inferenceContext.addFreeTypeListener(ts, new FreeTypeListener() {
-                    @Override
-                    public void typesInferred(InferenceContext inferenceContext) {
-                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts));
-                    }
-                });
+                inferenceContext.addFreeTypeListener(ts,
+                        solvedContext -> checkAccessibleTypes(pos, env, solvedContext, solvedContext.asInstTypes(ts)));
             } else {
                 for (Type t : ts) {
                     rs.checkAccessibleType(env, t);
@@ -2801,11 +2797,11 @@
                      */
                     MethodSymbol clinit = clinits.get(enclClass);
                     if (clinit == null) {
-                        Type clinitType = new MethodType(List.<Type>nil(),
-                                syms.voidType, List.<Type>nil(), syms.methodClass);
+                        Type clinitType = new MethodType(List.nil(),
+                                syms.voidType, List.nil(), syms.methodClass);
                         clinit = new MethodSymbol(STATIC | SYNTHETIC | PRIVATE,
                                 names.clinit, clinitType, enclClass);
-                        clinit.params = List.<VarSymbol>nil();
+                        clinit.params = List.nil();
                         clinits.put(enclClass, clinit);
                     }
                     newScopeOwner = clinit;
@@ -3094,12 +3090,9 @@
     private void setFunctionalInfo(final Env<AttrContext> env, final JCFunctionalExpression fExpr,
             final Type pt, final Type descriptorType, final Type primaryTarget, final CheckContext checkContext) {
         if (checkContext.inferenceContext().free(descriptorType)) {
-            checkContext.inferenceContext().addFreeTypeListener(List.of(pt, descriptorType), new FreeTypeListener() {
-                public void typesInferred(InferenceContext inferenceContext) {
-                    setFunctionalInfo(env, fExpr, pt, inferenceContext.asInstType(descriptorType),
-                            inferenceContext.asInstType(primaryTarget), checkContext);
-                }
-            });
+            checkContext.inferenceContext().addFreeTypeListener(List.of(pt, descriptorType),
+                    inferenceContext -> setFunctionalInfo(env, fExpr, pt, inferenceContext.asInstType(descriptorType),
+                    inferenceContext.asInstType(primaryTarget), checkContext));
         } else {
             ListBuffer<Type> targets = new ListBuffer<>();
             if (pt.hasTag(CLASS)) {
@@ -3723,7 +3716,7 @@
                             normOuter = types.erasure(ownOuter);
                         if (normOuter != ownOuter)
                             owntype = new ClassType(
-                                normOuter, List.<Type>nil(), owntype.tsym,
+                                normOuter, List.nil(), owntype.tsym,
                                 owntype.getMetadata());
                     }
                 }
@@ -4224,8 +4217,8 @@
             }
             JCClassDecl cd = make.at(tree).ClassDef(
                 make.Modifiers(PUBLIC | ABSTRACT),
-                names.empty, List.<JCTypeParameter>nil(),
-                extending, implementing, List.<JCTree>nil());
+                names.empty, List.nil(),
+                extending, implementing, List.nil());
 
             ClassSymbol c = (ClassSymbol)owntype.tsym;
             Assert.check((c.flags() & COMPOUND) != 0);
@@ -4444,7 +4437,7 @@
         ModuleSymbol msym = tree.sym;
         Lint lint = env.outer.info.lint = env.outer.info.lint.augment(msym);
         Lint prevLint = chk.setLint(lint);
-
+        chk.checkModuleName(tree);
         chk.checkDeprecatedAnnotation(tree, msym);
 
         try {
@@ -4574,13 +4567,8 @@
             }
         }
 
-        public static final Filter<Symbol> anyNonAbstractOrDefaultMethod = new Filter<Symbol>() {
-            @Override
-            public boolean accepts(Symbol s) {
-                return s.kind == MTH &&
-                       (s.flags() & (DEFAULT | ABSTRACT)) != ABSTRACT;
-            }
-        };
+        public static final Filter<Symbol> anyNonAbstractOrDefaultMethod = s ->
+                s.kind == MTH && (s.flags() & (DEFAULT | ABSTRACT)) != ABSTRACT;
 
         /** get a diagnostic position for an attribute of Type t, or null if attribute missing */
         private DiagnosticPosition getDiagnosticPosition(JCClassDecl tree, Type t) {
@@ -4907,8 +4895,8 @@
                 if (prim.typetag == VOID)
                     restype = syms.voidType;
             }
-            return new MethodType(List.<Type>nil(), restype,
-                                  List.<Type>nil(), syms.methodClass);
+            return new MethodType(List.nil(), restype,
+                                  List.nil(), syms.methodClass);
         }
         private Type dummyMethodType() {
             return dummyMethodType(null);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Fri Dec 16 11:58:18 2016 -0800
@@ -565,12 +565,8 @@
     Type checkType(final DiagnosticPosition pos, final Type found, final Type req, final CheckContext checkContext) {
         final InferenceContext inferenceContext = checkContext.inferenceContext();
         if (inferenceContext.free(req) || inferenceContext.free(found)) {
-            inferenceContext.addFreeTypeListener(List.of(req, found), new FreeTypeListener() {
-                @Override
-                public void typesInferred(InferenceContext inferenceContext) {
-                    checkType(pos, inferenceContext.asInstType(found), inferenceContext.asInstType(req), checkContext);
-                }
-            });
+            inferenceContext.addFreeTypeListener(List.of(req, found),
+                    solvedContext -> checkType(pos, solvedContext.asInstType(found), solvedContext.asInstType(req), checkContext));
         }
         if (req.hasTag(ERROR))
             return req;
@@ -614,13 +610,10 @@
                 && types.isSameType(tree.expr.type, tree.clazz.type)
                 && !(ignoreAnnotatedCasts && TreeInfo.containsTypeAnnotation(tree.clazz))
                 && !is292targetTypeCast(tree)) {
-            deferredLintHandler.report(new DeferredLintHandler.LintLogger() {
-                @Override
-                public void report() {
-                    if (lint.isEnabled(Lint.LintCategory.CAST))
-                        log.warning(Lint.LintCategory.CAST,
-                                tree.pos(), "redundant.cast", tree.clazz.type);
-                }
+            deferredLintHandler.report(() -> {
+                if (lint.isEnabled(LintCategory.CAST))
+                    log.warning(LintCategory.CAST,
+                            tree.pos(), "redundant.cast", tree.clazz.type);
             });
         }
     }
@@ -953,11 +946,8 @@
         // System.out.println("method : " + owntype);
         // System.out.println("actuals: " + argtypes);
         if (inferenceContext.free(mtype)) {
-            inferenceContext.addFreeTypeListener(List.of(mtype), new FreeTypeListener() {
-                public void typesInferred(InferenceContext inferenceContext) {
-                    checkMethod(inferenceContext.asInstType(mtype), sym, env, argtrees, argtypes, useVarargs, inferenceContext);
-                }
-            });
+            inferenceContext.addFreeTypeListener(List.of(mtype),
+                    solvedContext -> checkMethod(solvedContext.asInstType(mtype), sym, env, argtrees, argtypes, useVarargs, solvedContext));
             return mtype;
         }
         Type owntype = mtype;
@@ -2070,13 +2060,8 @@
         }
     }
 
-    private Filter<Symbol> equalsHasCodeFilter = new Filter<Symbol>() {
-        public boolean accepts(Symbol s) {
-            return MethodSymbol.implementation_filter.accepts(s) &&
-                    (s.flags() & BAD_OVERRIDE) == 0;
-
-        }
-    };
+    private Filter<Symbol> equalsHasCodeFilter = s -> MethodSymbol.implementation_filter.accepts(s) &&
+            (s.flags() & BAD_OVERRIDE) == 0;
 
     public void checkClassOverrideEqualsAndHashIfNeeded(DiagnosticPosition pos,
             ClassSymbol someClass) {
@@ -2116,6 +2101,18 @@
         }
     }
 
+    public void checkModuleName (JCModuleDecl tree) {
+        Name moduleName = tree.sym.name;
+        Assert.checkNonNull(moduleName);
+        if (lint.isEnabled(LintCategory.MODULE)) {
+            String moduleNameString = moduleName.toString();
+            int nameLength = moduleNameString.length();
+            if (nameLength > 0 && Character.isDigit(moduleNameString.charAt(nameLength - 1))) {
+                log.warning(Lint.LintCategory.MODULE, tree.qualId.pos(), Warnings.PoorChoiceForModuleName(moduleName));
+            }
+        }
+    }
+
     private boolean checkNameClash(ClassSymbol origin, Symbol s1, Symbol s2) {
         ClashFilter cf = new ClashFilter(origin.type);
         return (cf.accepts(s1) &&
@@ -2166,7 +2163,7 @@
                         log.useSource(prevSource.getFile());
                     }
                 } else if (sym.kind == TYP) {
-                    checkClass(pos, sym, List.<JCTree>nil());
+                    checkClass(pos, sym, List.nil());
                 }
             } else {
                 //not completed yet
@@ -2258,7 +2255,7 @@
 
 
     void checkNonCyclic(DiagnosticPosition pos, TypeVar t) {
-        checkNonCyclic1(pos, t, List.<TypeVar>nil());
+        checkNonCyclic1(pos, t, List.nil());
     }
 
     private void checkNonCyclic1(DiagnosticPosition pos, Type t, List<TypeVar> seen) {
@@ -3254,12 +3251,7 @@
         if ( (s.isDeprecatedForRemoval()
                 || s.isDeprecated() && !other.isDeprecated())
                 && (s.outermostClass() != other.outermostClass() || s.outermostClass() == null)) {
-            deferredLintHandler.report(new DeferredLintHandler.LintLogger() {
-                @Override
-                public void report() {
-                    warnDeprecated(pos, s);
-                }
-            });
+            deferredLintHandler.report(() -> warnDeprecated(pos, s));
         }
     }
 
@@ -3398,12 +3390,7 @@
             int opc = ((OperatorSymbol)operator).opcode;
             if (opc == ByteCodes.idiv || opc == ByteCodes.imod
                 || opc == ByteCodes.ldiv || opc == ByteCodes.lmod) {
-                deferredLintHandler.report(new DeferredLintHandler.LintLogger() {
-                    @Override
-                    public void report() {
-                        warnDivZero(pos);
-                    }
-                });
+                deferredLintHandler.report(() -> warnDivZero(pos));
             }
         }
     }
@@ -3877,4 +3864,14 @@
                 log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleNotRequiredTransitive(kindName(what), what, what.packge().modle));
             }
         }
+
+    void checkModuleExists(final DiagnosticPosition pos, ModuleSymbol msym) {
+        if (msym.kind != MDL) {
+            deferredLintHandler.report(() -> {
+                if (lint.isEnabled(LintCategory.MODULE))
+                    log.warning(LintCategory.MODULE, pos, Warnings.ModuleNotFound(msym));
+            });
+        }
+    }
+
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Dec 16 11:58:18 2016 -0800
@@ -507,12 +507,10 @@
             }
 
             DeferredAttrDiagHandler(Log log, JCTree newTree) {
-                super(log, new Filter<JCDiagnostic>() {
-                    public boolean accepts(JCDiagnostic d) {
-                        PosScanner posScanner = new PosScanner(d.getDiagnosticPosition());
-                        posScanner.scan(newTree);
-                        return posScanner.found;
-                    }
+                super(log, d -> {
+                    PosScanner posScanner = new PosScanner(d.getDiagnosticPosition());
+                    posScanner.scan(newTree);
+                    return posScanner.found;
                 });
             }
         }
@@ -1008,11 +1006,7 @@
         final Filter<JCTree> treeFilter;
 
         FilterScanner(final Set<JCTree.Tag> validTags) {
-            this.treeFilter = new Filter<JCTree>() {
-                public boolean accepts(JCTree t) {
-                    return validTags.contains(t.getTag());
-                }
-            };
+            this.treeFilter = t -> validTags.contains(t.getTag());
         }
 
         @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -130,10 +130,10 @@
         predefClassDef = make.ClassDef(
             make.Modifiers(PUBLIC),
             syms.predefClass.name,
-            List.<JCTypeParameter>nil(),
+            List.nil(),
             null,
-            List.<JCExpression>nil(),
-            List.<JCTree>nil());
+            List.nil(),
+            List.nil());
         predefClassDef.sym = syms.predefClass;
         todo = Todo.instance(context);
         fileManager = context.get(JavaFileManager.class);
@@ -415,7 +415,7 @@
                 if (c.owner != owner) {
                     //anonymous class loaded from a classfile may be recreated from source (see below)
                     //if this class is a member of such an anonymous class, fix the owner:
-                    Assert.check(owner.owner.kind != TYP, () -> owner.toString());
+                    Assert.check(owner.owner.kind != TYP, owner::toString);
                     Assert.check(c.owner.kind == TYP, () -> c.owner.toString());
                     ClassSymbol cowner = (ClassSymbol) c.owner;
                     if (cowner.members_field != null) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1092,8 +1092,8 @@
                                 attrEnv,
                                 types.skipTypeVars(sup, false),
                                 names.close,
-                                List.<Type>nil(),
-                                List.<Type>nil());
+                                List.nil(),
+                                List.nil());
                         Type mt = types.memberType(resource.type, closeMethod);
                         if (closeMethod.kind == MTH) {
                             for (Type t : mt.getThrownTypes()) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Dec 16 11:58:18 2016 -0800
@@ -120,7 +120,7 @@
         dependenciesFolder = options.get("debug.dumpInferenceGraphsTo");
         pendingGraphs = List.nil();
 
-        emptyContext = new InferenceContext(this, List.<Type>nil());
+        emptyContext = new InferenceContext(this, List.nil());
     }
 
     /** A value for prototypes that admit any type, including polymorphic ones. */
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java	Fri Dec 16 11:58:18 2016 -0800
@@ -123,11 +123,7 @@
      * inference context
      */
     List<Type> restvars() {
-        return filterVars(new Filter<UndetVar>() {
-            public boolean accepts(UndetVar uv) {
-                return uv.getInst() == null;
-            }
-        });
+        return filterVars(uv -> uv.getInst() == null);
     }
 
     /**
@@ -135,11 +131,7 @@
      * inference context
      */
     List<Type> instvars() {
-        return filterVars(new Filter<UndetVar>() {
-            public boolean accepts(UndetVar uv) {
-                return uv.getInst() != null;
-            }
-        });
+        return filterVars(uv -> uv.getInst() != null);
     }
 
     /**
@@ -147,13 +139,9 @@
      * declared bounds).
      */
     final List<Type> boundedVars() {
-        return filterVars(new Filter<UndetVar>() {
-            public boolean accepts(UndetVar uv) {
-                return uv.getBounds(InferenceBound.UPPER)
-                         .diff(uv.getDeclaredBounds())
-                         .appendList(uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)).nonEmpty();
-            }
-        });
+        return filterVars(uv -> uv.getBounds(InferenceBound.UPPER)
+                 .diff(uv.getDeclaredBounds())
+                 .appendList(uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)).nonEmpty());
     }
 
     /* Returns the corresponding inference variables.
@@ -341,11 +329,7 @@
         //set up listeners to notify original inference contexts as
         //propagated vars are inferred in new context
         for (Type t : inferencevars) {
-            that.freeTypeListeners.put(new FreeTypeListener() {
-                public void typesInferred(InferenceContext inferenceContext) {
-                    InferenceContext.this.notifyChange();
-                }
-            }, List.of(t));
+            that.freeTypeListeners.put(inferenceContext -> InferenceContext.this.notifyChange(), List.of(t));
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Dec 16 11:58:18 2016 -0800
@@ -179,7 +179,7 @@
             appendedMethodList = new ListBuffer<>();
             deserializeCases = new HashMap<>();
             MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
-                    List.<Type>nil(), syms.methodClass);
+                    List.nil(), syms.methodClass);
             deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, clazz.sym);
             deserParamSym = new VarSymbol(FINAL, names.fromString("lambda"),
                     syms.serializedLambdaType, deserMethodSym);
@@ -310,10 +310,10 @@
         JCMethodDecl lambdaDecl = make.MethodDef(make.Modifiers(sym.flags_field),
                 sym.name,
                 make.QualIdent(lambdaType.getReturnType().tsym),
-                List.<JCTypeParameter>nil(),
+                List.nil(),
                 localContext.syntheticParams,
                 lambdaType.getThrownTypes() == null ?
-                    List.<JCExpression>nil() :
+                    List.nil() :
                     make.Types(lambdaType.getThrownTypes()),
                 null,
                 null);
@@ -447,7 +447,7 @@
                 throw new InternalError("Should not have an invalid kind");
         }
 
-        List<JCExpression> indy_args = init==null? List.<JCExpression>nil() : translate(List.of(init), localContext.prev);
+        List<JCExpression> indy_args = init==null? List.nil() : translate(List.of(init), localContext.prev);
 
 
         //build a sam instance using an indy call to the meta-factory
@@ -556,7 +556,7 @@
                 //target is void:
                 // BODY;
                 JCStatement stat = make.at(expr).Exec(expr);
-                return make.Block(0, List.<JCStatement>of(stat));
+                return make.Block(0, List.of(stat));
             } else if (isLambda_void && isTarget_Void) {
                 //void to Void conversion:
                 // BODY; return null;
@@ -568,7 +568,7 @@
                 //non-void to non-void conversion:
                 // return (TYPE)BODY;
                 JCExpression retExpr = transTypes.coerce(attrEnv, expr, restype);
-                return make.at(retExpr).Block(0, List.<JCStatement>of(make.Return(retExpr)));
+                return make.at(retExpr).Block(0, List.of(make.Return(retExpr)));
             }
         } finally {
             make.at(prevPos);
@@ -602,7 +602,7 @@
                     // { TYPE $loc = RET-EXPR; return; }
                     VarSymbol loc = makeSyntheticVar(0, names.fromString("$loc"), tree.expr.type, lambdaMethodDecl.sym);
                     JCVariableDecl varDef = make.VarDef(loc, tree.expr);
-                    result = make.Block(0, List.<JCStatement>of(varDef, make.Return(null)));
+                    result = make.Block(0, List.of(varDef, make.Return(null)));
                 } else if (!isTarget_void || !isLambda_void) {
                     //non-void to non-void conversion:
                     // return (TYPE)RET-EXPR;
@@ -637,17 +637,17 @@
         for (JCBreak br : breaks) {
             br.target = sw;
         }
-        JCBlock body = make.Block(0L, List.<JCStatement>of(
+        JCBlock body = make.Block(0L, List.of(
                 sw,
                 make.Throw(makeNewClass(
                     syms.illegalArgumentExceptionType,
-                    List.<JCExpression>of(make.Literal("Invalid lambda deserialization"))))));
+                    List.of(make.Literal("Invalid lambda deserialization"))))));
         JCMethodDecl deser = make.MethodDef(make.Modifiers(kInfo.deserMethodSym.flags()),
                         names.deserializeLambda,
                         make.QualIdent(kInfo.deserMethodSym.getReturnType().tsym),
-                        List.<JCTypeParameter>nil(),
+                        List.nil(),
                         List.of(make.VarDef(kInfo.deserParamSym, null)),
-                        List.<JCExpression>nil(),
+                        List.nil(),
                         body,
                         null);
         deser.sym = kInfo.deserMethodSym;
@@ -675,7 +675,7 @@
      */
     JCNewClass makeNewClass(Type ctype, List<JCExpression> args) {
         return makeNewClass(ctype, args,
-                rs.resolveConstructor(null, attrEnv, ctype, TreeInfo.types(args), List.<Type>nil()));
+                rs.resolveConstructor(null, attrEnv, ctype, TreeInfo.types(args), List.nil()));
      }
 
     private void addDeserializationCase(int implMethodKind, Symbol refSym, Type targetType, MethodSymbol samSym,
@@ -736,12 +736,12 @@
     }
 
     private JCExpression deserTest(JCExpression prev, String func, String lit) {
-        MethodType eqmt = new MethodType(List.of(syms.objectType), syms.booleanType, List.<Type>nil(), syms.methodClass);
-        Symbol eqsym = rs.resolveQualifiedMethod(null, attrEnv, syms.objectType, names.equals, List.of(syms.objectType), List.<Type>nil());
+        MethodType eqmt = new MethodType(List.of(syms.objectType), syms.booleanType, List.nil(), syms.methodClass);
+        Symbol eqsym = rs.resolveQualifiedMethod(null, attrEnv, syms.objectType, names.equals, List.of(syms.objectType), List.nil());
         JCMethodInvocation eqtest = make.Apply(
-                List.<JCExpression>nil(),
+                List.nil(),
                 make.Select(deserGetter(func, syms.stringType), eqsym).setType(eqmt),
-                List.<JCExpression>of(make.Literal(lit)));
+                List.of(make.Literal(lit)));
         eqtest.setType(syms.booleanType);
         JCBinary compound = make.Binary(JCTree.Tag.AND, prev, eqtest);
         compound.operator = operators.resolveBinary(compound, JCTree.Tag.AND, syms.booleanType, syms.booleanType);
@@ -750,14 +750,14 @@
     }
 
     private JCExpression deserGetter(String func, Type type) {
-        return deserGetter(func, type, List.<Type>nil(), List.<JCExpression>nil());
+        return deserGetter(func, type, List.nil(), List.nil());
     }
 
     private JCExpression deserGetter(String func, Type type, List<Type> argTypes, List<JCExpression> args) {
-        MethodType getmt = new MethodType(argTypes, type, List.<Type>nil(), syms.methodClass);
-        Symbol getsym = rs.resolveQualifiedMethod(null, attrEnv, syms.serializedLambdaType, names.fromString(func), argTypes, List.<Type>nil());
+        MethodType getmt = new MethodType(argTypes, type, List.nil(), syms.methodClass);
+        Symbol getsym = rs.resolveQualifiedMethod(null, attrEnv, syms.serializedLambdaType, names.fromString(func), argTypes, List.nil());
         return make.Apply(
-                    List.<JCExpression>nil(),
+                    List.nil(),
                     make.Select(make.Ident(kInfo.deserParamSym).setType(syms.serializedLambdaType), getsym).setType(getmt),
                     args).setType(type);
     }
@@ -961,7 +961,7 @@
             select.type = tree.sym.erasure(types);
 
             //create the method call expression
-            JCExpression apply = make.Apply(List.<JCExpression>nil(), select,
+            JCExpression apply = make.Apply(List.nil(), select,
                     convertArgs(tree.sym, args.toList(), tree.varargsElement)).
                     setType(tree.sym.erasure(types).getReturnType());
 
@@ -989,7 +989,7 @@
                 //note that method reference syntax does not allow an explicit
                 //enclosing class (so the enclosing class is null)
                 JCNewClass newClass = make.NewClass(null,
-                        List.<JCExpression>nil(),
+                        List.nil(),
                         make.Type(tree.getQualifierExpression().type),
                         convertArgs(tree.sym, args.toList(), tree.varargsElement),
                         null);
@@ -1028,7 +1028,7 @@
         JCFunctionalExpression tree = context.tree;
         //determine the static bsm args
         MethodSymbol samSym = (MethodSymbol) types.findDescriptorSymbol(tree.type.tsym);
-        List<Object> staticArgs = List.<Object>of(
+        List<Object> staticArgs = List.of(
                 typeToMethodType(samSym.type),
                 new Pool.MethodHandle(refKind, refSym, types),
                 typeToMethodType(tree.getDescriptorType(types)));
@@ -1042,7 +1042,7 @@
         //finally, compute the type of the indy call
         MethodType indyType = new MethodType(indy_args_types.toList(),
                 tree.type,
-                List.<Type>nil(),
+                List.nil(),
                 syms.methodClass);
 
         Name metafactoryName = context.needsAltMetafactory() ?
@@ -1108,7 +1108,7 @@
                     syms.methodTypeType).appendList(bsmStaticArgToTypes(staticArgs));
 
             Symbol bsm = rs.resolveInternalMethod(pos, attrEnv, site,
-                    bsmName, bsm_staticArgs, List.<Type>nil());
+                    bsmName, bsm_staticArgs, List.nil());
 
             DynamicMethodSymbol dynSym =
                     new DynamicMethodSymbol(methName,
@@ -1124,7 +1124,7 @@
             qualifier.sym = dynSym;
             qualifier.type = indyType.getReturnType();
 
-            JCMethodInvocation proxyCall = make.Apply(List.<JCExpression>nil(), qualifier, indyArgs);
+            JCMethodInvocation proxyCall = make.Apply(List.nil(), qualifier, indyArgs);
             proxyCall.type = indyType.getReturnType();
             return proxyCall;
         } finally {
@@ -1622,8 +1622,8 @@
                      */
                     clinit = makePrivateSyntheticMethod(STATIC,
                             names.clinit,
-                            new MethodType(List.<Type>nil(), syms.voidType,
-                                List.<Type>nil(), syms.methodClass),
+                            new MethodType(List.nil(), syms.voidType,
+                                List.nil(), syms.methodClass),
                             csym);
                     clinits.put(csym, clinit);
                 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Dec 16 11:58:18 2016 -0800
@@ -495,7 +495,7 @@
             MethodSymbol valuesMethod = lookupMethod(pos,
                                                      names.values,
                                                      forEnum.type,
-                                                     List.<Type>nil());
+                                                     List.nil());
             JCExpression size = make // Color.values().length
                 .Select(make.App(make.QualIdent(valuesMethod)),
                         syms.lengthVar);
@@ -508,13 +508,13 @@
             Symbol ordinalMethod = lookupMethod(pos,
                                                 names.ordinal,
                                                 forEnum.type,
-                                                List.<Type>nil());
+                                                List.nil());
             List<JCCatch> catcher = List.<JCCatch>nil()
                 .prepend(make.Catch(make.VarDef(new VarSymbol(PARAMETER, names.ex,
                                                               syms.noSuchFieldErrorType,
                                                               syms.noSymbol),
                                                 null),
-                                    make.Block(0, List.<JCStatement>nil())));
+                                    make.Block(0, List.nil())));
             for (Map.Entry<VarSymbol,Integer> e : values.entrySet()) {
                 VarSymbol enumerator = e.getKey();
                 Integer mappedValue = e.getValue();
@@ -572,7 +572,7 @@
         JCNewClass tree = make.NewClass(null,
             null, make.QualIdent(ctype.tsym), args, null);
         tree.constructor = rs.resolveConstructor(
-            make_pos, attrEnv, ctype, TreeInfo.types(args), List.<Type>nil());
+            make_pos, attrEnv, ctype, TreeInfo.types(args), List.nil());
         tree.type = ctype;
         return tree;
     }
@@ -663,8 +663,8 @@
         // Create class definition tree.
         JCClassDecl cdef = make.ClassDef(
             make.Modifiers(flags), names.empty,
-            List.<JCTypeParameter>nil(),
-            null, List.<JCExpression>nil(), List.<JCTree>nil());
+            List.nil(),
+            null, List.nil(), List.nil());
         cdef.sym = c;
         cdef.type = c.type;
 
@@ -757,7 +757,7 @@
     /** Look up a method in a given scope.
      */
     private MethodSymbol lookupMethod(DiagnosticPosition pos, Name name, Type qual, List<Type> args) {
-        return rs.resolveInternalMethod(pos, attrEnv, qual, name, args, List.<Type>nil());
+        return rs.resolveInternalMethod(pos, attrEnv, qual, name, args, List.nil());
     }
 
     /** Look up a constructor.
@@ -1358,7 +1358,7 @@
         callee.sym = constr;
         callee.type = constr.type;
         md.body =
-            make.Block(0, List.<JCStatement>of(
+            make.Block(0, List.of(
                 make.Call(
                     make.App(
                         callee,
@@ -1613,7 +1613,7 @@
         JCVariableDecl paramTree = make.VarDef(param, null);
         JCStatement assign = make.Assignment(primaryException, make.Ident(param));
         JCStatement rethrowStat = make.Throw(make.Ident(param));
-        JCBlock catchBlock = make.Block(0L, List.<JCStatement>of(assign, rethrowStat));
+        JCBlock catchBlock = make.Block(0L, List.of(assign, rethrowStat));
         JCCatch catchClause = make.Catch(paramTree, catchBlock);
 
         int oldPos = make.pos;
@@ -1622,7 +1622,7 @@
         make.at(oldPos);
         JCTry outerTry = make.Try(makeTwrBlock(resources.tail, block,
                                     finallyCanCompleteNormally, depth + 1),
-                                  List.<JCCatch>of(catchClause),
+                                  List.of(catchClause),
                                   finallyClause);
         outerTry.finallyCanCompleteNormally = finallyCanCompleteNormally;
         stats.add(outerTry);
@@ -1649,14 +1649,14 @@
                 new MethodType(
                     List.of(syms.throwableType, syms.autoCloseableType),
                     syms.voidType,
-                    List.<Type>nil(),
+                    List.nil(),
                     syms.methodClass),
                 currentClass);
             enterSynthetic(resource.pos(), closeResource, currentClass.members());
 
             JCMethodDecl md = make.MethodDef(closeResource, null);
             List<JCVariableDecl> params = md.getParameters();
-            md.body = make.Block(0, List.<JCStatement>of(makeTwrCloseStatement(params.get(0).sym,
+            md.body = make.Block(0, List.of(makeTwrCloseStatement(params.get(0).sym,
                                                                                make.Ident(params.get(1)))));
 
             JCClassDecl currentClassDecl = classDef(currentClass);
@@ -1667,7 +1667,7 @@
 
         if (closeResource != null) {
             //$closeResource(#primaryException, #resource)
-            closeStatement = make.Exec(make.Apply(List.<JCExpression>nil(),
+            closeStatement = make.Exec(make.Apply(List.nil(),
                                                   make.Ident(closeResource),
                                                   List.of(make.Ident(primaryException),
                                                           resource)
@@ -1688,7 +1688,7 @@
         }
 
         return make.Block(0L,
-                          List.<JCStatement>of(finallyStatement));
+                          List.of(finallyStatement));
     }
         //where:
         private boolean shouldUseCloseResourceMethod() {
@@ -1728,14 +1728,14 @@
         JCStatement addSuppressionStatement =
             make.Exec(makeCall(make.Ident(primaryException),
                                names.addSuppressed,
-                               List.<JCExpression>of(make.Ident(catchException))));
+                               List.of(make.Ident(catchException))));
 
         // try { resource.close(); } catch (e) { primaryException.addSuppressed(e); }
         JCBlock tryBlock =
-            make.Block(0L, List.<JCStatement>of(makeResourceCloseInvocation(resource)));
+            make.Block(0L, List.of(makeResourceCloseInvocation(resource)));
         JCVariableDecl catchExceptionDecl = make.VarDef(catchException, null);
-        JCBlock catchBlock = make.Block(0L, List.<JCStatement>of(addSuppressionStatement));
-        List<JCCatch> catchClauses = List.<JCCatch>of(make.Catch(catchExceptionDecl, catchBlock));
+        JCBlock catchBlock = make.Block(0L, List.of(addSuppressionStatement));
+        List<JCCatch> catchClauses = List.of(make.Catch(catchExceptionDecl, catchBlock));
         JCTry tryTree = make.Try(tryBlock, catchClauses, null);
         tryTree.finallyCanCompleteNormally = true;
 
@@ -1756,7 +1756,7 @@
         // create resource.close() method invocation
         JCExpression resourceClose = makeCall(resource,
                                               names.close,
-                                              List.<JCExpression>nil());
+                                              List.nil());
         return make.Exec(resourceClose);
     }
 
@@ -1931,7 +1931,7 @@
                 new MethodType(
                     List.of(syms.stringType),
                     types.erasure(syms.classType),
-                    List.<Type>nil(),
+                    List.nil(),
                     syms.methodClass),
                 outerCacheClass);
             enterSynthetic(pos, classDollarSym, outerCacheClass.members());
@@ -1940,7 +1940,7 @@
             try {
                 md.body = classDollarSymBody(pos, md);
             } catch (CompletionFailure ex) {
-                md.body = make.Block(0, List.<JCStatement>nil());
+                md.body = make.Block(0, List.nil());
                 chk.completionError(pos, ex);
             }
             JCClassDecl outerCacheClassDef = classDef(outerCacheClass);
@@ -1971,7 +1971,7 @@
 
         // newcache := "new cache$1[0]"
         JCNewArray newcache = make.NewArray(make.Type(outerCacheClass.type),
-                                            List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)),
+                                            List.of(make.Literal(INT, 0).setType(syms.intType)),
                                             null);
         newcache.type = new ArrayType(types.erasure(outerCacheClass.type),
                                       syms.arrayClass);
@@ -1992,18 +1992,18 @@
                                     makeCall(
                                             makeCall(makeCall(newcache,
                                                               names.getClass,
-                                                              List.<JCExpression>nil()),
+                                                              List.nil()),
                                                      names.getComponentType,
-                                                     List.<JCExpression>nil()),
+                                                     List.nil()),
                                             names.getClassLoader,
-                                            List.<JCExpression>nil())).setType(syms.classLoaderType),
+                                            List.nil())).setType(syms.classLoaderType),
                         make.Ident(clsym)).setType(syms.classLoaderType);
 
         // returnResult := "{ return Class.forName(param1, false, cl$); }"
         List<JCExpression> args = List.of(make.Ident(md.params.head.sym),
                                           makeLit(syms.booleanType, 0),
                                           clvalue);
-        returnResult = make.Block(0, List.<JCStatement>of(make.Call(make.App(make.Ident(forNameSym), args))));
+        returnResult = make.Block(0, List.of(make.Call(make.App(make.Ident(forNameSym), args))));
 
         // catchParam := ClassNotFoundException e1
         VarSymbol catchParam =
@@ -2015,9 +2015,9 @@
         // rethrow = "throw new NoClassDefFoundError().initCause(e);
         JCExpression throwExpr =
             makeCall(makeNewClass(syms.noClassDefFoundErrorType,
-                                  List.<JCExpression>nil()),
+                                  List.nil()),
                      names.initCause,
-                     List.<JCExpression>of(make.Ident(catchParam)));
+                     List.of(make.Ident(catchParam)));
         rethrow = make.Throw(throwExpr);
 
         // rethrowStmt := "( $rethrow )"
@@ -2158,7 +2158,7 @@
             Symbol desiredAssertionStatusSym = lookupMethod(pos,
                                                             names.desiredAssertionStatus,
                                                             types.erasure(syms.classType),
-                                                            List.<Type>nil());
+                                                            List.nil());
             JCClassDecl containerDef = classDef(container);
             make_at(containerDef.pos());
             JCExpression notStatus = makeUnary(NOT, make.App(make.Select(
@@ -2175,7 +2175,7 @@
                 JCClassDecl currentClassDef = classDef(currentClass);
                 make_at(currentClassDef.pos());
                 JCStatement dummy = make.If(make.QualIdent(assertDisabledSym), make.Skip(), null);
-                JCBlock clinit = make.Block(STATIC, List.<JCStatement>of(dummy));
+                JCBlock clinit = make.Block(STATIC, List.of(dummy));
                 currentClassDef.defs = currentClassDef.defs.prepend(clinit);
             }
         }
@@ -2254,25 +2254,15 @@
             final JCFieldAccess s = (JCFieldAccess)lval;
             Symbol lid = TreeInfo.symbol(s.selected);
             if (lid != null && lid.kind == TYP) return builder.build(lval);
-            return abstractRval(s.selected, new TreeBuilder() {
-                    public JCExpression build(final JCExpression selected) {
-                        return builder.build(make.Select(selected, s.sym));
-                    }
-                });
+            return abstractRval(s.selected, selected -> builder.build(make.Select(selected, s.sym)));
         }
         case INDEXED: {
             final JCArrayAccess i = (JCArrayAccess)lval;
-            return abstractRval(i.indexed, new TreeBuilder() {
-                    public JCExpression build(final JCExpression indexed) {
-                        return abstractRval(i.index, syms.intType, new TreeBuilder() {
-                                public JCExpression build(final JCExpression index) {
-                                    JCExpression newLval = make.Indexed(indexed, index);
-                                    newLval.setType(i.type);
-                                    return builder.build(newLval);
-                                }
-                            });
-                    }
-                });
+            return abstractRval(i.indexed, indexed -> abstractRval(i.index, syms.intType, index -> {
+                JCExpression newLval = make.Indexed(indexed, index);
+                newLval.setType(i.type);
+                return builder.build(newLval);
+            }));
         }
         case TYPECAST: {
             return abstractLval(((JCTypeCast)lval).expr, builder);
@@ -2283,11 +2273,7 @@
 
     // evaluate and discard the first expression, then evaluate the second.
     JCExpression makeComma(final JCExpression expr1, final JCExpression expr2) {
-        return abstractRval(expr1, new TreeBuilder() {
-                public JCExpression build(final JCExpression discarded) {
-                    return expr2;
-                }
-            });
+        return abstractRval(expr1, discarded -> expr2);
     }
 
 /**************************************************************************
@@ -2389,15 +2375,15 @@
         ClassSymbol c = msym.module_info;
         c.setAttributes(msym);
         c.flags_field |= Flags.MODULE;
-        createInfoClass(List.<JCAnnotation>nil(), tree.sym.module_info);
+        createInfoClass(List.nil(), tree.sym.module_info);
     }
 
     private void createInfoClass(List<JCAnnotation> annots, ClassSymbol c) {
         long flags = Flags.ABSTRACT | Flags.INTERFACE;
         JCClassDecl infoClass =
                 make.ClassDef(make.Modifiers(flags, annots),
-                    c.name, List.<JCTypeParameter>nil(),
-                    null, List.<JCExpression>nil(), List.<JCTree>nil());
+                    c.name, List.nil(),
+                    null, List.nil(), List.nil());
         infoClass.sym = c;
         translated.append(infoClass);
     }
@@ -2489,7 +2475,7 @@
         currentMethodSym = currentMethodSymPrev;
 
         // Return empty block {} as a placeholder for an inner class.
-        result = make_at(tree.pos()).Block(SYNTHETIC, List.<JCStatement>nil());
+        result = make_at(tree.pos()).Block(SYNTHETIC, List.nil());
     }
 
     /** Translate an enum class. */
@@ -2532,14 +2518,14 @@
                                             arrayType,
                                             tree.type.tsym);
         JCNewArray newArray = make.NewArray(make.Type(types.erasure(tree.type)),
-                                          List.<JCExpression>nil(),
+                                          List.nil(),
                                           values.toList());
         newArray.type = arrayType;
         enumDefs.append(make.VarDef(valuesVar, newArray));
         tree.sym.members().enter(valuesVar);
 
         Symbol valuesSym = lookupMethod(tree.pos(), names.values,
-                                        tree.type, List.<Type>nil());
+                                        tree.type, List.nil());
         List<JCStatement> valuesBody;
         if (useClone()) {
             // return (T[]) $VALUES.clone();
@@ -2547,7 +2533,7 @@
                 make.TypeCast(valuesSym.type.getReturnType(),
                               make.App(make.Select(make.Ident(valuesVar),
                                                    syms.arrayCloneMethod)));
-            valuesBody = List.<JCStatement>of(make.Return(valuesResult));
+            valuesBody = List.of(make.Return(valuesResult));
         } else {
             // template: T[] $result = new T[$values.length];
             Name resultName = names.fromString(target.syntheticNameChar() + "result");
@@ -2568,13 +2554,13 @@
                 systemArraycopyMethod =
                     new MethodSymbol(PUBLIC | STATIC,
                                      names.fromString("arraycopy"),
-                                     new MethodType(List.<Type>of(syms.objectType,
+                                     new MethodType(List.of(syms.objectType,
                                                             syms.intType,
                                                             syms.objectType,
                                                             syms.intType,
                                                             syms.intType),
                                                     syms.voidType,
-                                                    List.<Type>nil(),
+                                                    List.nil(),
                                                     syms.methodClass),
                                      syms.systemType.tsym);
             }
@@ -2587,7 +2573,7 @@
 
             // template: return $result;
             JCStatement ret = make.Return(make.Ident(resultVar));
-            valuesBody = List.<JCStatement>of(decl, copy, ret);
+            valuesBody = List.of(decl, copy, ret);
         }
 
         JCMethodDecl valuesDef =
@@ -2968,7 +2954,7 @@
         if (!tree.cond.type.isTrue()) {
             JCExpression cond = assertFlagTest(tree.pos());
             List<JCExpression> exnArgs = (tree.detail == null) ?
-                List.<JCExpression>nil() : List.of(translate(tree.detail));
+                List.nil() : List.of(translate(tree.detail));
             if (!tree.cond.type.isFalse()) {
                 cond = makeBinary
                     (AND,
@@ -3081,7 +3067,7 @@
                 args = args.tail;
             }
             JCNewArray boxedArgs = make.NewArray(make.Type(varargsElement),
-                                               List.<JCExpression>nil(),
+                                               List.nil(),
                                                elems.toList());
             boxedArgs.type = new ArrayType(varargsElement, syms.arrayClass);
             result.append(boxedArgs);
@@ -3150,7 +3136,7 @@
         Symbol valueSym = lookupMethod(tree.pos(),
                                        unboxedType.tsym.name.append(names.Value), // x.intValue()
                                        tree.type,
-                                       List.<Type>nil());
+                                       List.nil());
         return make.App(make.Select(tree, valueSym));
     }
 
@@ -3195,33 +3181,31 @@
             // boxing required; need to rewrite as x = (unbox typeof x)(x op y);
             // or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y)
             // (but without recomputing x)
-            JCTree newTree = abstractLval(tree.lhs, new TreeBuilder() {
-                    public JCExpression build(final JCExpression lhs) {
-                        JCTree.Tag newTag = tree.getTag().noAssignOp();
-                        // Erasure (TransTypes) can change the type of
-                        // tree.lhs.  However, we can still get the
-                        // unerased type of tree.lhs as it is stored
-                        // in tree.type in Attr.
-                        OperatorSymbol newOperator = operators.resolveBinary(tree,
-                                                                      newTag,
-                                                                      tree.type,
-                                                                      tree.rhs.type);
-                        //Need to use the "lhs" at two places, once on the future left hand side
-                        //and once in the future binary operator. But further processing may change
-                        //the components of the tree in place (see visitSelect for e.g. <Class>.super.<ident>),
-                        //so cloning the tree to avoid interference between the uses:
-                        JCExpression expr = (JCExpression) lhs.clone();
-                        if (expr.type != tree.type)
-                            expr = make.TypeCast(tree.type, expr);
-                        JCBinary opResult = make.Binary(newTag, expr, tree.rhs);
-                        opResult.operator = newOperator;
-                        opResult.type = newOperator.type.getReturnType();
-                        JCExpression newRhs = boxingReq ?
-                            make.TypeCast(types.unboxedType(tree.type), opResult) :
-                            opResult;
-                        return make.Assign(lhs, newRhs).setType(tree.type);
-                    }
-                });
+            JCTree newTree = abstractLval(tree.lhs, lhs -> {
+                Tag newTag = tree.getTag().noAssignOp();
+                // Erasure (TransTypes) can change the type of
+                // tree.lhs.  However, we can still get the
+                // unerased type of tree.lhs as it is stored
+                // in tree.type in Attr.
+                OperatorSymbol newOperator = operators.resolveBinary(tree,
+                                                              newTag,
+                                                              tree.type,
+                                                              tree.rhs.type);
+                //Need to use the "lhs" at two places, once on the future left hand side
+                //and once in the future binary operator. But further processing may change
+                //the components of the tree in place (see visitSelect for e.g. <Class>.super.<ident>),
+                //so cloning the tree to avoid interference between the uses:
+                JCExpression expr = (JCExpression) lhs.clone();
+                if (expr.type != tree.type)
+                    expr = make.TypeCast(tree.type, expr);
+                JCBinary opResult = make.Binary(newTag, expr, tree.rhs);
+                opResult.operator = newOperator;
+                opResult.type = newOperator.type.getReturnType();
+                JCExpression newRhs = boxingReq ?
+                    make.TypeCast(types.unboxedType(tree.type), opResult) :
+                    opResult;
+                return make.Assign(lhs, newRhs).setType(tree.type);
+            });
             result = translate(newTree);
             return;
         }
@@ -3287,28 +3271,22 @@
         // translate to tmp1=lval(e); tmp2=tmp1; (typeof tree)tmp1 OP 1; tmp2
         // where OP is += or -=
         final boolean cast = TreeInfo.skipParens(tree.arg).hasTag(TYPECAST);
-        return abstractLval(tree.arg, new TreeBuilder() {
-                public JCExpression build(final JCExpression tmp1) {
-                    return abstractRval(tmp1, tree.arg.type, new TreeBuilder() {
-                            public JCExpression build(final JCExpression tmp2) {
-                                JCTree.Tag opcode = (tree.hasTag(POSTINC))
-                                    ? PLUS_ASG : MINUS_ASG;
-                                //"tmp1" and "tmp2" may refer to the same instance
-                                //(for e.g. <Class>.super.<ident>). But further processing may
-                                //change the components of the tree in place (see visitSelect),
-                                //so cloning the tree to avoid interference between the two uses:
-                                JCExpression lhs = (JCExpression)tmp1.clone();
-                                lhs = cast
-                                    ? make.TypeCast(tree.arg.type, lhs)
-                                    : lhs;
-                                JCExpression update = makeAssignop(opcode,
-                                                             lhs,
-                                                             make.Literal(1));
-                                return makeComma(update, tmp2);
-                            }
-                        });
-                }
-            });
+        return abstractLval(tree.arg, tmp1 -> abstractRval(tmp1, tree.arg.type, tmp2 -> {
+            Tag opcode = (tree.hasTag(POSTINC))
+                ? PLUS_ASG : MINUS_ASG;
+            //"tmp1" and "tmp2" may refer to the same instance
+            //(for e.g. <Class>.super.<ident>). But further processing may
+            //change the components of the tree in place (see visitSelect),
+            //so cloning the tree to avoid interference between the two uses:
+            JCExpression lhs = (JCExpression)tmp1.clone();
+            lhs = cast
+                ? make.TypeCast(tree.arg.type, lhs)
+                : lhs;
+            JCExpression update = makeAssignop(opcode,
+                                         lhs,
+                                         make.Literal(1));
+            return makeComma(update, tmp2);
+        }));
     }
 
     public void visitUnary(JCUnary tree) {
@@ -3507,7 +3485,7 @@
             Symbol iterator = lookupMethod(tree.expr.pos(),
                                            names.iterator,
                                            eType,
-                                           List.<Type>nil());
+                                           List.nil());
             VarSymbol itvar = new VarSymbol(SYNTHETIC, names.fromString("i" + target.syntheticNameChar()),
                                             types.erasure(types.asSuper(iterator.type.getReturnType(), syms.iteratorType.tsym)),
                                             currentMethodSym);
@@ -3519,12 +3497,12 @@
             Symbol hasNext = lookupMethod(tree.expr.pos(),
                                           names.hasNext,
                                           itvar.type,
-                                          List.<Type>nil());
+                                          List.nil());
             JCMethodInvocation cond = make.App(make.Select(make.Ident(itvar), hasNext));
             Symbol next = lookupMethod(tree.expr.pos(),
                                        names.next,
                                        itvar.type,
-                                       List.<Type>nil());
+                                       List.nil());
             JCExpression vardefinit = make.App(make.Select(make.Ident(itvar), next));
             if (tree.var.type.isPrimitive())
                 vardefinit = make.TypeCast(types.cvarUpperBound(iteratorTarget), vardefinit);
@@ -3540,7 +3518,7 @@
             result = translate(make.
                 ForLoop(List.of(init),
                         cond,
-                        List.<JCExpressionStatement>nil(),
+                        List.nil(),
                         body));
             patchTargets(body, tree, result);
         }
@@ -3629,7 +3607,7 @@
         Symbol ordinalMethod = lookupMethod(tree.pos(),
                                             names.ordinal,
                                             tree.selector.type,
-                                            List.<Type>nil());
+                                            List.nil());
         JCArrayAccess selector = make.Indexed(map.mapVar,
                                         make.App(make.Select(tree.selector,
                                                              ordinalMethod)));
@@ -3768,7 +3746,7 @@
             // hashCode will trigger nullcheck on original switch expression
             JCMethodInvocation hashCodeCall = makeCall(make.Ident(dollar_s),
                                                        names.hashCode,
-                                                       List.<JCExpression>nil()).setType(syms.intType);
+                                                       List.nil()).setType(syms.intType);
             JCSwitch switch1 = make.Switch(hashCodeCall,
                                         caseBuffer.toList());
             for(Map.Entry<Integer, Set<String>> entry : hashToString.entrySet()) {
@@ -3780,7 +3758,7 @@
                 for(String caseLabel : stringsWithHashCode ) {
                     JCMethodInvocation stringEqualsCall = makeCall(make.Ident(dollar_s),
                                                                    names.equals,
-                                                                   List.<JCExpression>of(make.Literal(caseLabel)));
+                                                                   List.of(make.Literal(caseLabel)));
                     elsepart = make.If(stringEqualsCall,
                                        make.Exec(make.Assign(make.Ident(dollar_tmp),
                                                              make.Literal(caseLabelToPosition.get(caseLabel))).
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Fri Dec 16 11:58:18 2016 -0800
@@ -158,6 +158,7 @@
     private final Set<String> extraAddMods = new HashSet<>();
     private final String limitModsOpt;
     private final Set<String> extraLimitMods = new HashSet<>();
+    private final String moduleVersionOpt;
 
     private final boolean lintOptions;
 
@@ -203,6 +204,7 @@
         addReadsOpt = options.get(Option.ADD_READS);
         addModsOpt = options.get(Option.ADD_MODULES);
         limitModsOpt = options.get(Option.LIMIT_MODULES);
+        moduleVersionOpt = options.get(Option.MODULE_VERSION);
     }
 
     int depth = -1;
@@ -260,7 +262,7 @@
             // scan trees for module defs
             Set<ModuleSymbol> roots = enterModules(trees, c);
 
-            setCompilationUnitModules(trees, roots);
+            setCompilationUnitModules(trees, roots, c);
 
             init.accept(roots);
 
@@ -349,7 +351,7 @@
         }
     }
 
-    private void setCompilationUnitModules(List<JCCompilationUnit> trees, Set<ModuleSymbol> rootModules) {
+    private void setCompilationUnitModules(List<JCCompilationUnit> trees, Set<ModuleSymbol> rootModules, ClassSymbol c) {
         // update the module for each compilation unit
         if (multiModuleMode) {
             checkNoAllModulePath();
@@ -383,6 +385,8 @@
                         }
                         tree.modle = msym;
                         rootModules.add(msym);
+                    } else if (c != null && c.packge().modle == syms.unnamedModule) {
+                        tree.modle = syms.unnamedModule;
                     } else {
                         log.error(tree.pos(), Errors.UnnamedPkgNotAllowedNamedModules);
                         tree.modle = syms.errModule;
@@ -420,12 +424,7 @@
                             checkNoAllModulePath();
                             defaultModule.complete();
                             // Question: why not do completeModule here?
-                            defaultModule.completer = new Completer() {
-                                @Override
-                                public void complete(Symbol sym) throws CompletionFailure {
-                                    completeModule((ModuleSymbol) sym);
-                                }
-                            };
+                            defaultModule.completer = sym -> completeModule((ModuleSymbol) sym);
                         }
                         rootModules.add(defaultModule);
                         break;
@@ -449,9 +448,6 @@
 
             if (defaultModule != syms.unnamedModule) {
                 syms.unnamedModule.completer = getUnnamedModuleCompleter();
-                if (moduleOverride == null) {
-                    syms.unnamedModule.sourceLocation = StandardLocation.SOURCE_PATH;
-                }
                 syms.unnamedModule.classLocation = StandardLocation.CLASS_PATH;
             }
 
@@ -476,8 +472,18 @@
     private Location getModuleLocation(JavaFileObject fo, Name pkgName) throws IOException {
         // For now, just check module source path.
         // We may want to check source path as well.
-        return fileManager.getLocationForModule(StandardLocation.MODULE_SOURCE_PATH,
-                fo, (pkgName == null) ? null : pkgName.toString());
+        Location loc =
+                fileManager.getLocationForModule(StandardLocation.MODULE_SOURCE_PATH,
+                                                 fo, (pkgName == null) ? null : pkgName.toString());
+        if (loc == null) {
+            Location sourceOutput = fileManager.hasLocation(StandardLocation.SOURCE_OUTPUT) ?
+                    StandardLocation.SOURCE_OUTPUT : StandardLocation.CLASS_OUTPUT;
+            loc =
+                fileManager.getLocationForModule(sourceOutput,
+                                                 fo, (pkgName == null) ? null : pkgName.toString());
+        }
+
+        return loc;
     }
 
     private void checkSpecifiedModule(List<JCCompilationUnit> trees, JCDiagnostic.Error error) {
@@ -595,13 +601,16 @@
                 msym.flags_field |= UNATTRIBUTED;
                 ModuleVisitor v = new ModuleVisitor();
                 JavaFileObject prev = log.useSource(tree.sourcefile);
+                JCModuleDecl moduleDecl = tree.getModuleDecl();
+                DiagnosticPosition prevLintPos = deferredLintHandler.setPos(moduleDecl.pos());
+
                 try {
-                    JCModuleDecl moduleDecl = tree.getModuleDecl();
                     moduleDecl.accept(v);
                     completeModule(msym);
                     checkCyclicDependencies(moduleDecl);
                 } finally {
                     log.useSource(prev);
+                    deferredLintHandler.setPos(prevLintPos);
                     msym.flags_field &= ~UNATTRIBUTED;
                 }
             }
@@ -614,6 +623,11 @@
         };
     }
 
+    public boolean isRootModule(ModuleSymbol module) {
+        Assert.checkNonNull(rootModules);
+        return rootModules.contains(module);
+    }
+
     class ModuleVisitor extends JCTree.Visitor {
         private ModuleSymbol sym;
         private final Set<ModuleSymbol> allRequires = new HashSet<>();
@@ -678,15 +692,12 @@
                 Set<ModuleSymbol> to = new LinkedHashSet<>();
                 for (JCExpression n: tree.moduleNames) {
                     ModuleSymbol msym = lookupModule(n);
-                    if (msym.kind != MDL) {
-                        log.error(n.pos(), Errors.ModuleNotFound(msym));
-                    } else {
-                        for (ExportsDirective d : exportsForPackage) {
-                            checkDuplicateExportsToModule(n, msym, d);
-                        }
-                        if (!to.add(msym)) {
-                            reportExportsConflictToModule(n, msym);
-                        }
+                    chk.checkModuleExists(n.pos(), msym);
+                    for (ExportsDirective d : exportsForPackage) {
+                        checkDuplicateExportsToModule(n, msym, d);
+                    }
+                    if (!to.add(msym)) {
+                        reportExportsConflictToModule(n, msym);
                     }
                 }
                 toModules = List.from(to);
@@ -740,15 +751,12 @@
                 Set<ModuleSymbol> to = new LinkedHashSet<>();
                 for (JCExpression n: tree.moduleNames) {
                     ModuleSymbol msym = lookupModule(n);
-                    if (msym.kind != MDL) {
-                        log.error(n.pos(), Errors.ModuleNotFound(msym));
-                    } else {
-                        for (OpensDirective d : opensForPackage) {
-                            checkDuplicateOpensToModule(n, msym, d);
-                        }
-                        if (!to.add(msym)) {
-                            reportOpensConflictToModule(n, msym);
-                        }
+                    chk.checkModuleExists(n.pos(), msym);
+                    for (OpensDirective d : opensForPackage) {
+                        checkDuplicateOpensToModule(n, msym, d);
+                    }
+                    if (!to.add(msym)) {
+                        reportOpensConflictToModule(n, msym);
                     }
                 }
                 toModules = List.from(to);
@@ -1133,6 +1141,12 @@
         result.add(syms.unnamedModule);
 
         allModules = result;
+
+        //add module versions from options, if any:
+        if (moduleVersionOpt != null) {
+            Name version = names.fromString(moduleVersionOpt);
+            rootModules.forEach(m -> m.version = version);
+        }
     }
 
     public boolean isInModuleGraph(ModuleSymbol msym) {
@@ -1503,7 +1517,7 @@
                 current.complete();
                 if ((current.flags() & Flags.ACYCLIC) != 0)
                     continue;
-                Assert.checkNonNull(current.requires, () -> current.toString());
+                Assert.checkNonNull(current.requires, current::toString);
                 for (RequiresDirective dep : current.requires) {
                     if (!dep.flags.contains(RequiresFlag.EXTRA))
                         queue = queue.prepend(dep.module);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java	Fri Dec 16 11:58:18 2016 -0800
@@ -296,7 +296,7 @@
          */
         private OperatorSymbol[] initOperators() {
             OperatorSymbol[] operators = operatorSuppliers.stream()
-                    .map(op -> op.get())
+                    .map(Supplier::get)
                     .toArray(OperatorSymbol[]::new);
             alternatives = Optional.of(operators);
             operatorSuppliers = null; //let GC do its work
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Dec 16 11:58:18 2016 -0800
@@ -881,12 +881,8 @@
          */
         private void varargsAccessible(final Env<AttrContext> env, final Type t, final InferenceContext inferenceContext) {
             if (inferenceContext.free(t)) {
-                inferenceContext.addFreeTypeListener(List.of(t), new FreeTypeListener() {
-                    @Override
-                    public void typesInferred(InferenceContext inferenceContext) {
-                        varargsAccessible(env, inferenceContext.asInstType(t), inferenceContext);
-                    }
-                });
+                inferenceContext.addFreeTypeListener(List.of(t),
+                        solvedContext -> varargsAccessible(env, solvedContext.asInstType(t), solvedContext));
             } else {
                 if (!isAccessible(env, types.erasure(t))) {
                     Symbol location = env.enclClass.sym;
@@ -1851,47 +1847,43 @@
      * errors if some of the not-needed supertypes are missing/ill-formed).
      */
     Iterable<TypeSymbol> superclasses(final Type intype) {
-        return new Iterable<TypeSymbol>() {
-            public Iterator<TypeSymbol> iterator() {
-                return new Iterator<TypeSymbol>() {
-
-                    List<TypeSymbol> seen = List.nil();
-                    TypeSymbol currentSym = symbolFor(intype);
-                    TypeSymbol prevSym = null;
-
-                    public boolean hasNext() {
-                        if (currentSym == syms.noSymbol) {
-                            currentSym = symbolFor(types.supertype(prevSym.type));
-                        }
-                        return currentSym != null;
-                    }
-
-                    public TypeSymbol next() {
-                        prevSym = currentSym;
-                        currentSym = syms.noSymbol;
-                        Assert.check(prevSym != null || prevSym != syms.noSymbol);
-                        return prevSym;
-                    }
-
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    TypeSymbol symbolFor(Type t) {
-                        if (!t.hasTag(CLASS) &&
-                                !t.hasTag(TYPEVAR)) {
-                            return null;
-                        }
-                        t = types.skipTypeVars(t, false);
-                        if (seen.contains(t.tsym)) {
-                            //degenerate case in which we have a circular
-                            //class hierarchy - because of ill-formed classfiles
-                            return null;
-                        }
-                        seen = seen.prepend(t.tsym);
-                        return t.tsym;
-                    }
-                };
+        return () -> new Iterator<TypeSymbol>() {
+
+            List<TypeSymbol> seen = List.nil();
+            TypeSymbol currentSym = symbolFor(intype);
+            TypeSymbol prevSym = null;
+
+            public boolean hasNext() {
+                if (currentSym == syms.noSymbol) {
+                    currentSym = symbolFor(types.supertype(prevSym.type));
+                }
+                return currentSym != null;
+            }
+
+            public TypeSymbol next() {
+                prevSym = currentSym;
+                currentSym = syms.noSymbol;
+                Assert.check(prevSym != null || prevSym != syms.noSymbol);
+                return prevSym;
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+            TypeSymbol symbolFor(Type t) {
+                if (!t.hasTag(CLASS) &&
+                        !t.hasTag(TYPEVAR)) {
+                    return null;
+                }
+                t = types.skipTypeVars(t, false);
+                if (seen.contains(t.tsym)) {
+                    //degenerate case in which we have a circular
+                    //class hierarchy - because of ill-formed classfiles
+                    return null;
+                }
+                seen = seen.prepend(t.tsym);
+                return t.tsym;
             }
         };
     }
@@ -1983,22 +1975,42 @@
         } catch (ClassFinder.BadClassFile err) {
             throw err;
         } catch (CompletionFailure ex) {
-            //even if a class cannot be found in the current module and packages in modules it depends on that
-            //are exported for any or this module, the class may exist internally in some of these modules,
-            //or may exist in a module on which this module does not depend. Provide better diagnostic in
-            //such cases by looking for the class in any module:
-            for (ModuleSymbol ms : syms.getAllModules()) {
-                //do not load currently unloaded classes, to avoid too eager completion of random things in other modules:
-                ClassSymbol clazz = syms.getClass(ms, name);
-
-                if (clazz != null) {
-                    return new AccessError(clazz);
-                }
+            Symbol candidate = recoveryLoadClass.loadClass(env, name);
+
+            if (candidate != null) {
+                return candidate;
             }
+
             return typeNotFound;
         }
     }
 
+    public static interface RecoveryLoadClass {
+        Symbol loadClass(Env<AttrContext> env, Name name);
+    }
+
+    private RecoveryLoadClass recoveryLoadClass = (env, name) -> {
+        //even if a class cannot be found in the current module and packages in modules it depends on that
+        //are exported for any or this module, the class may exist internally in some of these modules,
+        //or may exist in a module on which this module does not depend. Provide better diagnostic in
+        //such cases by looking for the class in any module:
+        for (ModuleSymbol ms : syms.getAllModules()) {
+            //do not load currently unloaded classes, to avoid too eager completion of random things in other modules:
+            ClassSymbol clazz = syms.getClass(ms, name);
+
+            if (clazz != null) {
+                return new AccessError(clazz);
+            }
+        }
+        return null;
+    };
+
+    public RecoveryLoadClass setRecoveryLoadClass(RecoveryLoadClass recovery) {
+        RecoveryLoadClass prev = recoveryLoadClass;
+        recoveryLoadClass = recovery;
+        return prev;
+    }
+
     /**
      * Find a type declared in a scope (not inherited).  Return null
      * if none is found.
@@ -2335,7 +2347,7 @@
                   Type site,
                   Name name,
                   boolean qualified) {
-        return accessInternal(sym, pos, location, site, name, qualified, List.<Type>nil(), null, basicLogResolveHelper);
+        return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper);
     }
 
     /** Same as original accessBase(), but without location.
@@ -2681,7 +2693,7 @@
                 (sym.flags_field & SYNTHETIC) == 0) {
                     List<Type> oldParams = sym.type.hasTag(FORALL) ?
                             ((ForAll)sym.type).tvars :
-                            List.<Type>nil();
+                            List.nil();
                     Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),
                                                  types.createMethodTypeWithReturn(sym.type.asMethodType(), site));
                     MethodSymbol newConstr = new MethodSymbol(sym.flags(), names.init, constrType, site.tsym) {
@@ -2709,7 +2721,7 @@
         site = types.capture(site);
 
         ReferenceLookupHelper lookupHelper = makeReferenceLookupHelper(
-                referenceTree, site, name, List.<Type>nil(), null, VARARITY);
+                referenceTree, site, name, List.nil(), null, VARARITY);
 
         Env<AttrContext> newEnv = env.dup(env.tree, env.info.dup());
         Symbol sym = lookupMethod(newEnv, env.tree.pos(), site.tsym,
@@ -3263,7 +3275,7 @@
         protected Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
             WriteableScope sc = WriteableScope.create(syms.arrayClass);
             MethodSymbol arrayConstr = new MethodSymbol(PUBLIC, name, null, site.tsym);
-            arrayConstr.type = new MethodType(List.<Type>of(syms.intType), site, List.<Type>nil(), syms.methodClass);
+            arrayConstr.type = new MethodType(List.of(syms.intType), site, List.nil(), syms.methodClass);
             sc.enter(arrayConstr);
             return findMethodInScope(env, site, name, argtypes, typeargtypes, sc, methodNotFound, phase.isBoxingRequired(), phase.isVarargsRequired(), false);
         }
@@ -3650,8 +3662,8 @@
                 Name name,
                 List<Type> argtypes,
                 List<Type> typeargtypes) {
-            argtypes = argtypes == null ? List.<Type>nil() : argtypes;
-            typeargtypes = typeargtypes == null ? List.<Type>nil() : typeargtypes;
+            argtypes = argtypes == null ? List.nil() : argtypes;
+            typeargtypes = typeargtypes == null ? List.nil() : typeargtypes;
             if (name == names.error)
                 return null;
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -529,7 +529,7 @@
         protected  JCExpression enumBase(int pos, ClassSymbol c) {
             JCExpression result = make.at(pos).
                 TypeApply(make.QualIdent(syms.enumSym),
-                          List.<JCExpression>of(make.Type(c.type)));
+                          List.of(make.Type(c.type)));
             return result;
         }
 
@@ -960,9 +960,9 @@
                 MethodDef(make.Modifiers(Flags.PUBLIC|Flags.STATIC),
                           names.values,
                           valuesType,
-                          List.<JCTypeParameter>nil(),
-                          List.<JCVariableDecl>nil(),
-                          List.<JCExpression>nil(), // thrown
+                          List.nil(),
+                          List.nil(),
+                          List.nil(), // thrown
                           null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
                           null);
             memberEnter.memberEnter(values, env);
@@ -972,12 +972,12 @@
                 MethodDef(make.Modifiers(Flags.PUBLIC|Flags.STATIC),
                           names.valueOf,
                           make.Type(tree.sym.type),
-                          List.<JCTypeParameter>nil(),
+                          List.nil(),
                           List.of(make.VarDef(make.Modifiers(Flags.PARAMETER |
                                                              Flags.MANDATED),
                                                 names.fromString("name"),
                                                 make.Type(syms.stringType), null)),
-                          List.<JCExpression>nil(), // thrown
+                          List.nil(), // thrown
                           null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
                           null);
             memberEnter.memberEnter(valueOf, env);
@@ -1069,7 +1069,7 @@
         }
         if (baseInit != null && baseInit.params != null &&
             baseInit.params.nonEmpty() && argTypesList.nonEmpty()) {
-            initParams = (initParams == null) ? List.<VarSymbol>nil() : initParams;
+            initParams = (initParams == null) ? List.nil() : initParams;
             List<VarSymbol> baseInitParams = baseInit.params;
             while (baseInitParams.nonEmpty() && argTypesList.nonEmpty()) {
                 VarSymbol param = new VarSymbol(baseInitParams.head.flags() | PARAMETER,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/CacheFSInfo.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/CacheFSInfo.java	Fri Dec 16 11:58:18 2016 -0800
@@ -32,6 +32,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
 
 /**
  * Caching implementation of FSInfo.
@@ -47,13 +48,11 @@
      * Register a Context.Factory to create a CacheFSInfo.
      */
     public static void preRegister(Context context) {
-        context.put(FSInfo.class, new Context.Factory<FSInfo>() {
-            public FSInfo make(Context c) {
+        context.put(FSInfo.class, (Factory<FSInfo>)c -> {
                 FSInfo instance = new CacheFSInfo();
                 c.put(FSInfo.class, instance);
                 return instance;
-            }
-        });
+            });
     }
 
     public void clearCache() {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Fri Dec 16 11:58:18 2016 -0800
@@ -71,6 +71,7 @@
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
@@ -134,12 +135,8 @@
      * Register a Context.Factory to create a JavacFileManager.
      */
     public static void preRegister(Context context) {
-        context.put(JavaFileManager.class, new Context.Factory<JavaFileManager>() {
-            @Override
-            public JavaFileManager make(Context c) {
-                return new JavacFileManager(c, true, null);
-            }
-        });
+        context.put(JavaFileManager.class,
+                (Factory<JavaFileManager>)c -> new JavacFileManager(c, true, null));
     }
 
     /**
@@ -950,12 +947,10 @@
 
     @Override @DefinedBy(Api.COMPILER)
     public Location getLocationForModule(Location location, String moduleName) throws IOException {
-        Objects.requireNonNull(location);
-        if (!location.isOutputLocation() && !location.isModuleOrientedLocation())
-            throw new IllegalArgumentException(
-                    "location is not an output location or a module-oriented location: "
-                            + location.getName());
+        checkModuleOrientedOrOutputLocation(location);
         nullCheck(moduleName);
+        if (location == SOURCE_OUTPUT && getSourceOutDir() == null)
+            location = CLASS_OUTPUT;
         return locations.getLocationForModule(location, moduleName);
     }
 
@@ -978,7 +973,7 @@
 
     @Override @DefinedBy(Api.COMPILER)
     public Location getLocationForModule(Location location, JavaFileObject fo, String pkgName) throws IOException {
-        checkModuleOrientedLocation(location);
+        checkModuleOrientedOrOutputLocation(location);
         if (!(fo instanceof PathFileObject))
             throw new IllegalArgumentException(fo.getName());
         int depth = 1; // allow 1 for filename
@@ -1012,7 +1007,7 @@
 
     @Override @DefinedBy(Api.COMPILER)
     public Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
-        checkModuleOrientedLocation(location);
+        checkModuleOrientedOrOutputLocation(location);
         return locations.listLocationsForModules(location);
     }
 
@@ -1098,10 +1093,12 @@
             throw new IllegalArgumentException("location is not an output location: " + location.getName());
     }
 
-    private void checkModuleOrientedLocation(Location location) {
+    private void checkModuleOrientedOrOutputLocation(Location location) {
         Objects.requireNonNull(location);
-        if (!location.isModuleOrientedLocation())
-            throw new IllegalArgumentException("location is not module-oriented: " + location.getName());
+        if (!location.isModuleOrientedLocation() && !location.isOutputLocation())
+            throw new IllegalArgumentException(
+                    "location is not an output location or a module-oriented location: "
+                            + location.getName());
     }
 
     private void checkNotModuleOrientedLocation(Location location) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Fri Dec 16 11:58:18 2016 -0800
@@ -272,7 +272,7 @@
             }
 
             try (Stream<Path> s = Files.list(dir)) {
-                s.filter(dirEntry -> isArchive(dirEntry))
+                s.filter(Locations.this::isArchive)
                         .forEach(dirEntry -> addFile(dirEntry, warn));
             } catch (IOException ignore) {
             }
@@ -476,6 +476,7 @@
 
         private Path outputDir;
         private Map<String, Location> moduleLocations;
+        private Map<Path, Location> pathLocations;
 
         OutputLocationHandler(Location location, Option... options) {
             super(location, options);
@@ -521,21 +522,50 @@
                 outputDir = dir;
             }
             moduleLocations = null;
+            pathLocations = null;
         }
 
         @Override
         Location getLocationForModule(String name) {
-            if (moduleLocations == null)
+            if (moduleLocations == null) {
                 moduleLocations = new HashMap<>();
+                pathLocations = new HashMap<>();
+            }
             Location l = moduleLocations.get(name);
             if (l == null) {
+                Path out = outputDir.resolve(name);
                 l = new ModuleLocationHandler(location.getName() + "[" + name + "]",
                         name,
-                        Collections.singleton(outputDir.resolve(name)),
+                        Collections.singleton(out),
                         true, false);
                 moduleLocations.put(name, l);
+                pathLocations.put(out.toAbsolutePath(), l);
+           }
+            return l;
+        }
+
+        @Override
+        Location getLocationForModule(Path dir) {
+            return pathLocations.get(dir);
+        }
+
+        private boolean listed;
+
+        @Override
+        Iterable<Set<Location>> listLocationsForModules() throws IOException {
+            if (!listed && outputDir != null) {
+                try (DirectoryStream<Path> stream = Files.newDirectoryStream(outputDir)) {
+                    for (Path p : stream) {
+                        getLocationForModule(p.getFileName().toString());
+                    }
+                }
+                listed = true;
             }
-            return l;
+            if (moduleLocations == null)
+                return Collections.emptySet();
+            Set<Location> locns = new LinkedHashSet<>();
+            moduleLocations.forEach((k, v) -> locns.add(v));
+            return Collections.singleton(locns);
         }
     }
 
@@ -916,7 +946,7 @@
             if (searchPath == null)
                 return Collections.emptyList();
 
-            return () -> new ModulePathIterator();
+            return ModulePathIterator::new;
         }
 
         @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Fri Dec 16 11:58:18 2016 -0800
@@ -85,6 +85,8 @@
     public final static int CONSTANT_MethodHandle = 15;
     public final static int CONSTANT_MethodType = 16;
     public final static int CONSTANT_InvokeDynamic = 18;
+    public final static int CONSTANT_Module = 19;
+    public final static int CONSTANT_Package = 20;
 
     public final static int REF_getField = 1;
     public final static int REF_getStatic = 2;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Dec 16 11:58:18 2016 -0800
@@ -161,9 +161,6 @@
      */
     protected ModuleSymbol currentModule = null;
 
-    // FIXME: temporary compatibility code
-    private boolean readNewModuleAttribute;
-
     /** The buffer containing the currently read class file.
      */
     byte[] buf = new byte[INITIAL_BUFFER_SIZE];
@@ -392,6 +389,8 @@
             case CONSTANT_Class:
             case CONSTANT_String:
             case CONSTANT_MethodType:
+            case CONSTANT_Module:
+            case CONSTANT_Package:
                 bp = bp + 2;
                 break;
             case CONSTANT_MethodHandle:
@@ -481,6 +480,11 @@
         case CONSTANT_InvokeDynamic:
             skipBytes(5);
             break;
+        case CONSTANT_Module:
+        case CONSTANT_Package:
+            // this is temporary for now: treat as a simple reference to the underlying Utf8.
+            poolObj[i] = readName(getChar(index + 1));
+            break;
         default:
             throw badClassFile("bad.const.pool.tag", Byte.toString(tag));
         }
@@ -567,40 +571,12 @@
         return (NameAndType)obj;
     }
 
-    /** Read the class name of a module-info.class file.
-     * The name is stored in a CONSTANT_Class entry, where the
-     * class name is of the form module-name.module-info.
-     */
-    Name readModuleInfoName(int i) {
-        if (majorVersion < Version.V53.major) {
-            throw badClassFile("anachronistic.module.info",
-                    Integer.toString(majorVersion),
-                    Integer.toString(minorVersion));
-        }
-        int classIndex = poolIdx[i];
-        if (buf[classIndex] == CONSTANT_Class) {
-            int utf8Index = poolIdx[getChar(classIndex + 1)];
-            if (buf[utf8Index] == CONSTANT_Utf8) {
-                int len = getChar(utf8Index + 1);
-                int start = utf8Index + 3;
-                return names.fromUtf(internalize(buf, start, len));
-            }
-        }
-        throw badClassFile("bad.module-info.name");
-    }
-
     /** Read the name of a module.
-     * The name is stored in a CONSTANT_Utf8 entry, in
-     * JVMS 4.2 internal form (with '/' instead of '.')
+     * The name is stored in a CONSTANT_Module entry, in
+     * JVMS 4.2 binary form (using ".", not "/")
      */
     Name readModuleName(int i) {
-        Name name = readName(i);
-        // FIXME: temporary compatibility code
-        if (readNewModuleAttribute) {
-            return names.fromUtf(internalize(name));
-        } else {
-            return name;
-        }
+        return readName(i);
     }
 
     /** Read module_flags.
@@ -614,6 +590,17 @@
         return set;
     }
 
+    /** Read resolution_flags.
+     */
+    Set<ModuleResolutionFlags> readModuleResolutionFlags(int flags) {
+        Set<ModuleResolutionFlags> set = EnumSet.noneOf(ModuleResolutionFlags.class);
+        for (ModuleResolutionFlags f : ModuleResolutionFlags.values()) {
+            if ((flags & f.value) != 0)
+                set.add(f);
+        }
+        return set;
+    }
+
     /** Read exports_flags.
      */
     Set<ExportsFlag> readExportsFlags(int flags) {
@@ -792,7 +779,7 @@
                 try {
                     return (outer == Type.noType) ?
                             t.erasure(types) :
-                        new ClassType(outer, List.<Type>nil(), t);
+                        new ClassType(outer, List.nil(), t);
                 } finally {
                     sbp = startSbp;
                 }
@@ -865,7 +852,7 @@
                     t = enterClass(names.fromUtf(signatureBuffer,
                                                  startSbp,
                                                  sbp - startSbp));
-                    outer = new ClassType(outer, List.<Type>nil(), t);
+                    outer = new ClassType(outer, List.nil(), t);
                 }
                 signatureBuffer[sbp++] = (byte)'$';
                 continue;
@@ -1282,21 +1269,20 @@
                         ModuleSymbol msym = (ModuleSymbol) sym.owner;
                         ListBuffer<Directive> directives = new ListBuffer<>();
 
-                        // FIXME: temporary compatibility code
-                        if (readNewModuleAttribute) {
-                            Name moduleName = readModuleName(nextChar());
-                            if (currentModule.name != moduleName) {
-                                throw badClassFile("module.name.mismatch", moduleName, currentModule.name);
-                            }
+                        Name moduleName = readModuleName(nextChar());
+                        if (currentModule.name != moduleName) {
+                            throw badClassFile("module.name.mismatch", moduleName, currentModule.name);
                         }
 
                         msym.flags.addAll(readModuleFlags(nextChar()));
+                        msym.version = readName(nextChar());
 
                         ListBuffer<RequiresDirective> requires = new ListBuffer<>();
                         int nrequires = nextChar();
                         for (int i = 0; i < nrequires; i++) {
                             ModuleSymbol rsym = syms.enterModule(readModuleName(nextChar()));
                             Set<RequiresFlag> flags = readRequiresFlags(nextChar());
+                            nextChar(); // skip compiled version
                             requires.add(new RequiresDirective(rsym, flags));
                         }
                         msym.requires = requires.toList();
@@ -1372,7 +1358,7 @@
                 }
             },
 
-            new AttributeReader(names.ModuleVersion, V53, CLASS_ATTRIBUTE) {
+            new AttributeReader(names.ModuleResolution, V53, CLASS_ATTRIBUTE) {
                 @Override
                 protected boolean accepts(AttributeKind kind) {
                     return super.accepts(kind) && allowModules;
@@ -1380,7 +1366,7 @@
                 protected void read(Symbol sym, int attrLen) {
                     if (sym.kind == TYP && sym.owner.kind == MDL) {
                         ModuleSymbol msym = (ModuleSymbol) sym.owner;
-                        msym.version = readName(nextChar());
+                        msym.resolutionFlags.addAll(readModuleResolutionFlags(nextChar()));
                     }
                 }
             },
@@ -2071,9 +2057,9 @@
             // type (typeof null) as return type because this type is
             // a subtype of all reference types and can be converted
             // to primitive types by unboxing.
-            MethodType mt = new MethodType(List.<Type>nil(),
+            MethodType mt = new MethodType(List.nil(),
                                            syms.botType,
-                                           List.<Type>nil(),
+                                           List.nil(),
                                            syms.methodClass);
             return new MethodSymbol(PUBLIC | ABSTRACT, name, mt, container.tsym);
         }
@@ -2277,7 +2263,7 @@
 
         TypeAnnotationCompleter(Symbol sym,
                 List<TypeAnnotationProxy> proxies) {
-            super(sym, List.<CompoundAnnotationProxy>nil());
+            super(sym, List.nil());
             this.proxies = proxies;
         }
 
@@ -2564,24 +2550,15 @@
                                    self.flatname);
             }
         } else {
+            if (majorVersion < Version.V53.major) {
+                throw badClassFile("anachronistic.module.info",
+                        Integer.toString(majorVersion),
+                        Integer.toString(minorVersion));
+            }
             c.flags_field = flags;
             currentModule = (ModuleSymbol) c.owner;
             int this_class = nextChar();
-            // FIXME: temporary compatibility code
-            if (this_class == 0) {
-                readNewModuleAttribute = true;
-            } else {
-                Name modInfoName = readModuleInfoName(this_class);
-                if (currentModule.name.append('.', names.module_info) != modInfoName) {
-                    //strip trailing .module-info, if exists:
-                    int modInfoStart = modInfoName.length() - names.module_info.length();
-                    modInfoName = modInfoName.subName(modInfoStart, modInfoName.length()) == names.module_info &&
-                                  modInfoName.charAt(modInfoStart - 1) == '.' ?
-                                      modInfoName.subName(0, modInfoStart - 1) : modInfoName;
-                    throw badClassFile("module.name.mismatch", modInfoName, currentModule.name);
-                }
-                readNewModuleAttribute = false;
-            }
+            // temp, no check on this_class
         }
 
         // class attributes must be read before class
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -474,6 +474,14 @@
                 poolbuf.appendByte(CONSTANT_MethodHandle);
                 poolbuf.appendByte(ref.refKind);
                 poolbuf.appendChar(pool.put(ref.refSym));
+            } else if (value instanceof ModuleSymbol) {
+                ModuleSymbol m = (ModuleSymbol)value;
+                poolbuf.appendByte(CONSTANT_Module);
+                poolbuf.appendChar(pool.put(m.name));
+            } else if (value instanceof PackageSymbol) {
+                PackageSymbol m = (PackageSymbol)value;
+                poolbuf.appendByte(CONSTANT_Package);
+                poolbuf.appendChar(pool.put(names.fromUtf(externalize(m.fullname))));
             } else {
                 Assert.error("writePool " + value);
             }
@@ -954,8 +962,9 @@
 
         int alenIdx = writeAttr(names.Module);
 
-        databuf.appendChar(pool.put(names.fromUtf(externalize(m.name))));
+        databuf.appendChar(pool.put(m));
         databuf.appendChar(ModuleFlags.value(m.flags)); // module_flags
+        databuf.appendChar(m.version != null ? pool.put(m.version) : 0);
 
         ListBuffer<RequiresDirective> requires = new ListBuffer<>();
         for (RequiresDirective r: m.requires) {
@@ -964,21 +973,22 @@
         }
         databuf.appendChar(requires.size());
         for (RequiresDirective r: requires) {
-            databuf.appendChar(pool.put(names.fromUtf(externalize(r.module.name))));
+            databuf.appendChar(pool.put(r.module));
             databuf.appendChar(RequiresFlag.value(r.flags));
+            databuf.appendChar(r.module.version != null ? pool.put(r.module.version) : 0);
         }
 
         List<ExportsDirective> exports = m.exports;
         databuf.appendChar(exports.size());
         for (ExportsDirective e: exports) {
-            databuf.appendChar(pool.put(names.fromUtf(externalize(e.packge.flatName()))));
+            databuf.appendChar(pool.put(e.packge));
             databuf.appendChar(ExportsFlag.value(e.flags));
             if (e.modules == null) {
                 databuf.appendChar(0);
             } else {
                 databuf.appendChar(e.modules.size());
                 for (ModuleSymbol msym: e.modules) {
-                    databuf.appendChar(pool.put(names.fromUtf(externalize(msym.name))));
+                    databuf.appendChar(pool.put(msym));
                 }
             }
         }
@@ -986,14 +996,14 @@
         List<OpensDirective> opens = m.opens;
         databuf.appendChar(opens.size());
         for (OpensDirective o: opens) {
-            databuf.appendChar(pool.put(names.fromUtf(externalize(o.packge.flatName()))));
+            databuf.appendChar(pool.put(o.packge));
             databuf.appendChar(OpensFlag.value(o.flags));
             if (o.modules == null) {
                 databuf.appendChar(0);
             } else {
                 databuf.appendChar(o.modules.size());
                 for (ModuleSymbol msym: o.modules) {
-                    databuf.appendChar(pool.put(names.fromUtf(externalize(msym.name))));
+                    databuf.appendChar(pool.put(msym));
                 }
             }
         }
@@ -1718,7 +1728,8 @@
         databuf.appendChar(flags);
 
         if (c.owner.kind == MDL) {
-            databuf.appendChar(0);
+            PackageSymbol unnamed = ((ModuleSymbol) c.owner).unnamedPackage;
+            databuf.appendChar(pool.put(new ClassSymbol(0, names.module_info, unnamed)));
         } else {
             databuf.appendChar(pool.put(c));
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Dec 16 11:58:18 2016 -0800
@@ -476,8 +476,8 @@
                 STATIC | (c.flags() & STRICTFP),
                 names.clinit,
                 new MethodType(
-                    List.<Type>nil(), syms.voidType,
-                    List.<Type>nil(), syms.methodClass),
+                    List.nil(), syms.voidType,
+                    List.nil(), syms.methodClass),
                 c);
             c.members().enter(clinit);
             List<JCStatement> clinitStats = clinitCode.toList();
@@ -1037,11 +1037,11 @@
     }
 
     public void visitDoLoop(JCDoWhileLoop tree) {
-        genLoop(tree, tree.body, tree.cond, List.<JCExpressionStatement>nil(), false);
+        genLoop(tree, tree.body, tree.cond, List.nil(), false);
     }
 
     public void visitWhileLoop(JCWhileLoop tree) {
-        genLoop(tree, tree.body, tree.cond, List.<JCExpressionStatement>nil(), true);
+        genLoop(tree, tree.body, tree.cond, List.nil(), true);
     }
 
     public void visitForLoop(JCForLoop tree) {
@@ -1321,7 +1321,7 @@
             }
         };
         syncEnv.info.gaps = new ListBuffer<>();
-        genTry(tree.body, List.<JCCatch>nil(), syncEnv);
+        genTry(tree.body, List.nil(), syncEnv);
         code.endScopes(limit);
     }
 
@@ -1903,7 +1903,7 @@
                     List.of(syms.objectType), true);
         } else {
             callMethod(pos, syms.objectType, names.getClass,
-                    List.<Type>nil(), false);
+                    List.nil(), false);
         }
         code.emitop0(pop);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ModuleNameReader.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ModuleNameReader.java	Fri Dec 16 11:58:18 2016 -0800
@@ -100,30 +100,24 @@
         if (access_flags != 0x8000)
             throw new BadClassFile("invalid access flags for module: 0x" + Integer.toHexString(access_flags));
 
-        // FIXME: temporary compatibility code
         int this_class = nextChar();
-        if (this_class == 0) {
-            // new form
-            checkZero(nextChar(), "super_class");
-            checkZero(nextChar(), "interface_count");
-            checkZero(nextChar(), "fields_count");
-            checkZero(nextChar(), "methods_count");
-            int attributes_count = nextChar();
-            for (int i = 0; i < attributes_count; i++) {
-                int attr_name = nextChar();
-                int attr_length = nextInt();
-                if (getUtf8Value(attr_name, false).equals("Module") && attr_length > 2) {
-                    return getUtf8Value(nextChar(), true);
-                } else {
-                    // skip over unknown attributes
-                    bp += attr_length;
-                }
+        // could, should, check this_class == CONSTANT_Class("mdoule-info")
+        checkZero(nextChar(), "super_class");
+        checkZero(nextChar(), "interface_count");
+        checkZero(nextChar(), "fields_count");
+        checkZero(nextChar(), "methods_count");
+        int attributes_count = nextChar();
+        for (int i = 0; i < attributes_count; i++) {
+            int attr_name = nextChar();
+            int attr_length = nextInt();
+            if (getUtf8Value(attr_name, false).equals("Module") && attr_length > 2) {
+                return getModuleName(nextChar());
+            } else {
+                // skip over unknown attributes
+                bp += attr_length;
             }
-            throw new BadClassFile("no Module attribute");
-        } else {
-            // old form
-            return readModuleInfoName(this_class);
         }
+        throw new BadClassFile("no Module attribute");
     }
 
     void checkZero(int count, String name) throws BadClassFile {
@@ -172,6 +166,8 @@
             case CONSTANT_Class:
             case CONSTANT_String:
             case CONSTANT_MethodType:
+            case CONSTANT_Module:
+            case CONSTANT_Package:
                 bp = bp + 2;
                 break;
             case CONSTANT_MethodHandle:
@@ -211,33 +207,13 @@
         throw new BadClassFile("bad name at index " + index);
     }
 
-    /** Read the class name of a module-info.class file.
-     * The name is stored in a CONSTANT_Class entry, where the
-     * class name is of the form module-name/module-info.
-     */
-    String readModuleInfoName(int i) throws BadClassFile {
-        int classIndex = poolIdx[i];
-        if (buf[classIndex] == CONSTANT_Class) {
-            int utf8Index = poolIdx[getChar(classIndex + 1)];
-            if (buf[utf8Index] == CONSTANT_Utf8) {
-                int len = getChar(utf8Index + 1);
-                int start = utf8Index + 3;
-                String suffix = "/module-info";
-                if (endsWith(buf, start, len, suffix))
-                    return new String(ClassFile.internalize(buf, start, len - suffix.length()));
-            }
+    String getModuleName(int index) throws BadClassFile {
+        int infoIndex = poolIdx[index];
+        if (buf[infoIndex] == CONSTANT_Module) {
+            return getUtf8Value(getChar(infoIndex + 1), true);
+        } else {
+            throw new BadClassFile("bad module name at index " + index);
         }
-        throw new BadClassFile("bad module-info name");
-    }
-
-    private boolean endsWith(byte[] buf, int start, int len, String suffix) {
-        if (len <= suffix.length())
-            return false;
-        for (int i = 0; i < suffix.length(); i++) {
-            if (buf[start + len - suffix.length() + i] != suffix.charAt(i))
-                return false;
-        }
-        return true;
     }
 
     private static byte[] readInputStream(byte[] buf, InputStream s) throws IOException {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java	Fri Dec 16 11:58:18 2016 -0800
@@ -365,16 +365,8 @@
             Assert.check(!refSym.owner.isInterface() || interfaceOwner);
         }
         //where
-                Filter<Name> nonInitFilter = new Filter<Name>() {
-                    public boolean accepts(Name n) {
-                        return n != n.table.names.init && n != n.table.names.clinit;
-                    }
-                };
+                Filter<Name> nonInitFilter = n -> (n != n.table.names.init && n != n.table.names.clinit);
 
-                Filter<Name> initFilter = new Filter<Name>() {
-                    public boolean accepts(Name n) {
-                        return n == n.table.names.init;
-                    }
-                };
+                Filter<Name> initFilter = n -> n == n.table.names.init;
     }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java	Fri Dec 16 11:58:18 2016 -0800
@@ -224,7 +224,7 @@
             JCDiagnostic.DiagnosticPosition pos = tree.pos();
             gen.getCode().emitop2(new_, gen.makeRef(pos, syms.stringBuilderType));
             gen.getCode().emitop0(dup);
-            gen.callMethod(pos, syms.stringBuilderType, names.init, List.<Type>nil(), false);
+            gen.callMethod(pos, syms.stringBuilderType, names.init, List.nil(), false);
             return pos;
         }
 
@@ -245,7 +245,7 @@
         }
 
         private void builderToString(JCDiagnostic.DiagnosticPosition pos) {
-            gen.callMethod(pos, syms.stringBuilderType, names.toString, List.<Type>nil(), false);
+            gen.callMethod(pos, syms.stringBuilderType, names.toString, List.nil(), false);
         }
     }
 
@@ -353,7 +353,7 @@
         private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, List<Type> dynamicArgTypes) {
             Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
                     type,
-                    List.<Type>nil(),
+                    List.nil(),
                     syms.methodClass);
 
             int prevPos = make.pos;
@@ -457,7 +457,7 @@
         private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, String recipe, List<Object> staticArgs, List<Type> dynamicArgTypes) {
             Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
                     type,
-                    List.<Type>nil(),
+                    List.nil(),
                     syms.methodClass);
 
             int prevPos = make.pos;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Fri Dec 16 11:58:18 2016 -0800
@@ -582,7 +582,8 @@
                 Option.BOOT_CLASS_PATH,
                 Option.XBOOTCLASSPATH_PREPEND, Option.XBOOTCLASSPATH, Option.XBOOTCLASSPATH_APPEND,
                 Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
-                Option.EXTDIRS, Option.DJAVA_EXT_DIRS);
+                Option.EXTDIRS, Option.DJAVA_EXT_DIRS,
+                Option.PROFILE);
 
         checkOptionAllowed(t.compareTo(Target.JDK1_9) >= 0,
                 option -> error("err.option.not.allowed.with.target", option.getPrimaryName(), t.name),
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Dec 16 11:58:18 2016 -0800
@@ -337,12 +337,7 @@
      * SourceCompleter that delegates to the readSourceFile method of this class.
      */
     protected final Symbol.Completer sourceCompleter =
-            new Symbol.Completer() {
-                @Override
-                public void complete(Symbol sym) throws CompletionFailure {
-                    readSourceFile((ClassSymbol) sym);
-                }
-            };
+            sym -> readSourceFile((ClassSymbol) sym);
 
     protected final ModuleFinder.ModuleInfoSourceFileCompleter moduleInfoSourceFileCompleter =
             fo -> (ModuleSymbol) readSourceFile(parseImplicitFile(fo), null, tl -> {
@@ -588,7 +583,7 @@
     }
 
     protected final <T> List<T> stopIfError(CompileState cs, List<T> list) {
-        return shouldStop(cs) ? List.<T>nil() : list;
+        return shouldStop(cs) ? List.nil() : list;
     }
 
     /** The number of warnings reported so far.
@@ -617,7 +612,7 @@
      */
     protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) {
         long msec = now();
-        JCCompilationUnit tree = make.TopLevel(List.<JCTree>nil());
+        JCCompilationUnit tree = make.TopLevel(List.nil());
         if (content != null) {
             if (verbose) {
                 log.printVerbose("parsing.started", filename);
@@ -730,7 +725,7 @@
                                       : make.Select(tree, names.fromString(s));
             }
             JCCompilationUnit toplevel =
-                make.TopLevel(List.<JCTree>nil());
+                make.TopLevel(List.nil());
             toplevel.modle = msym;
             toplevel.packge = msym.unnamedPackage;
             return attr.attribIdent(tree, toplevel);
@@ -797,7 +792,7 @@
             return t;
         } catch (IOException e) {
             log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
-            return make.TopLevel(List.<JCTree>nil());
+            return make.TopLevel(List.nil());
         } finally {
             log.useSource(prev);
         }
@@ -891,7 +886,7 @@
 
     public void compile(List<JavaFileObject> sourceFileObject)
         throws Throwable {
-        compile(sourceFileObject, List.<String>nil(), null);
+        compile(sourceFileObject, List.nil(), null);
     }
 
     /**
@@ -1154,7 +1149,7 @@
 
     // TODO: called by JavacTaskImpl
     public void processAnnotations(List<JCCompilationUnit> roots) {
-        processAnnotations(roots, List.<String>nil());
+        processAnnotations(roots, List.nil());
     }
 
     /**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Fri Dec 16 11:58:18 2016 -0800
@@ -35,16 +35,12 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.EnumSet;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.Locale;
-import java.util.Map;
 import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
@@ -60,7 +56,6 @@
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.platform.PlatformProvider;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
-import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.JDK9Wrappers;
 import com.sun.tools.javac.util.Log;
@@ -342,7 +337,7 @@
         }
     },
 
-    VERSION("-version", "opt.version", STANDARD, INFO) {
+    VERSION("--version -version", "opt.version", STANDARD, INFO) {
         @Override
         public void process(OptionHelper helper, String option) throws InvalidValueException {
             Log log = helper.getLog();
@@ -352,7 +347,7 @@
         }
     },
 
-    FULLVERSION("-fullversion", null, HIDDEN, INFO) {
+    FULLVERSION("--full-version -fullversion", null, HIDDEN, INFO) {
         @Override
         public void process(OptionHelper helper, String option) throws InvalidValueException {
             Log log = helper.getLog();
@@ -402,7 +397,7 @@
         }
     },
 
-    X("-X", "opt.X", STANDARD, INFO) {
+    X("--help-extra -X", "opt.X", STANDARD, INFO) {
         @Override
         public void process(OptionHelper helper, String option) throws InvalidValueException {
             Log log = helper.getLog();
@@ -634,6 +629,33 @@
         }
     },
 
+    MODULE_VERSION("--module-version", "opt.arg.module.version", "opt.module.version", STANDARD, BASIC) {
+        @Override
+        public void process(OptionHelper helper, String option, String arg) throws InvalidValueException {
+            if (arg.isEmpty()) {
+                throw helper.newInvalidValueException("err.no.value.for.option", option);
+            } else {
+                try {
+                    Class.forName(JDK9Wrappers.ModuleDescriptor.Version.CLASSNAME);
+                    // use official parser if available
+                    try {
+                        JDK9Wrappers.ModuleDescriptor.Version.parse(arg);
+                    } catch (IllegalArgumentException e) {
+                        throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
+                    }
+                } catch (ClassNotFoundException ex) {
+                    // fall-back to simplistic rules when running on older platform
+                    if (!(arg.charAt(0) >= '0' && arg.charAt(0) <= '9') ||
+                        arg.endsWith("-") ||
+                        arg.endsWith("+")) {
+                        throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
+                    }
+                }
+            }
+            super.process(helper, option, arg);
+        }
+    },
+
     // This option exists only for the purpose of documenting itself.
     // It's actually implemented by the CommandLine class.
     AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO, ArgKind.ADJACENT) {
@@ -681,7 +703,7 @@
         @Override
         public void process(OptionHelper helper, String option) throws InvalidValueException {
             try {
-                Class.forName(JDK9Wrappers.VMHelper.VM_CLASSNAME);
+                Class.forName(JDK9Wrappers.VMHelper.CLASSNAME);
                 String[] runtimeArgs = JDK9Wrappers.VMHelper.getRuntimeArguments();
                 for (String arg : runtimeArgs) {
                     // Handle any supported runtime options; ignore all others.
@@ -1035,7 +1057,7 @@
      * @param helper a helper to provide access to the environment
      * @param arg the arg string that identified this option
      * @param rest the remaining strings to be analysed
-     * @return true if the operation was successful, and false otherwise
+     * @throws InvalidValueException if the value of the option was invalid
      * @implNote The return value is the opposite of that used by {@link #process}.
      */
     public void handleOption(OptionHelper helper, String arg, Iterator<String> rest) throws InvalidValueException {
@@ -1084,6 +1106,7 @@
      * @param option the option to be processed
      * @param arg the value to associate with the option, or a default value
      *  to be used if the option does not otherwise take an argument.
+     * @throws InvalidValueException if an error occurred
      */
     public void process(OptionHelper helper, String option, String arg) throws InvalidValueException {
         if (choices != null) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/FilteredMemberList.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/FilteredMemberList.java	Fri Dec 16 11:58:18 2016 -0800
@@ -71,11 +71,7 @@
 
     // A more efficient implementation than AbstractList's.
     public Iterator<Symbol> iterator() {
-        return scope.getSymbols(new Filter<Symbol>() {
-            public boolean accepts(Symbol t) {
-                return !unwanted(t);
-            }
-        }, NON_RECURSIVE).iterator();
+        return scope.getSymbols(t -> !unwanted(t), NON_RECURSIVE).iterator();
     }
 
     /**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Fri Dec 16 11:58:18 2016 -0800
@@ -25,8 +25,11 @@
 
 package com.sun.tools.javac.model;
 
+import java.util.LinkedHashSet;
 import java.util.Map;
+import java.util.Set;
 
+import javax.lang.model.AnnotatedConstruct;
 import javax.lang.model.SourceVersion;
 import javax.lang.model.element.*;
 import javax.lang.model.type.DeclaredType;
@@ -37,6 +40,13 @@
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Attribute.Compound;
+import com.sun.tools.javac.code.Directive.ExportsDirective;
+import com.sun.tools.javac.code.Directive.ExportsFlag;
+import com.sun.tools.javac.code.Directive.OpensDirective;
+import com.sun.tools.javac.code.Directive.OpensFlag;
+import com.sun.tools.javac.code.Directive.RequiresDirective;
+import com.sun.tools.javac.code.Directive.RequiresFlag;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.AttrContext;
@@ -54,9 +64,9 @@
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
-import com.sun.tools.javac.comp.CompileStates;
-import com.sun.tools.javac.comp.CompileStates.CompileState;
 import com.sun.tools.javac.comp.Modules;
+import com.sun.tools.javac.comp.Resolve;
+import com.sun.tools.javac.comp.Resolve.RecoveryLoadClass;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /**
@@ -75,8 +85,8 @@
     private final Names names;
     private final Types types;
     private final Enter enter;
+    private final Resolve resolve;
     private final JavacTaskImpl javacTaskImpl;
-    private final CompileStates compileStates;
 
     public static JavacElements instance(Context context) {
         JavacElements instance = context.get(JavacElements.class);
@@ -93,14 +103,16 @@
         names = Names.instance(context);
         types = Types.instance(context);
         enter = Enter.instance(context);
+        resolve = Resolve.instance(context);
         JavacTask t = context.get(JavacTask.class);
         javacTaskImpl = t instanceof JavacTaskImpl ? (JavacTaskImpl) t : null;
-        compileStates = CompileStates.instance(context);
     }
 
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public ModuleSymbol getModuleElement(CharSequence name) {
         ensureEntered("getModuleElement");
+        if (modules.getDefaultModule() == syms.noModule)
+            return null;
         String strName = name.toString();
         if (strName.equals(""))
             return syms.unnamedModule;
@@ -109,32 +121,77 @@
 
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public PackageSymbol getPackageElement(CharSequence name) {
-        ensureEntered("getPackageElement");
-        return getPackageElement(modules.getDefaultModule(), name);
+        return doGetPackageElement(null, name);
     }
 
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public PackageSymbol getPackageElement(ModuleElement module, CharSequence name) {
-        String strName = name.toString();
-        if (strName.equals(""))
+        module.getClass();
+        return doGetPackageElement(module, name);
+    }
+
+    private PackageSymbol doGetPackageElement(ModuleElement module, CharSequence name) {
+        ensureEntered("getPackageElement");
+        if (name.length() == 0)
             return syms.unnamedModule.unnamedPackage;
-        return SourceVersion.isName(strName)
-            ? nameToSymbol((ModuleSymbol) module, strName, PackageSymbol.class)
-            : null;
+        return doGetElement(module, name, PackageSymbol.class);
     }
 
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public ClassSymbol getTypeElement(CharSequence name) {
-        ensureEntered("getTypeElement");
-        return getTypeElement(modules.getDefaultModule(), name);
+        return doGetTypeElement(null, name);
     }
 
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public ClassSymbol getTypeElement(ModuleElement module, CharSequence name) {
+        module.getClass();
+
+        return doGetTypeElement(module, name);
+    }
+
+    private ClassSymbol doGetTypeElement(ModuleElement module, CharSequence name) {
+        ensureEntered("getTypeElement");
+        return doGetElement(module, name, ClassSymbol.class);
+    }
+
+    private <S extends Symbol> S doGetElement(ModuleElement module, CharSequence name, Class<S> clazz) {
         String strName = name.toString();
-        return SourceVersion.isName(strName)
-            ? nameToSymbol((ModuleSymbol) module, strName, ClassSymbol.class)
-            : null;
+        if (!SourceVersion.isName(strName)) {
+            return null;
+        }
+        if (module == null) {
+            return unboundNameToSymbol(strName, clazz);
+        } else {
+            return nameToSymbol((ModuleSymbol) module, strName, clazz);
+        }
+    }
+
+    private <S extends Symbol> S unboundNameToSymbol(String nameStr, Class<S> clazz) {
+        if (modules.getDefaultModule() == syms.noModule) { //not a modular mode:
+            return nameToSymbol(syms.noModule, nameStr, clazz);
+        }
+
+        RecoveryLoadClass prevRecoveryLoadClass = resolve.setRecoveryLoadClass((env, name) -> null);
+        try {
+            Set<S> found = new LinkedHashSet<>();
+
+            for (ModuleSymbol msym : modules.allModules()) {
+                S sym = nameToSymbol(msym, nameStr, clazz);
+
+                if (sym != null) {
+                    found.add(sym);
+                }
+            }
+
+            if (found.size() == 1) {
+                return found.iterator().next();
+            } else {
+                //not found, or more than one element found:
+                return null;
+            }
+        } finally {
+            resolve.setRecoveryLoadClass(prevRecoveryLoadClass);
+        }
     }
 
     /**
@@ -369,6 +426,8 @@
     @DefinedBy(Api.LANGUAGE_MODEL)
     public ModuleElement getModuleOf(Element e) {
         Symbol sym = cast(Symbol.class, e);
+        if (modules.getDefaultModule() == syms.noModule)
+            return null;
         return (sym.kind == MDL) ? ((ModuleElement) e) : sym.packge().modle;
     }
 
@@ -379,6 +438,52 @@
         return sym.isDeprecated();
     }
 
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    public Origin getOrigin(Element e) {
+        Symbol sym = cast(Symbol.class, e);
+        if ((sym.flags() & Flags.GENERATEDCONSTR) != 0)
+            return Origin.MANDATED;
+        //TypeElement.getEnclosedElements does not return synthetic elements,
+        //and most synthetic elements are not read from the classfile anyway:
+        return Origin.EXPLICIT;
+    }
+
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    public Origin getOrigin(AnnotatedConstruct c, AnnotationMirror a) {
+        Compound ac = cast(Compound.class, a);
+        if (ac.isSynthesized())
+            return Origin.MANDATED;
+        return Origin.EXPLICIT;
+    }
+
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    public Origin getOrigin(ModuleElement m, ModuleElement.Directive directive) {
+        switch (directive.getKind()) {
+            case REQUIRES:
+                RequiresDirective rd = cast(RequiresDirective.class, directive);
+                if (rd.flags.contains(RequiresFlag.MANDATED))
+                    return Origin.MANDATED;
+                if (rd.flags.contains(RequiresFlag.SYNTHETIC))
+                    return Origin.SYNTHETIC;
+                return Origin.EXPLICIT;
+            case EXPORTS:
+                ExportsDirective ed = cast(ExportsDirective.class, directive);
+                if (ed.flags.contains(ExportsFlag.MANDATED))
+                    return Origin.MANDATED;
+                if (ed.flags.contains(ExportsFlag.SYNTHETIC))
+                    return Origin.SYNTHETIC;
+                return Origin.EXPLICIT;
+            case OPENS:
+                OpensDirective od = cast(OpensDirective.class, directive);
+                if (od.flags.contains(OpensFlag.MANDATED))
+                    return Origin.MANDATED;
+                if (od.flags.contains(OpensFlag.SYNTHETIC))
+                    return Origin.SYNTHETIC;
+                return Origin.EXPLICIT;
+        }
+        return Origin.EXPLICIT;
+    }
+
     @DefinedBy(Api.LANGUAGE_MODEL)
     public Name getBinaryName(TypeElement type) {
         return cast(TypeSymbol.class, type).flatName();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Fri Dec 16 11:58:18 2016 -0800
@@ -683,7 +683,7 @@
             }
         }
 
-        return List.<DCTree>of(erroneous("dc.unterminated.inline.tag", pos));
+        return List.of(erroneous("dc.unterminated.inline.tag", pos));
     }
 
     protected void entity(ListBuffer<DCTree> list) {
@@ -1160,6 +1160,16 @@
                 }
             },
 
+            // @provides service-name description
+            new TagParser(Kind.BLOCK, DCTree.Kind.PROVIDES) {
+                public DCTree parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    DCReference ref = reference(true);
+                    List<DCTree> description = blockContent();
+                    return m.at(pos).newProvidesTree(ref, description);
+                }
+            },
+
             // @return description
             new TagParser(Kind.BLOCK, DCTree.Kind.RETURN) {
                 public DCTree parse(int pos) {
@@ -1261,6 +1271,16 @@
                 }
             },
 
+            // @uses service-name description
+            new TagParser(Kind.BLOCK, DCTree.Kind.USES) {
+                public DCTree parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    DCReference ref = reference(true);
+                    List<DCTree> description = blockContent();
+                    return m.at(pos).newUsesTree(ref, description);
+                }
+            },
+
             // {@value package.class#field}
             new TagParser(Kind.INLINE, DCTree.Kind.VALUE) {
                 public DCTree parse(int pos) throws ParseException {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Dec 16 11:58:18 2016 -0800
@@ -418,7 +418,7 @@
     }
 
     protected JCErroneous syntaxError(int pos, String key, TokenKind... args) {
-        return syntaxError(pos, List.<JCTree>nil(), key, args);
+        return syntaxError(pos, List.nil(), key, args);
     }
 
     protected JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) {
@@ -1718,11 +1718,7 @@
     }
 
     /** Accepts all identifier-like tokens */
-    protected Filter<TokenKind> LAX_IDENTIFIER = new Filter<TokenKind>() {
-        public boolean accepts(TokenKind t) {
-            return t == IDENTIFIER || t == UNDERSCORE || t == ASSERT || t == ENUM;
-        }
-    };
+    protected Filter<TokenKind> LAX_IDENTIFIER = t -> t == IDENTIFIER || t == UNDERSCORE || t == ASSERT || t == ENUM;
 
     enum ParensResult {
         CAST,
@@ -1886,7 +1882,7 @@
                 return args.toList();
             }
         } else {
-            return List.<JCExpression>of(syntaxError(token.pos, "expected", LT));
+            return List.of(syntaxError(token.pos, "expected", LT));
         }
     }
 
@@ -1971,7 +1967,7 @@
     /** BracketsOpt = [ "[" "]" { [Annotations] "[" "]"} ]
      */
     private JCExpression bracketsOpt(JCExpression t) {
-        return bracketsOpt(t, List.<JCAnnotation>nil());
+        return bracketsOpt(t, List.nil());
     }
 
     private JCExpression bracketsOptCont(JCExpression t, int pos,
@@ -2151,7 +2147,7 @@
         } else {
             setErrorEndPos(token.pos);
             reportSyntaxError(token.pos, "expected2", LPAREN, LBRACKET);
-            t = toP(F.at(newpos).NewClass(null, typeArgs, t, List.<JCExpression>nil(), null));
+            t = toP(F.at(newpos).NewClass(null, typeArgs, t, List.nil(), null));
             return toP(F.at(newpos).Erroneous(List.<JCTree>of(t)));
         }
     }
@@ -2201,8 +2197,8 @@
                 }
                 return na;
             } else {
-                JCExpression t = toP(F.at(newpos).NewArray(elemtype, List.<JCExpression>nil(), null));
-                return syntaxError(token.pos, List.<JCTree>of(t), "array.dimension.missing");
+                JCExpression t = toP(F.at(newpos).NewArray(elemtype, List.nil(), null));
+                return syntaxError(token.pos, List.of(t), "array.dimension.missing");
             }
         } else {
             ListBuffer<JCExpression> dims = new ListBuffer<>();
@@ -2271,7 +2267,7 @@
             }
         }
         accept(RBRACE);
-        return toP(F.at(newpos).NewArray(t, List.<JCExpression>nil(), elems.toList()));
+        return toP(F.at(newpos).NewArray(t, List.nil(), elems.toList()));
     }
 
     /** VariableInitializer = ArrayInitializer | Expression
@@ -2424,7 +2420,7 @@
             if (token.kind == COLON && t.hasTag(IDENT)) {
                 nextToken();
                 JCStatement stat = parseStatementAsBlock();
-                return List.<JCStatement>of(F.at(pos).Labelled(prevToken.name(), stat));
+                return List.of(F.at(pos).Labelled(prevToken.name(), stat));
             } else if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
                 pos = token.pos;
                 JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
@@ -2440,7 +2436,7 @@
                 t = checkExprStat(t);
                 accept(SEMI);
                 JCExpressionStatement expr = toP(F.at(pos).Exec(t));
-                return List.<JCStatement>of(expr);
+                return List.of(expr);
             }
         }
     }
@@ -2482,7 +2478,7 @@
         case FOR: {
             nextToken();
             accept(LPAREN);
-            List<JCStatement> inits = token.kind == SEMI ? List.<JCStatement>nil() : forInit();
+            List<JCStatement> inits = token.kind == SEMI ? List.nil() : forInit();
             if (inits.length() == 1 &&
                 inits.head.hasTag(VARDEF) &&
                 ((JCVariableDecl) inits.head).init == null &&
@@ -2497,7 +2493,7 @@
                 accept(SEMI);
                 JCExpression cond = token.kind == SEMI ? null : parseExpression();
                 accept(SEMI);
-                List<JCExpressionStatement> steps = token.kind == RPAREN ? List.<JCExpressionStatement>nil() : forUpdate();
+                List<JCExpressionStatement> steps = token.kind == RPAREN ? List.nil() : forUpdate();
                 accept(RPAREN);
                 JCStatement body = parseStatementAsBlock();
                 return F.at(pos).ForLoop(inits, cond, steps, body);
@@ -2520,7 +2516,7 @@
         }
         case TRY: {
             nextToken();
-            List<JCTree> resources = List.<JCTree>nil();
+            List<JCTree> resources = List.nil();
             if (token.kind == LPAREN) {
                 checkTryWithResources();
                 nextToken();
@@ -2630,7 +2626,7 @@
         int errPos = S.errPos();
         JCTree stm = action.doRecover(this);
         S.errPos(errPos);
-        return toP(F.Exec(syntaxError(startPos, List.<JCTree>of(stm), key)));
+        return toP(F.Exec(syntaxError(startPos, List.of(stm), key)));
     }
 
     /** CatchClause     = CATCH "(" FormalParameter ")" Block
@@ -2886,7 +2882,7 @@
     }
 
     List<JCExpression> annotationFieldValuesOpt() {
-        return (token.kind == LPAREN) ? annotationFieldValues() : List.<JCExpression>nil();
+        return (token.kind == LPAREN) ? annotationFieldValues() : List.nil();
     }
 
     /** AnnotationFieldValues   = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" */
@@ -2949,7 +2945,7 @@
                 }
             }
             accept(RBRACE);
-            return toP(F.at(pos).NewArray(null, List.<JCExpression>nil(), buf.toList()));
+            return toP(F.at(pos).NewArray(null, List.nil(), buf.toList()));
         default:
             mode = EXPR;
             return term1();
@@ -3346,10 +3342,10 @@
             int pos = token.pos;
             List<JCTree> errs;
             if (LAX_IDENTIFIER.accepts(token.kind)) {
-                errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
+                errs = List.of(mods, toP(F.at(pos).Ident(ident())));
                 setErrorEndPos(token.pos);
             } else {
-                errs = List.<JCTree>of(mods);
+                errs = List.of(mods);
             }
             return toP(F.Exec(syntaxError(pos, errs, "expected3",
                                           CLASS, INTERFACE, ENUM)));
@@ -3427,7 +3423,7 @@
         List<JCTree> defs = enumBody(name);
         mods.flags |= Flags.ENUM;
         JCClassDecl result = toP(F.at(pos).
-            ClassDef(mods, name, List.<JCTypeParameter>nil(),
+            ClassDef(mods, name, List.nil(),
                      null, implementing, defs));
         attach(result, dc);
         return result;
@@ -3485,7 +3481,7 @@
         Name name = ident();
         int createPos = token.pos;
         List<JCExpression> args = (token.kind == LPAREN)
-            ? arguments() : List.<JCExpression>nil();
+            ? arguments() : List.nil();
         JCClassDecl body = null;
         if (token.kind == LBRACE) {
             JCModifiers mods1 = F.at(Position.NOPOS).Modifiers(Flags.ENUM);
@@ -3571,7 +3567,7 @@
     protected List<JCTree> classOrInterfaceBodyDeclaration(Name className, boolean isInterface) {
         if (token.kind == SEMI) {
             nextToken();
-            return List.<JCTree>nil();
+            return List.nil();
         } else {
             Comment dc = token.comment(CommentStyle.JAVADOC);
             int pos = token.pos;
@@ -3579,14 +3575,14 @@
             if (token.kind == CLASS ||
                 token.kind == INTERFACE ||
                 token.kind == ENUM) {
-                return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
+                return List.of(classOrInterfaceOrEnumDeclaration(mods, dc));
             } else if (token.kind == LBRACE &&
                        (mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
                        mods.annotations.isEmpty()) {
                 if (isInterface) {
                     error(token.pos, "initializer.not.allowed");
                 }
-                return List.<JCTree>of(block(pos, mods.flags));
+                return List.of(block(pos, mods.flags));
             } else {
                 pos = token.pos;
                 List<JCTypeParameter> typarams = typeParametersOpt();
@@ -3641,10 +3637,10 @@
                     } else {
                         pos = token.pos;
                         List<JCTree> err = isVoid
-                            ? List.<JCTree>of(toP(F.at(pos).MethodDef(mods, name, type, typarams,
-                                List.<JCVariableDecl>nil(), List.<JCExpression>nil(), null, null)))
+                            ? List.of(toP(F.at(pos).MethodDef(mods, name, type, typarams,
+                                List.nil(), List.nil(), null, null)))
                             : null;
-                        return List.<JCTree>of(syntaxError(token.pos, err, "expected", LPAREN));
+                        return List.of(syntaxError(token.pos, err, "expected", LPAREN));
                     }
                 }
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Fri Dec 16 11:58:18 2016 -0800
@@ -51,6 +51,9 @@
 import static javax.tools.StandardLocation.CLASS_OUTPUT;
 
 import com.sun.tools.javac.code.Lint;
+import com.sun.tools.javac.code.Symbol.ModuleSymbol;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
 
@@ -114,10 +117,12 @@
      */
     private class FilerOutputFileObject extends ForwardingFileObject<FileObject> {
         private boolean opened = false;
+        private ModuleSymbol mod;
         private String name;
 
-        FilerOutputFileObject(String name, FileObject fileObject) {
+        FilerOutputFileObject(ModuleSymbol mod, String name, FileObject fileObject) {
             super(fileObject);
+            this.mod = mod;
             this.name = name;
         }
 
@@ -126,7 +131,7 @@
             if (opened)
                 throw new IOException(ALREADY_OPENED);
             opened = true;
-            return new FilerOutputStream(name, fileObject);
+            return new FilerOutputStream(mod, name, fileObject);
         }
 
         @Override @DefinedBy(Api.COMPILER)
@@ -134,7 +139,7 @@
             if (opened)
                 throw new IOException(ALREADY_OPENED);
             opened = true;
-            return new FilerWriter(name, fileObject);
+            return new FilerWriter(mod, name, fileObject);
         }
 
         // Three anti-literacy methods
@@ -161,8 +166,8 @@
 
     private class FilerOutputJavaFileObject extends FilerOutputFileObject implements JavaFileObject {
         private final JavaFileObject javaFileObject;
-        FilerOutputJavaFileObject(String name, JavaFileObject javaFileObject) {
-            super(name, javaFileObject);
+        FilerOutputJavaFileObject(ModuleSymbol mod, String name, JavaFileObject javaFileObject) {
+            super(mod, name, javaFileObject);
             this.javaFileObject = javaFileObject;
         }
 
@@ -248,6 +253,7 @@
      * when they are closed.
      */
     private class FilerOutputStream extends FilterOutputStream {
+        ModuleSymbol mod;
         String typeName;
         FileObject fileObject;
         boolean closed = false;
@@ -256,8 +262,9 @@
          * @param typeName name of class or {@code null} if just a
          * binary file
          */
-        FilerOutputStream(String typeName, FileObject fileObject) throws IOException {
+        FilerOutputStream(ModuleSymbol mod, String typeName, FileObject fileObject) throws IOException {
             super(fileObject.openOutputStream());
+            this.mod = mod;
             this.typeName = typeName;
             this.fileObject = fileObject;
         }
@@ -270,7 +277,7 @@
                  * stream, still try to process the file.
                  */
 
-                closeFileObject(typeName, fileObject);
+                closeFileObject(mod, typeName, fileObject);
                 out.close();
             }
         }
@@ -282,6 +289,7 @@
      * closed.
      */
     private class FilerWriter extends FilterWriter {
+        ModuleSymbol mod;
         String typeName;
         FileObject fileObject;
         boolean closed = false;
@@ -291,8 +299,9 @@
          * @param typeName name of source file or {@code null} if just a
          * text file
          */
-        FilerWriter(String typeName, FileObject fileObject) throws IOException {
+        FilerWriter(ModuleSymbol mod, String typeName, FileObject fileObject) throws IOException {
             super(fileObject.openWriter());
+            this.mod = mod;
             this.typeName = typeName;
             this.fileObject = fileObject;
         }
@@ -305,7 +314,7 @@
                  * Writer, still try to process the file.
                  */
 
-                closeFileObject(typeName, fileObject);
+                closeFileObject(mod, typeName, fileObject);
                 out.close();
             }
         }
@@ -313,6 +322,9 @@
 
     JavaFileManager fileManager;
     Log log;
+    Modules modules;
+    Names names;
+    Symtab syms;
     Context context;
     boolean lastRound;
 
@@ -340,7 +352,7 @@
      * This set must be synchronized.  Its iterators should preserve
      * insertion order.
      */
-    private final Map<String, JavaFileObject> generatedClasses;
+    private final Map<ModuleSymbol, Map<String, JavaFileObject>> generatedClasses;
 
     /**
      * JavaFileObjects for source files closed in this round.  This
@@ -353,13 +365,13 @@
      * Names of all created source files.  Its iterators should
      * preserve insertion order.
      */
-    private final Set<String> aggregateGeneratedSourceNames;
+    private final Set<Pair<ModuleSymbol, String>> aggregateGeneratedSourceNames;
 
     /**
      * Names of all created class files.  Its iterators should
      * preserve insertion order.
      */
-    private final Set<String> aggregateGeneratedClassNames;
+    private final Set<Pair<ModuleSymbol, String>> aggregateGeneratedClassNames;
 
 
     JavacFiler(Context context) {
@@ -367,12 +379,15 @@
         fileManager = context.get(JavaFileManager.class);
 
         log = Log.instance(context);
+        modules = Modules.instance(context);
+        names = Names.instance(context);
+        syms = Symtab.instance(context);
 
         fileObjectHistory = synchronizedSet(new LinkedHashSet<FileObject>());
         generatedSourceNames = synchronizedSet(new LinkedHashSet<String>());
         generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<JavaFileObject>());
 
-        generatedClasses = synchronizedMap(new LinkedHashMap<String, JavaFileObject>());
+        generatedClasses = synchronizedMap(new LinkedHashMap<>());
 
         openTypeNames  = synchronizedSet(new LinkedHashSet<String>());
 
@@ -382,19 +397,51 @@
         lint = (Lint.instance(context)).isEnabled(PROCESSING);
     }
 
-    @DefinedBy(Api.ANNOTATION_PROCESSING)
-    public JavaFileObject createSourceFile(CharSequence name,
+    @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
+    public JavaFileObject createSourceFile(CharSequence nameAndModule,
                                            Element... originatingElements) throws IOException {
-        return createSourceOrClassFile(true, name.toString());
+        Pair<ModuleSymbol, String> moduleAndClass = checkOrInferModule(nameAndModule);
+        return createSourceOrClassFile(moduleAndClass.fst, true, moduleAndClass.snd);
+    }
+
+    @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
+    public JavaFileObject createClassFile(CharSequence nameAndModule,
+                                          Element... originatingElements) throws IOException {
+        Pair<ModuleSymbol, String> moduleAndClass = checkOrInferModule(nameAndModule);
+        return createSourceOrClassFile(moduleAndClass.fst, false, moduleAndClass.snd);
     }
 
-    @DefinedBy(Api.ANNOTATION_PROCESSING)
-    public JavaFileObject createClassFile(CharSequence name,
-                                           Element... originatingElements) throws IOException {
-        return createSourceOrClassFile(false, name.toString());
+    private Pair<ModuleSymbol, String> checkOrInferModule(CharSequence moduleAndPkg) throws FilerException {
+        String moduleAndPkgString = moduleAndPkg.toString();
+        int slash = moduleAndPkgString.indexOf('/');
+
+        if (slash != (-1)) {
+            //module name specified:
+            String module = moduleAndPkgString.substring(0, slash);
+
+            ModuleSymbol explicitModule = syms.getModule(names.fromString(module));
+
+            if (explicitModule == null) {
+                throw new FilerException("Module: " + module + " does not exist.");
+            }
+
+            if (!modules.isRootModule(explicitModule)) {
+                throw new FilerException("Cannot write to the given module!");
+            }
+
+            return Pair.of(explicitModule, moduleAndPkgString.substring(slash + 1));
+        } else {
+            if (modules.multiModuleMode) {
+                throw new FilerException("No module to write to specified!");
+            }
+
+            return Pair.of(modules.getDefaultModule(), moduleAndPkgString);
+        }
     }
 
-    private JavaFileObject createSourceOrClassFile(boolean isSourceFile, String name) throws IOException {
+    private JavaFileObject createSourceOrClassFile(ModuleSymbol mod, boolean isSourceFile, String name) throws IOException {
+        Assert.checkNonNull(mod);
+
         if (lint) {
             int periodIndex = name.lastIndexOf(".");
             if (periodIndex != -1) {
@@ -404,8 +451,12 @@
                     log.warning("proc.suspicious.class.name", name, extn);
             }
         }
-        checkNameAndExistence(name, isSourceFile);
+        checkNameAndExistence(mod, name, isSourceFile);
         Location loc = (isSourceFile ? SOURCE_OUTPUT : CLASS_OUTPUT);
+
+        if (modules.multiModuleMode) {
+            loc = this.fileManager.getLocationForModule(loc, mod.name.toString());
+        }
         JavaFileObject.Kind kind = (isSourceFile ?
                                     JavaFileObject.Kind.SOURCE :
                                     JavaFileObject.Kind.CLASS);
@@ -418,21 +469,30 @@
             log.warning("proc.file.create.last.round", name);
 
         if (isSourceFile)
-            aggregateGeneratedSourceNames.add(name);
+            aggregateGeneratedSourceNames.add(Pair.of(mod, name));
         else
-            aggregateGeneratedClassNames.add(name);
+            aggregateGeneratedClassNames.add(Pair.of(mod, name));
         openTypeNames.add(name);
 
-        return new FilerOutputJavaFileObject(name, fileObject);
+        return new FilerOutputJavaFileObject(mod, name, fileObject);
     }
 
-    @DefinedBy(Api.ANNOTATION_PROCESSING)
+    @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
     public FileObject createResource(JavaFileManager.Location location,
-                                     CharSequence pkg,
+                                     CharSequence moduleAndPkg,
                                      CharSequence relativeName,
                                      Element... originatingElements) throws IOException {
+        Pair<ModuleSymbol, String> moduleAndPackage = checkOrInferModule(moduleAndPkg);
+        ModuleSymbol msym = moduleAndPackage.fst;
+        String pkg = moduleAndPackage.snd;
+
         locationCheck(location);
 
+        if (modules.multiModuleMode) {
+            Assert.checkNonNull(msym);
+            location = this.fileManager.getLocationForModule(location, msym.name.toString());
+        }
+
         String strPkg = pkg.toString();
         if (strPkg.length() > 0)
             checkName(strPkg);
@@ -443,9 +503,9 @@
         checkFileReopening(fileObject, true);
 
         if (fileObject instanceof JavaFileObject)
-            return new FilerOutputJavaFileObject(null, (JavaFileObject)fileObject);
+            return new FilerOutputJavaFileObject(msym, null, (JavaFileObject)fileObject);
         else
-            return new FilerOutputFileObject(null, fileObject);
+            return new FilerOutputFileObject(msym, null, fileObject);
     }
 
     private void locationCheck(JavaFileManager.Location location) {
@@ -457,13 +517,21 @@
         }
     }
 
-    @DefinedBy(Api.ANNOTATION_PROCESSING)
+    @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
     public FileObject getResource(JavaFileManager.Location location,
-                                  CharSequence pkg,
+                                  CharSequence moduleAndPkg,
                                   CharSequence relativeName) throws IOException {
-        String strPkg = pkg.toString();
-        if (strPkg.length() > 0)
-            checkName(strPkg);
+        Pair<ModuleSymbol, String> moduleAndPackage = checkOrInferModule(moduleAndPkg);
+        ModuleSymbol msym = moduleAndPackage.fst;
+        String pkg = moduleAndPackage.snd;
+
+        if (modules.multiModuleMode) {
+            Assert.checkNonNull(msym);
+            location = this.fileManager.getLocationForModule(location, msym.name.toString());
+        }
+
+        if (pkg.length() > 0)
+            checkName(pkg);
 
         // TODO: Only support reading resources in selected output
         // locations?  Only allow reading of non-source, non-class
@@ -478,12 +546,12 @@
         FileObject fileObject;
         if (location.isOutputLocation()) {
             fileObject = fileManager.getFileForOutput(location,
-                    pkg.toString(),
+                    pkg,
                     relativeName.toString(),
                     null);
         } else {
             fileObject = fileManager.getFileForInput(location,
-                    pkg.toString(),
+                    pkg,
                     relativeName.toString());
         }
         if (fileObject == null) {
@@ -524,16 +592,19 @@
         }
     }
 
-    private void checkNameAndExistence(String typename, boolean allowUnnamedPackageInfo) throws FilerException {
+    private void checkNameAndExistence(ModuleSymbol mod, String typename, boolean allowUnnamedPackageInfo) throws FilerException {
         // TODO: Check if type already exists on source or class path?
         // If so, use warning message key proc.type.already.exists
         checkName(typename, allowUnnamedPackageInfo);
-        if (aggregateGeneratedSourceNames.contains(typename) ||
-            aggregateGeneratedClassNames.contains(typename)) {
+        if (aggregateGeneratedSourceNames.contains(Pair.of(mod, typename)) ||
+            aggregateGeneratedClassNames.contains(Pair.of(mod, typename))) {
             if (lint)
                 log.warning("proc.type.recreate", typename);
             throw new FilerException("Attempt to recreate a file for type " + typename);
         }
+        if (!mod.isUnnamed() && !typename.contains(".")) {
+            throw new FilerException("Attempt to create a type in unnamed package of a named module: " + typename);
+        }
     }
 
     /**
@@ -565,7 +636,7 @@
         return generatedSourceFileObjects;
     }
 
-    public Map<String, JavaFileObject> getGeneratedClasses() {
+    public Map<ModuleSymbol, Map<String, JavaFileObject>> getGeneratedClasses() {
         return generatedClasses;
     }
 
@@ -621,7 +692,7 @@
      * Upon close, register files opened by create{Source, Class}File
      * for annotation processing.
      */
-    private void closeFileObject(String typeName, FileObject fileObject) {
+    private void closeFileObject(ModuleSymbol mod, String typeName, FileObject fileObject) {
         /*
          * If typeName is non-null, the file object was opened as a
          * source or class file by the user.  If a file was opened as
@@ -640,7 +711,7 @@
                 break;
 
             case CLASS:
-                generatedClasses.put(typeName, javaFileObject);
+                generatedClasses.computeIfAbsent(mod, m -> Collections.synchronizedMap(new LinkedHashMap<>())).put(typeName, javaFileObject);
                 openTypeNames.remove(typeName);
                 break;
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Dec 16 11:58:18 2016 -0800
@@ -34,6 +34,7 @@
 import java.net.URL;
 import java.nio.file.Path;
 import java.util.*;
+import java.util.Map.Entry;
 import java.util.regex.*;
 import java.util.stream.Collectors;
 
@@ -323,7 +324,7 @@
         if (platformProvider != null) {
             platformProcessors = platformProvider.getAnnotationProcessors()
                                                  .stream()
-                                                 .map(ap -> ap.getPlugin())
+                                                 .map(PluginInfo::getPlugin)
                                                  .collect(Collectors.toList());
         }
         List<Iterator<? extends Processor>> iterators = List.of(processorIterator,
@@ -827,12 +828,14 @@
 
     private void discoverAndRunProcs(Set<TypeElement> annotationsPresent,
                                      List<ClassSymbol> topLevelClasses,
-                                     List<PackageSymbol> packageInfoFiles) {
+                                     List<PackageSymbol> packageInfoFiles,
+                                     List<ModuleSymbol> moduleInfoFiles) {
         Map<String, TypeElement> unmatchedAnnotations = new HashMap<>(annotationsPresent.size());
 
         for(TypeElement a  : annotationsPresent) {
-                unmatchedAnnotations.put(a.getQualifiedName().toString(),
-                                         a);
+            ModuleElement mod = elementUtils.getModuleOf(a);
+            unmatchedAnnotations.put((mod != null ? mod.getSimpleName() + "/" : "") + a.getQualifiedName().toString(),
+                                     a);
         }
 
         // Give "*" processors a chance to match
@@ -849,6 +852,7 @@
         Set<Element> rootElements = new LinkedHashSet<>();
         rootElements.addAll(topLevelClasses);
         rootElements.addAll(packageInfoFiles);
+        rootElements.addAll(moduleInfoFiles);
         rootElements = Collections.unmodifiableSet(rootElements);
 
         RoundEnvironment renv = new JavacRoundEnvironment(false,
@@ -986,7 +990,7 @@
         /** The trees that need to be cleaned - includes roots and implicitly parsed trees. */
         Set<JCCompilationUnit> treesToClean;
         /** The classes to be compiler that have were generated. */
-        Map<String, JavaFileObject> genClassFiles;
+        Map<ModuleSymbol, Map<String, JavaFileObject>> genClassFiles;
 
         /** The set of annotations to be processed this round. */
         Set<TypeElement> annotationsPresent;
@@ -994,6 +998,8 @@
         List<ClassSymbol> topLevelClasses;
         /** The set of package-info files to be processed this round. */
         List<PackageSymbol> packageInfoFiles;
+        /** The set of module-info files to be processed this round. */
+        List<ModuleSymbol> moduleInfoFiles;
 
         /** Create a round (common code). */
         private Round(int number, Set<JCCompilationUnit> treesToClean,
@@ -1011,6 +1017,7 @@
             // the following will be populated as needed
             topLevelClasses  = List.nil();
             packageInfoFiles = List.nil();
+            moduleInfoFiles = List.nil();
             this.treesToClean = treesToClean;
         }
 
@@ -1031,12 +1038,14 @@
 
             packageInfoFiles = getPackageInfoFiles(roots);
 
+            moduleInfoFiles = getModuleInfoFiles(roots);
+
             findAnnotationsPresent();
         }
 
         /** Create a new round. */
         private Round(Round prev,
-                Set<JavaFileObject> newSourceFiles, Map<String,JavaFileObject> newClassFiles) {
+                Set<JavaFileObject> newSourceFiles, Map<ModuleSymbol, Map<String,JavaFileObject>> newClassFiles) {
             this(prev.number+1, prev.treesToClean, null);
             prev.newRound();
             this.genClassFiles = prev.genClassFiles;
@@ -1048,9 +1057,13 @@
             if (unrecoverableError())
                 return;
 
+            roots = compiler.initModules(roots);
+
             enterClassFiles(genClassFiles);
             List<ClassSymbol> newClasses = enterClassFiles(newClassFiles);
-            genClassFiles.putAll(newClassFiles);
+            for (Entry<ModuleSymbol, Map<String, JavaFileObject>> moduleAndClassFiles : newClassFiles.entrySet()) {
+                genClassFiles.computeIfAbsent(moduleAndClassFiles.getKey(), m -> new LinkedHashMap<>()).putAll(moduleAndClassFiles.getValue());
+            }
             enterTrees(roots);
 
             if (unrecoverableError())
@@ -1064,11 +1077,13 @@
                     getPackageInfoFiles(parsedFiles),
                     getPackageInfoFilesFromClasses(newClasses));
 
+            moduleInfoFiles = List.nil(); //module-info cannot be generated
+
             findAnnotationsPresent();
         }
 
         /** Create the next round to be used. */
-        Round next(Set<JavaFileObject> newSourceFiles, Map<String, JavaFileObject> newClassFiles) {
+        Round next(Set<JavaFileObject> newSourceFiles, Map<ModuleSymbol, Map<String, JavaFileObject>> newClassFiles) {
             return new Round(this, newSourceFiles, newClassFiles);
         }
 
@@ -1121,45 +1136,47 @@
                 annotationComputer.scan(classSym, annotationsPresent);
             for (PackageSymbol pkgSym : packageInfoFiles)
                 annotationComputer.scan(pkgSym, annotationsPresent);
+            for (ModuleSymbol mdlSym : moduleInfoFiles)
+                annotationComputer.scan(mdlSym, annotationsPresent);
         }
 
         /** Enter a set of generated class files. */
-        private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
+        private List<ClassSymbol> enterClassFiles(Map<ModuleSymbol, Map<String, JavaFileObject>> modulesAndClassFiles) {
             List<ClassSymbol> list = List.nil();
 
-            for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
-                Name name = names.fromString(entry.getKey());
-                JavaFileObject file = entry.getValue();
-                if (file.getKind() != JavaFileObject.Kind.CLASS)
-                    throw new AssertionError(file);
-                ClassSymbol cs;
-                // TODO: for now, we assume that generated code is in a default module;
-                // in time, we need a way to be able to specify the module for generated code
-                if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
-                    Name packageName = Convert.packagePart(name);
-                    PackageSymbol p = symtab.enterPackage(defaultModule, packageName);
-                    if (p.package_info == null)
-                        p.package_info = symtab.enterClass(defaultModule, Convert.shortName(name), p);
-                    cs = p.package_info;
-                    cs.reset();
-                    if (cs.classfile == null)
+            for (Entry<ModuleSymbol, Map<String, JavaFileObject>> moduleAndClassFiles : modulesAndClassFiles.entrySet()) {
+                for (Map.Entry<String,JavaFileObject> entry : moduleAndClassFiles.getValue().entrySet()) {
+                    Name name = names.fromString(entry.getKey());
+                    JavaFileObject file = entry.getValue();
+                    if (file.getKind() != JavaFileObject.Kind.CLASS)
+                        throw new AssertionError(file);
+                    ClassSymbol cs;
+                    if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
+                        Name packageName = Convert.packagePart(name);
+                        PackageSymbol p = symtab.enterPackage(moduleAndClassFiles.getKey(), packageName);
+                        if (p.package_info == null)
+                            p.package_info = symtab.enterClass(moduleAndClassFiles.getKey(), Convert.shortName(name), p);
+                        cs = p.package_info;
+                        cs.reset();
+                        if (cs.classfile == null)
+                            cs.classfile = file;
+                        cs.completer = initialCompleter;
+                    } else {
+                        cs = symtab.enterClass(moduleAndClassFiles.getKey(), name);
+                        cs.reset();
                         cs.classfile = file;
-                    cs.completer = initialCompleter;
-                } else {
-                    cs = symtab.enterClass(defaultModule, name);
-                    cs.reset();
-                    cs.classfile = file;
-                    cs.completer = initialCompleter;
-                    cs.owner.members().enter(cs); //XXX - OverwriteBetweenCompilations; syms.getClass is not sufficient anymore
+                        cs.completer = initialCompleter;
+                        cs.owner.members().enter(cs); //XXX - OverwriteBetweenCompilations; syms.getClass is not sufficient anymore
+                    }
+                    list = list.prepend(cs);
                 }
-                list = list.prepend(cs);
             }
             return list.reverse();
         }
 
         /** Enter a set of syntax trees. */
         private void enterTrees(List<JCCompilationUnit> roots) {
-            compiler.enterTrees(compiler.initModules(roots));
+            compiler.enterTrees(roots);
         }
 
         /** Run a processing round. */
@@ -1179,7 +1196,7 @@
                             JavacProcessingEnvironment.this);
                     discoveredProcs.iterator().runContributingProcs(renv);
                 } else {
-                    discoverAndRunProcs(annotationsPresent, topLevelClasses, packageInfoFiles);
+                    discoverAndRunProcs(annotationsPresent, topLevelClasses, packageInfoFiles, moduleInfoFiles);
                 }
             } catch (Throwable t) {
                 // we're specifically expecting Abort here, but if any Throwable
@@ -1209,8 +1226,8 @@
         /** Print info about this round. */
         private void printRoundInfo(boolean lastRound) {
             if (printRounds || verbose) {
-                List<ClassSymbol> tlc = lastRound ? List.<ClassSymbol>nil() : topLevelClasses;
-                Set<TypeElement> ap = lastRound ? Collections.<TypeElement>emptySet() : annotationsPresent;
+                List<ClassSymbol> tlc = lastRound ? List.nil() : topLevelClasses;
+                Set<TypeElement> ap = lastRound ? Collections.emptySet() : annotationsPresent;
                 log.printLines("x.print.rounds",
                         number,
                         "{" + tlc.toString(", ") + "}",
@@ -1346,15 +1363,15 @@
         // Free resources
         this.close();
 
-        if (!taskListener.isEmpty())
-            taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING));
-
         if (errorStatus && compiler.errorCount() == 0) {
             compiler.log.nerrors++;
         }
 
         compiler.enterTreesIfNeeded(roots);
 
+        if (!taskListener.isEmpty())
+            taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING));
+
         return true;
     }
 
@@ -1418,6 +1435,18 @@
         return packages.reverse();
     }
 
+    private List<ModuleSymbol> getModuleInfoFiles(List<? extends JCCompilationUnit> units) {
+        List<ModuleSymbol> modules = List.nil();
+        for (JCCompilationUnit unit : units) {
+            if (isModuleInfo(unit.sourcefile, JavaFileObject.Kind.SOURCE) &&
+                unit.defs.nonEmpty() &&
+                unit.defs.head.hasTag(Tag.MODULEDEF)) {
+                modules = modules.prepend(unit.modle);
+            }
+        }
+        return modules.reverse();
+    }
+
     // avoid unchecked warning from use of varargs
     private static <T> List<T> join(List<T> list1, List<T> list2) {
         return list1.appendList(list2);
@@ -1431,6 +1460,10 @@
         return isPkgInfo(sym.classfile, JavaFileObject.Kind.CLASS) && (sym.packge().package_info == sym);
     }
 
+    private boolean isModuleInfo(JavaFileObject fo, JavaFileObject.Kind kind) {
+        return fo.isNameCompatible("module-info", kind);
+    }
+
     /*
      * Called retroactively to determine if a class loader was required,
      * after we have failed to create one.
@@ -1625,8 +1658,21 @@
      * import-style string, return a regex that won't match anything.
      */
     private static Pattern importStringToPattern(String s, Processor p, Log log) {
-        if (MatchingUtils.isValidImportString(s)) {
-            return MatchingUtils.validImportStringToPattern(s);
+        String module;
+        String pkg;
+        int slash = s.indexOf('/');
+        if (slash == (-1)) {
+            if (s.equals("*")) {
+                return MatchingUtils.validImportStringToPattern(s);
+            }
+            module = ".*/";
+            pkg = s;
+        } else {
+            module = Pattern.quote(s.substring(0, slash + 1));
+            pkg = s.substring(slash + 1);
+        }
+        if (MatchingUtils.isValidImportString(pkg)) {
+            return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg));
         } else {
             log.warning("proc.malformed.supported.string", s, p.getClass().getName());
             return noMatches; // won't match any valid identifier
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Dec 16 11:58:18 2016 -0800
@@ -1457,6 +1457,10 @@
 compiler.warn.finally.cannot.complete=\
     finally clause cannot complete normally
 
+# 0: name
+compiler.warn.poor.choice.for.module.name=\
+    module name {0} should avoid terminal digits
+
 # 0: symbol, 1: symbol
 compiler.warn.has.been.deprecated=\
     {0} in {1} has been deprecated
@@ -2749,6 +2753,10 @@
 compiler.err.module.not.found=\
     module not found: {0}
 
+# 0: symbol
+compiler.warn.module.not.found=\
+    module not found: {0}
+
 compiler.err.too.many.modules=\
     too many module declarations found
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Fri Dec 16 11:58:18 2016 -0800
@@ -201,6 +201,9 @@
 javac.opt.Xlint.desc.finally=\
     Warn about finally clauses that do not terminate normally.
 
+javac.opt.Xlint.desc.module=\
+    Warn about module system related issues.
+
 javac.opt.Xlint.desc.options=\
     Warn about issues relating to use of command line options.
 
@@ -263,9 +266,9 @@
 javac.opt.Xstdout=\
     Redirect standard output
 javac.opt.X=\
-    Print a synopsis of nonstandard options
+    Print help on extra options
 javac.opt.help=\
-    Print a synopsis of standard options
+    Print this help message
 javac.opt.print=\
     Print out a textual representation of specified types
 javac.opt.printRounds=\
@@ -308,6 +311,10 @@
     Limit the universe of observable modules
 javac.opt.arg.limitmods=\
     <module>(,<module>)*
+javac.opt.module.version=\
+    Specify version of modules that are being compiled
+javac.opt.arg.module.version=\
+    <version>
 javac.opt.inherit_runtime_environment=\
     Inherit module system configuration options from the runtime environment.
 
@@ -375,7 +382,7 @@
     use --help for a list of possible options
 
 javac.msg.usage.nonstandard.footer=\
-These options are non-standard and subject to change without notice.
+These extra options are subject to change without notice.
 
 javac.msg.bug=\
 An exception has occurred in the compiler ({0}). \
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -574,6 +574,36 @@
         }
     }
 
+    public static class DCProvides extends DCBlockTag implements ProvidesTree {
+        public final DCReference serviceType;
+        public final List<DCTree> description;
+
+        DCProvides(DCReference serviceType, List<DCTree> description) {
+            this.serviceType = serviceType;
+            this.description = description;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Kind getKind() {
+            return Kind.PROVIDES;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
+            return v.visitProvides(this, d);
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public ReferenceTree getServiceType() {
+            return serviceType;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<? extends DocTree> getDescription() {
+            return description;
+        }
+    }
+
     public static class DCReference extends DCEndPosTree<DCReference> implements ReferenceTree {
         public final String signature;
 
@@ -912,6 +942,36 @@
         }
     }
 
+    public static class DCUses extends DCBlockTag implements UsesTree {
+        public final DCReference serviceType;
+        public final List<DCTree> description;
+
+        DCUses(DCReference serviceType, List<DCTree> description) {
+            this.serviceType = serviceType;
+            this.description = description;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Kind getKind() {
+            return Kind.USES;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
+            return v.visitUses(this, d);
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public ReferenceTree getServiceType() {
+            return serviceType;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<? extends DocTree> getDescription() {
+            return description;
+        }
+    }
+
     public static class DCValue extends DCInlineTag implements ValueTree {
         public final DCReference ref;
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Fri Dec 16 11:58:18 2016 -0800
@@ -129,8 +129,7 @@
         }
     }
 
-
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitAttribute(AttributeTree node, Void p) {
         try {
             print(node.getName());
@@ -162,7 +161,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitAuthor(AuthorTree node, Void p) {
         try {
             printTagName(node);
@@ -174,7 +173,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitComment(CommentTree node, Void p) {
         try {
             print(node.getBody());
@@ -184,7 +183,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDeprecated(DeprecatedTree node, Void p) {
         try {
             printTagName(node);
@@ -198,7 +197,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocComment(DocCommentTree node, Void p) {
         try {
             List<? extends DocTree> b = node.getFullBody();
@@ -213,7 +212,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocRoot(DocRootTree node, Void p) {
         try {
             print("{");
@@ -225,7 +224,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitEndElement(EndElementTree node, Void p) {
         try {
             print("</");
@@ -237,7 +236,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitEntity(EntityTree node, Void p) {
         try {
             print("&");
@@ -249,7 +248,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitErroneous(ErroneousTree node, Void p) {
         try {
             print(node.getBody());
@@ -259,7 +258,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitHidden(HiddenTree node, Void p) {
         try {
             printTagName(node);
@@ -273,7 +272,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitIdentifier(IdentifierTree node, Void p) {
         try {
             print(node.getName());
@@ -283,7 +282,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitIndex(IndexTree node, Void p) {
         try {
             print("{");
@@ -301,7 +300,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitInheritDoc(InheritDocTree node, Void p) {
         try {
             print("{");
@@ -313,7 +312,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitLink(LinkTree node, Void p) {
         try {
             print("{");
@@ -331,7 +330,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitLiteral(LiteralTree node, Void p) {
         try {
             print("{");
@@ -348,7 +347,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitParam(ParamTree node, Void p) {
         try {
             printTagName(node);
@@ -366,7 +365,23 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitProvides(ProvidesTree node, Void p) {
+        try {
+            printTagName(node);
+            print(" ");
+            print(node.getServiceType());
+            if (!node.getDescription().isEmpty()) {
+                print(" ");
+                print(node.getDescription());
+            }
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+        return null;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReference(ReferenceTree node, Void p) {
         try {
             print(node.getSignature());
@@ -376,7 +391,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReturn(ReturnTree node, Void p) {
         try {
             printTagName(node);
@@ -388,7 +403,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSee(SeeTree node, Void p) {
         try {
             printTagName(node);
@@ -406,7 +421,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerial(SerialTree node, Void p) {
         try {
             printTagName(node);
@@ -420,7 +435,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialData(SerialDataTree node, Void p) {
         try {
             printTagName(node);
@@ -434,7 +449,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialField(SerialFieldTree node, Void p) {
         try {
             printTagName(node);
@@ -452,7 +467,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSince(SinceTree node, Void p) {
         try {
             printTagName(node);
@@ -464,7 +479,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitStartElement(StartElementTree node, Void p) {
         try {
             print("<");
@@ -487,7 +502,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitText(TextTree node, Void p) {
         try {
             print(node.getBody());
@@ -497,7 +512,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitThrows(ThrowsTree node, Void p) {
         try {
             printTagName(node);
@@ -513,7 +528,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
         try {
             print("@");
@@ -526,7 +541,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownInlineTag(UnknownInlineTagTree node, Void p) {
         try {
             print("{");
@@ -541,7 +556,23 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitUses(UsesTree node, Void p) {
+        try {
+            printTagName(node);
+            print(" ");
+            print(node.getServiceType());
+            if (!node.getDescription().isEmpty()) {
+                print(" ");
+                print(node.getDescription());
+            }
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+        return null;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitValue(ValueTree node, Void p) {
         try {
             print("{");
@@ -557,7 +588,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitVersion(VersionTree node, Void p) {
         try {
             printTagName(node);
@@ -569,7 +600,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitOther(DocTree node, Void p) {
         try {
             print("(UNKNOWN: " + node + ")");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Fri Dec 16 11:58:18 2016 -0800
@@ -44,6 +44,8 @@
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.StartElementTree;
 import com.sun.source.doctree.TextTree;
+import com.sun.source.doctree.ProvidesTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.util.DocTreeFactory;
 import com.sun.tools.doclint.HtmlTag;
 import com.sun.tools.javac.api.JavacTrees;
@@ -67,6 +69,7 @@
 import com.sun.tools.javac.tree.DCTree.DCLink;
 import com.sun.tools.javac.tree.DCTree.DCLiteral;
 import com.sun.tools.javac.tree.DCTree.DCParam;
+import com.sun.tools.javac.tree.DCTree.DCProvides;
 import com.sun.tools.javac.tree.DCTree.DCReference;
 import com.sun.tools.javac.tree.DCTree.DCReturn;
 import com.sun.tools.javac.tree.DCTree.DCSee;
@@ -79,6 +82,7 @@
 import com.sun.tools.javac.tree.DCTree.DCThrows;
 import com.sun.tools.javac.tree.DCTree.DCUnknownBlockTag;
 import com.sun.tools.javac.tree.DCTree.DCUnknownInlineTag;
+import com.sun.tools.javac.tree.DCTree.DCUses;
 import com.sun.tools.javac.tree.DCTree.DCValue;
 import com.sun.tools.javac.tree.DCTree.DCVersion;
 import com.sun.tools.javac.util.Context;
@@ -334,6 +338,13 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCProvides newProvidesTree(ReferenceTree name, List<? extends DocTree> description) {
+        DCProvides tree = new DCProvides((DCReference) name, cast(description));
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public DCReference newReferenceTree(String signature) {
         try {
             ReferenceParser.Reference ref = referenceParser.parse(signature);
@@ -430,6 +441,13 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCUses newUsesTree(ReferenceTree name, List<? extends DocTree> description) {
+        DCUses tree = new DCUses((DCReference) name, cast(description));
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public DCValue newValueTree(ReferenceTree ref) {
         // TODO: verify the reference is to a constant value
         DCValue tree = new DCValue((DCReference) ref);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -551,7 +551,7 @@
         @DefinedBy(Api.COMPILER_TREE)
         public List<JCAnnotation> getPackageAnnotations() {
             JCPackageDecl pd = getPackage();
-            return pd != null ? pd.getAnnotations() : List.<JCAnnotation>nil();
+            return pd != null ? pd.getAnnotations() : List.nil();
         }
         @DefinedBy(Api.COMPILER_TREE)
         public ExpressionTree getPackageName() {
@@ -1619,7 +1619,7 @@
                         JCExpression meth,
                         List<JCExpression> args)
         {
-            this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
+            this.typeargs = (typeargs == null) ? List.nil()
                                                : typeargs;
             this.meth = meth;
             this.args = args;
@@ -1673,7 +1673,7 @@
                            JCClassDecl def)
         {
             this.encl = encl;
-            this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
+            this.typeargs = (typeargs == null) ? List.nil()
                                                : typeargs;
             this.clazz = clazz;
             this.args = args;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java	Fri Dec 16 11:58:18 2016 -0800
@@ -462,11 +462,22 @@
     @Override
     public void visitExports(JCExports tree) {
         try {
-            if (tree.hasTag(EXPORTS)) {
-                print("exports ");
-            } else {
-                print("opens ");
+            print("exports ");
+            printExpr(tree.qualid);
+            if (tree.moduleNames != null) {
+                print(" to ");
+                printExprs(tree.moduleNames);
             }
+            print(";");
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    @Override
+    public void visitOpens(JCOpens tree) {
+        try {
+            print("opens ");
             printExpr(tree.qualid);
             if (tree.moduleNames != null) {
                 print(" to ");
@@ -1493,7 +1504,7 @@
 
     public void visitTree(JCTree tree) {
         try {
-            print("(UNKNOWN: " + tree + ")");
+            print("(UNKNOWN: " + tree.getTag() + ")");
             println();
         } catch (IOException e) {
             throw new UncheckedIOException(e);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Dec 16 11:58:18 2016 -0800
@@ -285,7 +285,7 @@
     }
 
     public JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {
-        return Try(List.<JCTree>nil(), body, catchers, finalizer);
+        return Try(List.nil(), body, catchers, finalizer);
     }
 
     public JCTry Try(List<JCTree> resources,
@@ -495,7 +495,7 @@
     }
 
     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
-        return TypeParameter(name, bounds, List.<JCAnnotation>nil());
+        return TypeParameter(name, bounds, List.nil());
     }
 
     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCAnnotation> annos) {
@@ -536,7 +536,7 @@
     }
 
     public JCModifiers Modifiers(long flags) {
-        return Modifiers(flags, List.<JCAnnotation>nil());
+        return Modifiers(flags, List.nil());
     }
 
     @Override
@@ -589,7 +589,7 @@
     }
 
     public JCErroneous Erroneous() {
-        return Erroneous(List.<JCTree>nil());
+        return Erroneous(List.nil());
     }
 
     public JCErroneous Erroneous(List<? extends JCTree> errs) {
@@ -613,9 +613,9 @@
     {
         return ClassDef(mods,
                         names.empty,
-                        List.<JCTypeParameter>nil(),
+                        List.nil(),
                         null,
-                        List.<JCExpression>nil(),
+                        List.nil(),
                         defs);
     }
 
@@ -714,7 +714,7 @@
      * Create a no-arg method invocation from a method tree
      */
     public JCMethodInvocation App(JCExpression meth) {
-        return Apply(null, meth, List.<JCExpression>nil()).setType(meth.type.getReturnType());
+        return Apply(null, meth, List.nil()).setType(meth.type.getReturnType());
     }
 
     /** Create a method invocation from a method tree and a list of argument trees.
@@ -903,7 +903,7 @@
             ListBuffer<JCExpression> elems = new ListBuffer<>();
             for (int i = 0; i < array.values.length; i++)
                 elems.append(translate(array.values[i]));
-            result = NewArray(null, List.<JCExpression>nil(), elems.toList()).setType(array.type);
+            result = NewArray(null, List.nil(), elems.toList()).setType(array.type);
         }
         JCExpression translate(Attribute a) {
             a.accept(this);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Context.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Context.java	Fri Dec 16 11:58:18 2016 -0800
@@ -158,7 +158,7 @@
          * Since we found a key of type Key<T>, the value must
          * be of type T.
          */
-        return Context.<T>uncheckedCast(o);
+        return Context.uncheckedCast(o);
     }
 
     public Context() {}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Fri Dec 16 11:58:18 2016 -0800
@@ -73,11 +73,7 @@
 
             final Options options = Options.instance(context);
             initOptions(options);
-            options.addListener(new Runnable() {
-               public void run() {
-                   initOptions(options);
-               }
-            });
+            options.addListener(() -> initOptions(options));
         }
 
         private void initOptions(Options options) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Fri Dec 16 11:58:18 2016 -0800
@@ -86,6 +86,58 @@
     }
 
     /**
+     * Wrapper class for java.lang.module.ModuleDescriptor and ModuleDescriptor.Version.
+     */
+    public static class ModuleDescriptor {
+        public static class Version {
+            public static final String CLASSNAME = "java.lang.module.ModuleDescriptor$Version";
+            private final Object theRealVersion;
+
+            private Version(Object version) {
+                this.theRealVersion = version;
+            }
+
+            public static Version parse(String v) {
+                try {
+                    init();
+                    Object result = parseMethod.invoke(null, v);
+                    Version version = new Version(result);
+                    return version;
+                } catch (InvocationTargetException ex) {
+                    if (ex.getCause() instanceof IllegalArgumentException) {
+                        throw (IllegalArgumentException) ex.getCause();
+                    } else {
+                        throw new Abort(ex);
+                    }
+                } catch (IllegalAccessException | IllegalArgumentException | SecurityException ex) {
+                    throw new Abort(ex);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return theRealVersion.toString();
+            }
+
+            // -----------------------------------------------------------------------------------------
+
+            private static Class<?> versionClass = null;
+            private static Method parseMethod = null;
+
+            private static void init() {
+                if (versionClass == null) {
+                    try {
+                        versionClass = Class.forName(CLASSNAME, false, null);
+                        parseMethod = versionClass.getDeclaredMethod("parse", String.class);
+                    } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
+                        throw new Abort(ex);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
      * Wrapper class for java.lang.module.ModuleFinder.
      */
     public static class ModuleFinder {
@@ -338,7 +390,7 @@
      * Helper class for new method in jdk.internal.misc.VM.
      */
     public static final class VMHelper {
-        public static final String VM_CLASSNAME = "jdk.internal.misc.VM";
+        public static final String CLASSNAME = "jdk.internal.misc.VM";
 
         @SuppressWarnings("unchecked")
         public static String[] getRuntimeArguments() {
@@ -360,7 +412,7 @@
         private static void init() {
             if (vmClass == null) {
                 try {
-                    vmClass = Class.forName(VM_CLASSNAME, false, null);
+                    vmClass = Class.forName(CLASSNAME, false, null);
                     getRuntimeArgumentsMethod = vmClass.getDeclaredMethod("getRuntimeArguments");
                 } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
                     throw new Abort(ex);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java	Fri Dec 16 11:58:18 2016 -0800
@@ -134,7 +134,7 @@
     /** Construct a list consisting of given element.
      */
     public static <A> List<A> of(A x1) {
-        return new List<>(x1, List.<A>nil());
+        return new List<>(x1, List.nil());
     }
 
     /** Construct a list consisting of given elements.
@@ -557,8 +557,8 @@
      */
     public static <Z> Collector<Z, ListBuffer<Z>, List<Z>> collector() {
         return Collector.of(ListBuffer::new,
-                (buf, el)->buf.add(el),
+                ListBuffer::add,
                 (buf1, buf2)-> { buf1.addAll(buf2); return buf1; },
-                buf->buf.toList());
+                ListBuffer::toList);
     }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java	Fri Dec 16 11:58:18 2016 -0800
@@ -103,10 +103,10 @@
         if (elems.nonEmpty()) {
             List<A> orig = elems;
 
-            elems = last = List.<A>of(orig.head);
+            elems = last = List.of(orig.head);
 
             while ((orig = orig.tail).nonEmpty()) {
-                last.tail = List.<A>of(orig.head);
+                last.tail = List.of(orig.head);
                 last = last.tail;
             }
         }
@@ -126,7 +126,7 @@
     public ListBuffer<A> append(A x) {
         Assert.checkNonNull(x);
         if (shared) copy();
-        List<A> newLast = List.<A>of(x);
+        List<A> newLast = List.of(x);
         if (last != null) {
             last.tail = newLast;
             last = newLast;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java	Fri Dec 16 11:58:18 2016 -0800
@@ -364,12 +364,7 @@
 
         final Options options = Options.instance(context);
         initOptions(options);
-        options.addListener(new Runnable() {
-            @Override
-            public void run() {
-                initOptions(options);
-            }
-        });
+        options.addListener(() -> initOptions(options));
     }
     // where
         private void initOptions(Options options) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java	Fri Dec 16 11:58:18 2016 -0800
@@ -36,7 +36,9 @@
  *  deletion without notice.</b>
  */
 public class MatchingUtils {
-    private static final Pattern allMatches = Pattern.compile(".*");
+
+    private static final String allMatchesString = ".*";
+    private static final Pattern allMatches = Pattern.compile(allMatchesString);
 
     /**
      * Return true if the argument string is a valid import-style
@@ -72,9 +74,9 @@
         return valid;
     }
 
-    public static Pattern validImportStringToPattern(String s) {
+    public static String validImportStringToPatternString(String s) {
         if (s.equals("*")) {
-            return allMatches;
+            return allMatchesString;
         } else {
             String s_prime = s.replace(".", "\\.");
 
@@ -82,7 +84,17 @@
                 s_prime =  s_prime.substring(0, s_prime.length() - 1) + ".+";
             }
 
-            return Pattern.compile(s_prime);
+            return s_prime;
+        }
+    }
+
+    public static Pattern validImportStringToPattern(String s) {
+        String pattern = validImportStringToPatternString(s);
+
+        if (pattern == allMatchesString) {
+            return allMatches;
+        } else {
+            return Pattern.compile(pattern);
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Fri Dec 16 11:58:18 2016 -0800
@@ -150,7 +150,7 @@
     public final Name LocalVariableTypeTable;
     public final Name MethodParameters;
     public final Name Module;
-    public final Name ModuleVersion;
+    public final Name ModuleResolution;
     public final Name RuntimeInvisibleAnnotations;
     public final Name RuntimeInvisibleParameterAnnotations;
     public final Name RuntimeInvisibleTypeAnnotations;
@@ -312,7 +312,7 @@
         LocalVariableTypeTable = fromString("LocalVariableTypeTable");
         MethodParameters = fromString("MethodParameters");
         Module = fromString("Module");
-        ModuleVersion = fromString("ModuleVersion");
+        ModuleResolution = fromString("ModuleResolution");
         RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
         RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
         RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -556,7 +556,7 @@
                 List<Type> bounds = (bound != null) &&
                         (bound.hasTag(CLASS) || bound.hasTag(TYPEVAR)) ?
                     types.getBounds(t) :
-                    List.<Type>nil();
+                    List.nil();
 
                 nameSimplifier.addUsage(t.tsym);
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java	Fri Dec 16 11:58:18 2016 -0800
@@ -310,15 +310,12 @@
 
     private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
         final PrintWriter pw = getPrintWriterForWriter(w);
-        return new DiagnosticListener<JavaFileObject> () {
-            @DefinedBy(Api.COMPILER)
-            public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
-                if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
-                    pw.print(getMessage("err.prefix"));
-                    pw.print(" ");
-                }
-                pw.println(diagnostic.getMessage(null));
+        return diagnostic -> {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                pw.print(getMessage("err.prefix"));
+                pw.print(" ");
             }
+            pw.println(diagnostic.getMessage(null));
         };
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Fri Dec 16 11:58:18 2016 -0800
@@ -222,7 +222,7 @@
                 CompilationSubResult result = sjavac.compile("n/a",
                                                              chunkId,
                                                              args.prepJavacArgs(),
-                                                             Collections.<File>emptyList(),
+                                                             Collections.emptyList(),
                                                              cc.srcs,
                                                              visibleSources);
                 synchronized (lock) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java	Fri Dec 16 11:58:18 2016 -0800
@@ -487,7 +487,7 @@
             Set<String> deps = pkg.typeDependencies()
                                   .values()
                                   .stream()
-                                  .flatMap(s -> s.stream())
+                                  .flatMap(Collection::stream)
                                   .collect(Collectors.toSet());
             for (String dep : deps) {
                 String depPkg = ":" + dep.substring(0, dep.lastIndexOf('.'));
--- a/langtools/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java	Fri Dec 16 11:58:18 2016 -0800
@@ -53,6 +53,7 @@
 import javax.lang.model.element.VariableElement;
 import javax.lang.model.type.DeclaredType;
 import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
 import javax.lang.model.util.ElementFilter;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileManager;
@@ -240,7 +241,7 @@
                             List<String> throwsList =
                                     executableElement.getThrownTypes()
                                                      .stream()
-                                                     .map(exc -> exc.toString())
+                                                     .map(TypeMirror::toString)
                                                      .collect(Collectors.toList());
                             Set<String> missingParams = new HashSet<>(parameters);
                             Set<String> missingThrows = new HashSet<>(throwsList);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -37,7 +37,7 @@
  */
 @Deprecated
 public class ContentBuilder extends Content {
-    protected List<Content> contents = Collections.<Content>emptyList();
+    protected List<Content> contents = Collections.emptyList();
 
     @Override
     public void addContent(Content content) {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java	Fri Dec 16 11:58:18 2016 -0800
@@ -45,7 +45,7 @@
 @Deprecated
 public class HtmlDocument extends Content {
 
-    private List<Content> docContent = Collections.<Content>emptyList();
+    private List<Content> docContent = Collections.emptyList();
 
     /**
      * Constructor to construct an HTML document.
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -48,8 +48,8 @@
 public class HtmlTree extends Content {
 
     private HtmlTag htmlTag;
-    private Map<HtmlAttr,String> attrs = Collections.<HtmlAttr,String>emptyMap();
-    private List<Content> content = Collections.<Content>emptyList();
+    private Map<HtmlAttr,String> attrs = Collections.emptyMap();
+    private List<Content> content = Collections.emptyList();
     public static final Content EMPTY = new StringContent("");
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocClassFinder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocClassFinder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -31,6 +31,7 @@
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.code.ClassFinder;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
 
 /** Javadoc uses an extended class finder that records package.html entries
  *
@@ -52,11 +53,7 @@
     }
 
     public static void preRegister(Context context) {
-        context.put(classFinderKey, new Context.Factory<ClassFinder>() {
-            public ClassFinder make(Context c) {
-                return new JavadocClassFinder(c);
-            }
-        });
+        context.put(classFinderKey, (Factory<ClassFinder>)JavadocClassFinder::new);
     }
 
     private DocEnv docenv;
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocEnter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocEnter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -58,11 +58,7 @@
     }
 
     public static void preRegister(Context context) {
-        context.put(enterKey, new Context.Factory<Enter>() {
-               public Enter make(Context c) {
-                   return new JavadocEnter(c);
-               }
-        });
+        context.put(enterKey, (Context.Factory<Enter>)JavadocEnter::new);
     }
 
     protected JavadocEnter(Context context) {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocMemberEnter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocMemberEnter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -57,11 +57,7 @@
     }
 
     public static void preRegister(Context context) {
-        context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
-               public MemberEnter make(Context c) {
-                   return new JavadocMemberEnter(c);
-               }
-        });
+        context.put(memberEnterKey, (Context.Factory<MemberEnter>)JavadocMemberEnter::new);
     }
 
     final DocEnv docenv;
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTodo.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTodo.java	Fri Dec 16 11:58:18 2016 -0800
@@ -27,6 +27,7 @@
 
 import com.sun.tools.javac.comp.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.Context.Factory;
 
 /**
  *  Javadoc's own todo queue doesn't queue its inputs, as javadoc
@@ -42,11 +43,7 @@
 @Deprecated
 public class JavadocTodo extends Todo {
     public static void preRegister(Context context) {
-        context.put(todoKey, new Context.Factory<Todo>() {
-               public Todo make(Context c) {
-                   return new JavadocTodo(c);
-               }
-        });
+        context.put(todoKey, (Factory<Todo>)JavadocTodo::new);
     }
 
     protected JavadocTodo(Context context) {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java	Fri Dec 16 11:58:18 2016 -0800
@@ -31,6 +31,7 @@
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 import com.sun.tools.javac.util.JavacMessages;
@@ -66,27 +67,18 @@
 
     public static void preRegister(Context context,
                                    final String programName) {
-        context.put(logKey, new Context.Factory<Log>() {
-            public Log make(Context c) {
-                return new Messager(c,
-                                    programName);
-            }
-        });
+        context.put(logKey, (Factory<Log>)c -> new Messager(c, programName));
     }
     public static void preRegister(Context context,
                                    final String programName,
                                    final PrintWriter errWriter,
                                    final PrintWriter warnWriter,
                                    final PrintWriter noticeWriter) {
-        context.put(logKey, new Context.Factory<Log>() {
-            public Log make(Context c) {
-                return new Messager(c,
-                                    programName,
-                                    errWriter,
-                                    warnWriter,
-                                    noticeWriter);
-            }
-        });
+        context.put(logKey, (Factory<Log>)c -> new Messager(c,
+                            programName,
+                            errWriter,
+                            warnWriter,
+                            noticeWriter));
     }
 
     public class ExitJavadoc extends Error {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java	Fri Dec 16 11:58:18 2016 -0800
@@ -221,7 +221,7 @@
      * Main program - external wrapper
      */
     public int begin(String... argv) {
-        boolean ok = begin(null, argv, Collections.<JavaFileObject> emptySet());
+        boolean ok = begin(null, argv, Collections.emptySet());
         return ok ? 0 : 1;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/WildcardTypeImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/WildcardTypeImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -128,13 +128,13 @@
 
     private static List<Type> getExtendsBounds(Type.WildcardType wild) {
         return wild.isSuperBound()
-                ? List.<Type>nil()
+                ? List.nil()
                 : List.of(wild.type);
     }
 
     private static List<Type> getSuperBounds(Type.WildcardType wild) {
         return wild.isExtendsBound()
-                ? List.<Type>nil()
+                ? List.nil()
                 : List.of(wild.type);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTaskImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTaskImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -59,9 +59,9 @@
         this.context = context;
         this.docletClass = docletClass;
 
-        this.options = (options == null) ? Collections.<String>emptySet()
+        this.options = (options == null) ? Collections.emptySet()
                 : nullCheck(options);
-        this.fileObjects = (fileObjects == null) ? Collections.<JavaFileObject>emptySet()
+        this.fileObjects = (fileObjects == null) ? Collections.emptySet()
                 : nullCheck(fileObjects);
         setLocale(Locale.getDefault());
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -360,7 +360,7 @@
      */
     protected void addComment(Element element, Content contentTree) {
         List<? extends DocTree> tags;
-        Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+        Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element));
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.block);
         if (utils.isDeprecated(element)) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -36,7 +36,6 @@
 import javax.lang.model.type.TypeMirror;
 
 import com.sun.source.doctree.DocTree;
-
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
@@ -258,7 +257,7 @@
             }
         }
         if (!set.isEmpty()) {
-            String mods = set.stream().map(m -> m.toString()).collect(Collectors.joining(" "));
+            String mods = set.stream().map(Modifier::toString).collect(Collectors.joining(" "));
             htmltree.addContent(mods);
             htmltree.addContent(Contents.SPACE);
         }
@@ -405,46 +404,6 @@
     }
 
     /**
-     * Add deprecated information to the documentation tree
-     *
-     * @param deprmembers list of deprecated members
-     * @param headingKey the caption for the deprecated members table
-     * @param tableSummary the summary for the deprecated members table
-     * @param tableHeader table headers for the deprecated members table
-     * @param contentTree the content tree to which the deprecated members table will be added
-     */
-    protected void addDeprecatedAPI(Collection<Element> deprmembers, String headingKey,
-            String tableSummary, List<String> tableHeader, Content contentTree) {
-        if (deprmembers.size() > 0) {
-            Content caption = writer.getTableCaption(configuration.getContent(headingKey));
-            Content table = (configuration.isOutputHtml5())
-                    ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
-                    : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
-            table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
-            Content tbody = new HtmlTree(HtmlTag.TBODY);
-            boolean altColor = true;
-            for (Element member : deprmembers) {
-                HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, getDeprecatedLink(member));
-                HtmlTree tr = HtmlTree.TR(thRow);
-                HtmlTree td = new HtmlTree(HtmlTag.TD);
-                td.addStyle(HtmlStyle.colLast);
-                List<? extends DocTree> deprTrees = utils.getBlockTags(member, DocTree.Kind.DEPRECATED);
-                if (!deprTrees.isEmpty()) {
-                    writer.addInlineDeprecatedComment(member, deprTrees.get(0), td);
-                }
-                tr.addContent(td);
-                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-                altColor = !altColor;
-                tbody.addContent(tr);
-            }
-            table.addContent(tbody);
-            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
-            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
-            contentTree.addContent(ul);
-        }
-    }
-
-    /**
      * Add use information to the documentation tree.
      *
      * @param mems list of program elements for which the use information will be added
@@ -574,19 +533,19 @@
         writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc);
         tr.addContent(tdDesc);
         if (utils.isMethod(member) && !utils.isAnnotationType(member)) {
-            int methodType = utils.isStatic(member) ? MethodTypes.STATIC.value() :
-                    MethodTypes.INSTANCE.value();
+            int methodType = utils.isStatic(member) ? MethodTypes.STATIC.tableTabs().value() :
+                    MethodTypes.INSTANCE.tableTabs().value();
             if (utils.isInterface(member.getEnclosingElement())) {
                 methodType = utils.isAbstract(member)
-                        ? methodType | MethodTypes.ABSTRACT.value()
-                        : methodType | MethodTypes.DEFAULT.value();
+                        ? methodType | MethodTypes.ABSTRACT.tableTabs().value()
+                        : methodType | MethodTypes.DEFAULT.tableTabs().value();
             } else {
                 methodType = utils.isAbstract(member)
-                        ? methodType | MethodTypes.ABSTRACT.value()
-                        : methodType | MethodTypes.CONCRETE.value();
+                        ? methodType | MethodTypes.ABSTRACT.tableTabs().value()
+                        : methodType | MethodTypes.CONCRETE.tableTabs().value();
             }
             if (utils.isDeprecated(member) || utils.isDeprecated(typeElement)) {
-                methodType = methodType | MethodTypes.DEPRECATED.value();
+                methodType = methodType | MethodTypes.DEPRECATED.tableTabs().value();
             }
             methodTypesOr = methodTypesOr | methodType;
             String tableId = "i" + counter;
@@ -609,7 +568,7 @@
     public boolean showTabs() {
         int value;
         for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
-            value = type.value();
+            value = type.tableTabs().value();
             if ((value & methodTypesOr) == value) {
                 methodTypes.add(type);
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -317,7 +317,7 @@
         List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
         if (utils.isDeprecated(annotationType)) {
             CommentHelper ch = utils.getCommentHelper(annotationType);
-            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(annotationType));
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (!deprs.isEmpty()) {
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -203,8 +203,8 @@
         bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
-        ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
         if (configuration.showModules) {
+            ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
             Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
             Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
             moduleNameDiv.addContent(Contents.SPACE);
@@ -610,7 +610,7 @@
         classInfoTree.addContent(hr);
         List<? extends DocTree> deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED);
         if (utils.isDeprecated(typeElement)) {
-            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement));
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (!deprs.isEmpty()) {
                 CommentHelper ch = utils.getCommentHelper(typeElement);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java	Fri Dec 16 11:58:18 2016 -0800
@@ -73,6 +73,7 @@
     public final Content deprecatedAPI;
     public final Content deprecatedLabel;
     public final Content deprecatedPhrase;
+    public final Content deprecatedForRemovalPhrase;
     public final Content descfrmClassLabel;
     public final Content descfrmInterfaceLabel;
     public final Content descriptionLabel;
@@ -186,6 +187,7 @@
         deprecatedAPI = getContent("doclet.Deprecated_API");
         deprecatedLabel = getContent("doclet.navDeprecated");
         deprecatedPhrase = getContent("doclet.Deprecated");
+        deprecatedForRemovalPhrase = getContent("doclet.DeprecatedForRemoval");
         descfrmClassLabel = getContent("doclet.Description_From_Class");
         descfrmInterfaceLabel = getContent("doclet.Description_From_Interface");
         descriptionLabel = getContent("doclet.Description");
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -64,6 +64,8 @@
 
     private String getAnchorName(DeprElementKind kind) {
         switch (kind) {
+            case REMOVAL:
+                return "forRemoval";
             case MODULE:
                 return "module";
             case PACKAGE:
@@ -97,6 +99,8 @@
 
     private String getHeadingKey(DeprElementKind kind) {
         switch (kind) {
+            case REMOVAL:
+                return "doclet.Deprecated_For_Removal";
             case MODULE:
                 return "doclet.Deprecated_Modules";
             case PACKAGE:
@@ -130,6 +134,8 @@
 
     private String getSummaryKey(DeprElementKind kind) {
         switch (kind) {
+            case REMOVAL:
+                return "doclet.deprecated_for_removal";
             case MODULE:
                 return "doclet.deprecated_modules";
             case PACKAGE:
@@ -163,6 +169,8 @@
 
     private String getHeaderKey(DeprElementKind kind) {
         switch (kind) {
+            case REMOVAL:
+                return "doclet.Element";
             case MODULE:
                 return "doclet.Module";
             case PACKAGE:
@@ -212,6 +220,7 @@
         writerMap = new EnumMap<>(DeprElementKind.class);
         for (DeprElementKind kind : DeprElementKind.values()) {
             switch (kind) {
+                case REMOVAL:
                 case MODULE:
                 case PACKAGE:
                 case INTERFACE:
@@ -284,16 +293,8 @@
                 List<String> memberTableHeader = new ArrayList<>();
                 memberTableHeader.add(resources.getText(getHeaderKey(kind)));
                 memberTableHeader.add(resources.getText("doclet.Description"));
-                if (kind == DeprElementKind.MODULE) {
-                    addModuleDeprecatedAPI(deprapi.getSet(kind),
+                addDeprecatedAPI(deprapi.getSet(kind),
                             getHeadingKey(kind), memberTableSummary, memberTableHeader, div);
-                } else if (kind == DeprElementKind.PACKAGE) {
-                    addPackageDeprecatedAPI(deprapi.getSet(kind),
-                            getHeadingKey(kind), memberTableSummary, memberTableHeader, div);
-                } else {
-                    writerMap.get(kind).addDeprecatedAPI(deprapi.getSet(kind),
-                            getHeadingKey(kind), memberTableSummary, memberTableHeader, div);
-                }
             }
         }
         if (configuration.allowTag(HtmlTag.MAIN)) {
@@ -395,17 +396,17 @@
     }
 
     /**
-     * Add module deprecation information to the documentation tree
+     * Add deprecated information to the documentation tree
      *
-     * @param deprMdles list of deprecated modules
-     * @param headingKey the caption for the deprecated module table
-     * @param tableSummary the summary for the deprecated module table
-     * @param tableHeader table headers for the deprecated module table
-     * @param contentTree the content tree to which the deprecated module table will be added
+     * @param deprList list of deprecated API elements
+     * @param headingKey the caption for the deprecated table
+     * @param tableSummary the summary for the deprecated table
+     * @param tableHeader table headers for the deprecated table
+     * @param contentTree the content tree to which the deprecated table will be added
      */
-    protected void addModuleDeprecatedAPI(SortedSet<Element> deprMdles, String headingKey,
+    protected void addDeprecatedAPI(SortedSet<Element> deprList, String headingKey,
             String tableSummary, List<String> tableHeader, Content contentTree) {
-        if (deprMdles.size() > 0) {
+        if (deprList.size() > 0) {
             Content caption = getTableCaption(configuration.getContent(headingKey));
             Content table = (configuration.isOutputHtml5())
                     ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
@@ -413,16 +414,28 @@
             table.addContent(getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             boolean altColor = true;
-            for (Element e : deprMdles) {
-                ModuleElement mdle = (ModuleElement) e;
-                HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
-                        getModuleLink(mdle, new StringContent(mdle.getQualifiedName())));
+            for (Element e : deprList) {
+                HtmlTree thRow;
+                switch (e.getKind()) {
+                    case MODULE:
+                        ModuleElement m = (ModuleElement)e;
+                        thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
+                        getModuleLink(m, new StringContent(m.getQualifiedName())));
+                        break;
+                    case PACKAGE:
+                        PackageElement pkg = (PackageElement)e;
+                        thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
+                        getPackageLink(pkg, getPackageName(pkg)));
+                        break;
+                    default:
+                        thRow = getDeprecatedLink(e);
+                }
                 HtmlTree tr = HtmlTree.TR(thRow);
                 HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
                 tdDesc.addStyle(HtmlStyle.colLast);
-                List<? extends DocTree> tags = utils.getDeprecatedTrees(mdle);
+                List<? extends DocTree> tags = utils.getDeprecatedTrees(e);
                 if (!tags.isEmpty()) {
-                    addInlineDeprecatedComment(mdle, tags.get(0), tdDesc);
+                    addInlineDeprecatedComment(e, tags.get(0), tdDesc);
                 }
                 tr.addContent(tdDesc);
                 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
@@ -436,45 +449,30 @@
         }
     }
 
-    /**
-     * Add package deprecation information to the documentation tree
-     *
-     * @param deprPkgs list of deprecated packages
-     * @param headingKey the caption for the deprecated package table
-     * @param tableSummary the summary for the deprecated package table
-     * @param tableHeader table headers for the deprecated package table
-     * @param contentTree the content tree to which the deprecated package table will be added
-     */
-    protected void addPackageDeprecatedAPI(SortedSet<Element> deprPkgs, String headingKey,
-            String tableSummary, List<String> tableHeader, Content contentTree) {
-        if (deprPkgs.size() > 0) {
-            Content caption = getTableCaption(configuration.getContent(headingKey));
-            Content table = (configuration.isOutputHtml5())
-                    ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
-                    : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
-            table.addContent(getSummaryTableHeader(tableHeader, "col"));
-            Content tbody = new HtmlTree(HtmlTag.TBODY);
-            boolean altColor = true;
-            for (Element e : deprPkgs) {
-                PackageElement pkg = (PackageElement) e;
-                HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
-                        getPackageLink(pkg, getPackageName(pkg)));
-                HtmlTree tr = HtmlTree.TR(thRow);
-                HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
-                tdDesc.addStyle(HtmlStyle.colLast);
-                List<? extends DocTree> tags = utils.getDeprecatedTrees(pkg);
-                if (!tags.isEmpty()) {
-                    addInlineDeprecatedComment(pkg, tags.get(0), tdDesc);
-                }
-                tr.addContent(tdDesc);
-                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-                altColor = !altColor;
-                tbody.addContent(tr);
-            }
-            table.addContent(tbody);
-            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
-            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
-            contentTree.addContent(ul);
+    protected HtmlTree getDeprecatedLink(Element e) {
+        AbstractMemberWriter writer;
+        switch (e.getKind()) {
+            case INTERFACE:
+            case CLASS:
+            case ENUM:
+            case ANNOTATION_TYPE:
+                writer = new NestedClassWriterImpl(this);
+                break;
+            case FIELD:
+                writer = new FieldWriterImpl(this);
+                break;
+            case METHOD:
+                writer = new MethodWriterImpl(this);
+                break;
+            case CONSTRUCTOR:
+                writer = new ConstructorWriterImpl(this);
+                break;
+            case ENUM_CONSTANT:
+                writer = new EnumConstantWriterImpl(this);
+                break;
+            default:
+                writer = new AnnotationTypeOptionalMemberWriterImpl(this, null);
         }
+        return HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, writer.getDeprecatedLink(e));
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -412,7 +412,7 @@
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
                 if (utils.isDeprecated(te)) {
-                    tdClassDescription.addContent(contents.deprecatedLabel);
+                    tdClassDescription.addContent(getDeprecatedPhrase(te));
                     List<? extends DocTree> tags = utils.getDeprecatedTrees(te);
                     if (!tags.isEmpty()) {
                         addSummaryDeprecatedComment(te, tags.get(0), tdClassDescription);
@@ -1135,8 +1135,10 @@
      * @return a content for the module link
      */
     public Content getModuleLink(ModuleElement mdle, Content label) {
-        return getHyperLink(pathToRoot.resolve(
-                DocPaths.moduleSummary(mdle)), label, "", "");
+        boolean included = utils.isIncluded(mdle);
+        return (included)
+                ? getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "")
+                : label;
     }
 
     public Content interfaceName(TypeElement typeElement, boolean qual) {
@@ -1617,6 +1619,18 @@
     }
 
     /**
+     * Get the deprecated phrase as content.
+     *
+     * @param e the Element for which the inline deprecated comment will be added
+     * @return a content tree for the deprecated phrase.
+     */
+    public Content getDeprecatedPhrase(Element e) {
+        return (utils.isDeprecatedForRemoval(e))
+                ? contents.deprecatedForRemovalPhrase
+                : contents.deprecatedPhrase;
+    }
+
+    /**
      * Add the inline deprecated comment.
      *
      * @param e the Element for which the inline deprecated comment will be added
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,17 +25,24 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.util.ArrayList;
-import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
 
+import javax.lang.model.element.Element;
 import javax.lang.model.element.ModuleElement;
-import javax.lang.model.element.ModuleElement.DirectiveKind;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.ElementFilter;
 
 import com.sun.source.doctree.DocTree;
+import jdk.javadoc.doclet.DocletEnvironment.ModuleMode;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -47,12 +54,12 @@
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.ModulePackageTypes;
 
 /**
- * Class to generate file for each module contents in the right-hand
- * frame. This will list all the packages and Class Kinds in the module. A click on any
- * class-kind will update the frame with the clicked class-kind page. A click on any
- * package will update the frame with the clicked module package page.
+ * Class to generate file for each module contents in the right-hand frame. This will list all the
+ * required modules, packages and service types for the module. A click on any of the links will update
+ * the frame with the clicked element page.
  *
  *  <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.
@@ -78,8 +85,82 @@
      */
     protected ModuleElement mdle;
 
-    private final Map<ModuleElement.DirectiveKind, List<ModuleElement.Directive>> directiveMap
-            = new EnumMap<>(ModuleElement.DirectiveKind.class);
+    /**
+     * The module mode for this javadoc run. It can be set to "api" or "all".
+     */
+    private final ModuleMode moduleMode;
+
+    /**
+     * Map of module elements and modifiers required by this module.
+     */
+    private final Map<ModuleElement, Content> requires
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Map of additional modules and modifiers, transitive closure, required by this module.
+     */
+    private final Map<ModuleElement, Content> additionalModules
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Map of packages exported by this module and the modules it's been exported to.
+     */
+    private final Map<PackageElement, SortedSet<ModuleElement>> exportedPackages
+            = new TreeMap<>(utils.makePackageComparator());
+
+    /**
+     * Map of opened packages by this module and the modules it's been opened to.
+     */
+    private final Map<PackageElement, SortedSet<ModuleElement>> openedPackages
+            = new TreeMap<>(utils.makePackageComparator());
+
+    /**
+     * Set of concealed packages of this module.
+     */
+    private final SortedSet<PackageElement> concealedPackages = new TreeSet<>(utils.makePackageComparator());
+
+    /**
+     * Map of additional modules (transitive closure) and its exported packages.
+     */
+    private final Map<ModuleElement, SortedSet<PackageElement>> additionalPackages
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Map of additional modules (transitive closure) and its open packages.
+     */
+    private final Map<ModuleElement, SortedSet<PackageElement>> additionalOpenPackages
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Set of services used by the module.
+     */
+    private final SortedSet<TypeElement> uses
+            = new TreeSet<>(utils.makeAllClassesComparator());
+
+    /**
+     * Map of services used by the module and specified using @uses javadoc tag, and description.
+     */
+    private final Map<TypeElement, Content> usesTrees
+            = new TreeMap<>(utils.makeAllClassesComparator());
+
+    /**
+     * Map of services provided by this module, and set of its implementations.
+     */
+    private final Map<TypeElement, SortedSet<TypeElement>> provides
+            = new TreeMap<>(utils.makeAllClassesComparator());
+
+    /**
+     * Map of services provided by the module and specified using @provides javadoc tag, and
+     * description.
+     */
+    private final Map<TypeElement, Content> providesTrees
+            = new TreeMap<>(utils.makeAllClassesComparator());
+
+    private int packageTypesOr = 0;
+
+    protected Set<ModulePackageTypes> modulePackageTypes = EnumSet.noneOf(ModulePackageTypes.class);
+
+    protected Map<String, Integer> typeMap = new LinkedHashMap<>();
 
     /**
      * The HTML tree for main tag.
@@ -92,8 +173,7 @@
     protected HtmlTree sectionTree = HtmlTree.SECTION();
 
     /**
-     * Constructor to construct ModuleWriter object and to generate
-     * "moduleName-summary.html" file.
+     * Constructor to construct ModuleWriter object and to generate "moduleName-summary.html" file.
      *
      * @param configuration the configuration of the doclet.
      * @param mdle        Module under consideration.
@@ -106,7 +186,8 @@
         this.prevModule = prevModule;
         this.nextModule = nextModule;
         this.mdle = mdle;
-        generateDirectiveMap();
+        this.moduleMode = configuration.docEnv.getModuleMode();
+        computeModulesData();
     }
 
     /**
@@ -176,20 +257,165 @@
     }
 
     /**
-     * Generate the directive map for the directives on the module.
+     * Compute the modules data that will be displayed in various tables on the module summary page.
      */
-    public void generateDirectiveMap() {
-        for (ModuleElement.Directive d : mdle.getDirectives()) {
-            if (directiveMap.containsKey(d.getKind())) {
-                List<ModuleElement.Directive> dir = directiveMap.get(d.getKind());
-                dir.add(d);
-                directiveMap.put(d.getKind(), dir);
+    public void computeModulesData() {
+        CommentHelper ch = utils.getCommentHelper(mdle);
+        // Get module dependencies using the module's transitive closure.
+        Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
+        // Add all dependent modules to additional modules set. We will remove the modules,
+        // listed using the requires directive, from this set to come up with the table of additional
+        // required modules.
+        dependentModules.forEach((module, mod) -> {
+            if (shouldDocument(module)) {
+                additionalModules.put(module, new StringContent(mod));
+            }
+        });
+        (ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> {
+            ModuleElement m = directive.getDependency();
+            if (shouldDocument(m)) {
+                if (moduleMode == ModuleMode.ALL || directive.isTransitive()) {
+                    requires.put(m, new StringContent(utils.getModifiers(directive)));
             } else {
-                List<ModuleElement.Directive> dir = new ArrayList<>();
-                dir.add(d);
-                directiveMap.put(d.getKind(), dir);
+                // For api mode, just keep the public requires in dependentModules for display of
+                    // additional packages in the "Packages" section.
+                    dependentModules.remove(m);
+            }
+                additionalModules.remove(m);
+        }
+        });
+        // Get all packages for the module and put it in the concealed packages set.
+        (utils.getModulePackageMap().get(mdle)).forEach((pkg) -> {
+            if (shouldDocument(pkg)) {
+                concealedPackages.add(pkg);
+            }
+        });
+        // Get all exported packages for the module using the exports directive for the module.
+        (ElementFilter.exportsIn(mdle.getDirectives())).forEach((directive) -> {
+            PackageElement p = directive.getPackage();
+            if (shouldDocument(p)) {
+                SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
+                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
+                if (targetMdles != null) {
+                    mdleList.addAll(targetMdles);
+                }
+                // Qualified exports should not be displayed in the api mode. So if mdleList is empty,
+                // its exported to all modules and hence can be added.
+                if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
+                    exportedPackages.put(p, mdleList);
+                }
+                concealedPackages.remove(p);
+            }
+        });
+        // Get all opened packages for the module using the opens directive for the module.
+        (ElementFilter.opensIn(mdle.getDirectives())).forEach((directive) -> {
+            PackageElement p = directive.getPackage();
+            if (shouldDocument(p)) {
+                SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
+                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
+                if (targetMdles != null) {
+                    mdleList.addAll(targetMdles);
+                }
+                // Qualified opens should not be displayed in the api mode. So if mdleList is empty,
+                // it's opened to all modules and hence can be added.
+                if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
+                    openedPackages.put(p, mdleList);
+                }
+                concealedPackages.remove(p);
+            }
+        });
+        // Remove all the exported and opened packages so we have just the concealed packages now.
+        concealedPackages.removeAll(exportedPackages.keySet());
+        concealedPackages.removeAll(openedPackages.keySet());
+        // Get all the exported and opened packages, for the transitive closure of the module, to be displayed in
+        // the additional packages tables.
+        dependentModules.forEach((module, mod) -> {
+            SortedSet<PackageElement> pkgList = new TreeSet<>(utils.makePackageComparator());
+            (ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> {
+                PackageElement pkg = directive.getPackage();
+                if (shouldDocument(pkg)) {
+                    pkgList.add(pkg);
+                }
+            });
+            // If none of the transitive modules have exported packages to be displayed, we should not be
+            // displaying the table and so it should not be added to the map.
+            if (!pkgList.isEmpty()) {
+                additionalPackages.put(module, pkgList);
             }
-        }
+            SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
+            (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
+                PackageElement pkg = directive.getPackage();
+                if (shouldDocument(pkg)) {
+                    openPkgList.add(pkg);
+                }
+            });
+            // If none of the transitive modules have opened packages to be displayed, we should not be
+            // displaying the table and so it should not be added to the map.
+            if (!openPkgList.isEmpty()) {
+                additionalOpenPackages.put(module, openPkgList);
+            }
+        });
+        // Get all the services listed as uses directive.
+        (ElementFilter.usesIn(mdle.getDirectives())).forEach((directive) -> {
+            TypeElement u = directive.getService();
+            if (shouldDocument(u)) {
+                uses.add(u);
+            }
+        });
+        // Get all the services and implementations listed as provides directive.
+        (ElementFilter.providesIn(mdle.getDirectives())).forEach((directive) -> {
+            TypeElement u = directive.getService();
+            if (shouldDocument(u)) {
+                List<? extends TypeElement> implList = directive.getImplementations();
+                SortedSet<TypeElement> implSet = new TreeSet<>(utils.makeAllClassesComparator());
+                implSet.addAll(implList);
+                provides.put(u, implSet);
+            }
+        });
+        // Generate the map of all services listed using @provides, and the description.
+        (utils.getBlockTags(mdle, DocTree.Kind.PROVIDES)).forEach((tree) -> {
+            TypeElement t = ch.getServiceType(configuration, tree);
+            if (t != null) {
+                providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
+            }
+        });
+        // Generate the map of all services listed using @uses, and the description.
+        (utils.getBlockTags(mdle, DocTree.Kind.USES)).forEach((tree) -> {
+            TypeElement t = ch.getServiceType(configuration, tree);
+            if (t != null) {
+                usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
+            }
+        });
+    }
+
+    /**
+     * Returns true if the element should be documented on the module summary page.
+     *
+     * @param element the element to be checked
+     * @return true if the element should be documented
+     */
+    public boolean shouldDocument(Element element) {
+        return (moduleMode == ModuleMode.ALL || utils.isIncluded(element));
+    }
+
+    /**
+     * Returns true if there are elements to be displayed.
+     *
+     * @param section set of elements
+     * @return true if there are elements to be displayed
+     */
+    public boolean display(SortedSet<? extends Element> section) {
+        return section != null && !section.isEmpty();
+    }
+
+    /**
+     * Returns true if there are elements to be displayed.
+     *
+     * @param section map of elements.
+     * @return true if there are elements to be displayed
+     */
+    public boolean display(Map<? extends Element, ?> section) {
+        return section != null && !section.isEmpty();
     }
 
     /**
@@ -207,56 +433,328 @@
     }
 
     /**
-     * Add the summary for the module.
+     * Get table header.
      *
      * @param text the table caption
      * @param tableSummary the summary for the table
-     * @param htmltree the content tree to which the table will be added
+     * @param tableStyle the table style
+     * @param tableHeader the table header
+     * @return a content object
+     */
+    public Content getTableHeader(String text, String tableSummary, HtmlStyle tableStyle,
+            List<String> tableHeader) {
+        return getTableHeader(getTableCaption(new RawHtml(text)), tableSummary, tableStyle, tableHeader);
+    }
+
+    /**
+     * Get table header.
+     *
+     * @param caption the table caption
+     * @param tableSummary the summary for the table
      * @param tableStyle the table style
      * @param tableHeader the table header
-     * @param dirs the list of module directives
+     * @return a content object
      */
-    public void addSummary(String text, String tableSummary, Content htmltree, HtmlStyle tableStyle,
-            List<String> tableHeader, List<ModuleElement.Directive> dirs) {
+    public Content getTableHeader(Content caption, String tableSummary, HtmlStyle tableStyle,
+            List<String> tableHeader) {
         Content table = (configuration.isOutputHtml5())
-                ? HtmlTree.TABLE(tableStyle, getTableCaption(new RawHtml(text)))
-                : HtmlTree.TABLE(tableStyle, tableSummary, getTableCaption(new RawHtml(text)));
+                ? HtmlTree.TABLE(tableStyle, caption)
+                : HtmlTree.TABLE(tableStyle, tableSummary, caption);
         table.addContent(getSummaryTableHeader(tableHeader, "col"));
-        Content tbody = new HtmlTree(HtmlTag.TBODY);
-        addList(dirs, tbody);
+        return table;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addModulesSummary(Content summaryContentTree) {
+        if (display(requires) || display(additionalModules)) {
+            HtmlTree li = new HtmlTree(HtmlTag.LI);
+            li.addStyle(HtmlStyle.blockList);
+            addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
+                    contents.navModules, li);
+            if (display(requires)) {
+            String text = configuration.getText("doclet.Requires_Summary");
+            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                    configuration.getText("doclet.Requires_Summary"),
+                    configuration.getText("doclet.modules"));
+                Content table = getTableHeader(text, tableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
+                Content tbody = new HtmlTree(HtmlTag.TBODY);
+                addModulesList(requires, tbody);
+                table.addContent(tbody);
+                li.addContent(table);
+            }
+            // Display additional modules table in both "api" and "all" mode.
+            if (display(additionalModules)) {
+                String amrText = configuration.getText("doclet.Additional_Modules_Required_Summary");
+                String amrTableSummary = configuration.getText("doclet.Member_Table_Summary",
+                        configuration.getText("doclet.Additional_Modules_Required_Summary"),
+                        configuration.getText("doclet.modules"));
+                Content amrTable = getTableHeader(amrText, amrTableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
+                Content amrTbody = new HtmlTree(HtmlTag.TBODY);
+                addModulesList(additionalModules, amrTbody);
+                amrTable.addContent(amrTbody);
+                li.addContent(amrTable);
+            }
+            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            summaryContentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the list of modules.
+     *
+     * @param mdleMap map of modules and modifiers
+     * @param tbody the content tree to which the list will be added
+     */
+    public void addModulesList(Map<ModuleElement, Content> mdleMap, Content tbody) {
+        boolean altColor = true;
+        for (ModuleElement m : mdleMap.keySet()) {
+            Content tdModifiers = HtmlTree.TD(HtmlStyle.colFirst, mdleMap.get(m));
+            Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
+            Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colSecond, moduleLinkContent);
+            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+            tdSummary.addStyle(HtmlStyle.colLast);
+            addSummaryComment(m, tdSummary);
+            HtmlTree tr = HtmlTree.TR(tdModifiers);
+            tr.addContent(thModule);
+            tr.addContent(tdSummary);
+            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+            tbody.addContent(tr);
+            altColor = !altColor;
+        }
+    }
+
+    public void addPackagesSummary(Content summaryContentTree) {
+        if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)
+                || display(additionalPackages) || display(additionalOpenPackages)) {
+            HtmlTree li = new HtmlTree(HtmlTag.LI);
+            li.addStyle(HtmlStyle.blockList);
+            addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
+                    contents.navPackages, li);
+            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                    configuration.getText("doclet.Packages_Summary"),
+                    configuration.getText("doclet.packages"));
+            if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)) {
+                addPackageSummary(tableSummary, li);
+            }
+            if (display(additionalPackages)) {
+                String aepText = configuration.getText("doclet.Additional_Exported_Packages_Summary");
+                String aepTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
+                        configuration.getText("doclet.Additional_Exported_Packages_Summary"),
+                        configuration.getText("doclet.modules"),
+                        configuration.getText("doclet.packages"));
+                Content aepTable = getTableHeader(aepText, aepTableSummary, HtmlStyle.packagesSummary,
+                        additionalPackagesTableHeader);
+                Content aepTbody = new HtmlTree(HtmlTag.TBODY);
+                addAdditionalPackages(aepTbody, additionalPackages);
+                aepTable.addContent(aepTbody);
+                li.addContent(aepTable);
+            }
+            if (display(additionalOpenPackages)) {
+                String aopText = configuration.getText("doclet.Additional_Opened_Packages_Summary");
+                String aopTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
+                        configuration.getText("doclet.Additional_Opened_Packages_Summary"),
+                        configuration.getText("doclet.modules"),
+                        configuration.getText("doclet.packages"));
+                Content aopTable = getTableHeader(aopText, aopTableSummary, HtmlStyle.packagesSummary,
+                        additionalPackagesTableHeader);
+                Content aopTbody = new HtmlTree(HtmlTag.TBODY);
+                addAdditionalPackages(aopTbody, additionalOpenPackages);
+                aopTable.addContent(aopTbody);
+                li.addContent(aopTable);
+            }
+            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            summaryContentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the package summary for the module.
+     *
+     * @param tableSummary
+     * @param li
+     */
+    public void addPackageSummary(String tableSummary, HtmlTree li) {
+        Content caption;
+        Content tbody = getPackageTableRows();
+        if (showTabs()) {
+            caption = getTableCaption();
+            generateTableTabTypesScript(typeMap, modulePackageTypes, "packages");
+        } else {
+            ModulePackageTypes type = modulePackageTypes.iterator().next();
+            caption = getTableCaption(configuration.getContent(type.tableTabs().resourceKey()));
+        }
+        Content table = getTableHeader(caption, tableSummary, HtmlStyle.packagesSummary, exportedPackagesTableHeader);
         table.addContent(tbody);
-        htmltree.addContent(table);
+        li.addContent(table);
     }
 
     /**
-     * Add the list of directives for the module.
+     * Returns true if the table tabs needs to be displayed.
+     *
+     * @return true if the tabs should be displayed
+     */
+    public boolean showTabs() {
+        int value;
+        for (ModulePackageTypes type : EnumSet.allOf(ModulePackageTypes.class)) {
+            value = type.tableTabs().value();
+            if ((value & packageTypesOr) == value) {
+                modulePackageTypes.add(type);
+            }
+        }
+        boolean showTabs = modulePackageTypes.size() > 1;
+        if (showTabs) {
+            modulePackageTypes.add(ModulePackageTypes.ALL);
+        }
+        return showTabs;
+    }
+
+    /**
+     * Get the summary table caption.
      *
-     * @param dirs the list of module directives
-     * @param tbody the content tree to which the list is added
+     * @return the caption for the summary table
      */
-    public void addList(List<ModuleElement.Directive> dirs, Content tbody) {
+    public Content getTableCaption() {
+        Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION);
+        for (ModulePackageTypes type : modulePackageTypes) {
+            Content captionSpan;
+            Content span;
+            if (type.tableTabs().isDefaultTab()) {
+                captionSpan = HtmlTree.SPAN(configuration.getContent(type.tableTabs().resourceKey()));
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
+                        HtmlStyle.activeTableTab, captionSpan);
+            } else {
+                captionSpan = HtmlTree.SPAN(getPackageTypeLinks(type));
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
+                        HtmlStyle.tableTab, captionSpan);
+            }
+            Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, Contents.SPACE);
+            span.addContent(tabSpan);
+            tabbedCaption.addContent(span);
+        }
+        return tabbedCaption;
+    }
+
+    /**
+     * Get the package type links for the table caption.
+     *
+     * @param packageType the package type to be displayed as link
+     * @return the content tree for the package type link
+     */
+    public Content getPackageTypeLinks(ModulePackageTypes packageType) {
+        String jsShow = "javascript:showPkgs(" + packageType.tableTabs().value() + ");";
+        HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(packageType.tableTabs().resourceKey()));
+        return link;
+    }
+
+    /**
+     * Get the package table rows.
+     *
+     * @return a content object
+     */
+    public Content getPackageTableRows() {
+        Content tbody = new HtmlTree(HtmlTag.TBODY);
         boolean altColor = true;
-        for (ModuleElement.Directive direct : dirs) {
-            DirectiveKind kind = direct.getKind();
-            switch (kind) {
-                case REQUIRES:
-                    addRequiresList((ModuleElement.RequiresDirective) direct, tbody, altColor);
-                    break;
-                case EXPORTS:
-                    addExportedPackagesList((ModuleElement.ExportsDirective) direct, tbody, altColor);
-                    break;
-                case OPENS:
-                    //XXX ignore for now
-                    break;
-                case USES:
-                    addUsesList((ModuleElement.UsesDirective) direct, tbody, altColor);
-                    break;
-                case PROVIDES:
-                    addProvidesList((ModuleElement.ProvidesDirective) direct, tbody, altColor);
-                    break;
-                default:
-                    throw new AssertionError("unknown directive kind: " + kind);
+        int counter = 0;
+        counter = addPackageTableRows(tbody, counter, ModulePackageTypes.EXPORTED, exportedPackages);
+        counter = addPackageTableRows(tbody, counter, ModulePackageTypes.OPENED, openedPackages);
+        // Show concealed packages only in "all" mode.
+        if (moduleMode == ModuleMode.ALL) {
+            for (PackageElement pkg : concealedPackages) {
+                Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+                Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, pkgLinkContent);
+                HtmlTree tdModules = new HtmlTree(HtmlTag.TD);
+                tdModules.addStyle(HtmlStyle.colSecond);
+                tdModules.addContent(configuration.getText("doclet.None"));
+        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+        tdSummary.addStyle(HtmlStyle.colLast);
+                addSummaryComment(pkg, tdSummary);
+        HtmlTree tr = HtmlTree.TR(thPackage);
+                tr.addContent(tdModules);
+        tr.addContent(tdSummary);
+        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+                int pkgType = ModulePackageTypes.CONCEALED.tableTabs().value();
+                packageTypesOr = packageTypesOr | pkgType;
+                String tableId = "i" + counter;
+                counter++;
+                typeMap.put(tableId, pkgType);
+                tr.addAttr(HtmlAttr.ID, tableId);
+        tbody.addContent(tr);
+                altColor = !altColor;
             }
+        }
+        return tbody;
+    }
+
+    public int addPackageTableRows(Content tbody, int counter, ModulePackageTypes pType,
+            Map<PackageElement,SortedSet<ModuleElement>> ap) {
+        boolean altColor = true;
+        for (Map.Entry<PackageElement, SortedSet<ModuleElement>> entry : ap.entrySet()) {
+            PackageElement pkg = entry.getKey();
+            SortedSet<ModuleElement> mdleList = entry.getValue();
+            Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+            Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, pkgLinkContent);
+            HtmlTree tr = HtmlTree.TR(thPackage);
+            if (moduleMode == ModuleMode.ALL) {
+                HtmlTree tdModules = new HtmlTree(HtmlTag.TD);
+                tdModules.addStyle(HtmlStyle.colSecond);
+                if (!mdleList.isEmpty()) {
+                    int sep = 0;
+                    for (ModuleElement m : mdleList) {
+                        if (sep > 0) {
+                            tdModules.addContent(new HtmlTree(HtmlTag.BR));
+                        }
+                        tdModules.addContent(getModuleLink(m, new StringContent(m.getQualifiedName())));
+                        sep++;
+                    }
+                } else {
+                    tdModules.addContent(configuration.getText("doclet.All_Modules"));
+                }
+                tr.addContent(tdModules);
+            }
+            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+            tdSummary.addStyle(HtmlStyle.colLast);
+            addSummaryComment(pkg, tdSummary);
+            tr.addContent(tdSummary);
+            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+            int pkgType = pType.tableTabs().value();
+            packageTypesOr = packageTypesOr | pkgType;
+            String tableId = "i" + counter;
+            counter++;
+            typeMap.put(tableId, pkgType);
+            tr.addAttr(HtmlAttr.ID, tableId);
+            tbody.addContent(tr);
+            altColor = !altColor;
+        }
+        return counter;
+    }
+
+    /**
+     * Add the additional packages for the module being documented.
+     *
+     * @param tbody the content tree to which the table will be added
+     * @param ap additional packages to be added
+     */
+    public void addAdditionalPackages(Content tbody, Map<ModuleElement, SortedSet<PackageElement>> ap) {
+        boolean altColor = true;
+        for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ap.entrySet()) {
+            ModuleElement m = entry.getKey();
+            SortedSet<PackageElement> pkgList = entry.getValue();
+            Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
+            Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
+            HtmlTree tdPackages = new HtmlTree(HtmlTag.TD);
+            tdPackages.addStyle(HtmlStyle.colLast);
+            String sep = "";
+            for (PackageElement pkg : pkgList) {
+                tdPackages.addContent(sep);
+                tdPackages.addContent(getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))));
+                sep = " ";
+            }
+            HtmlTree tr = HtmlTree.TR(thModule);
+            tr.addContent(tdPackages);
+            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+            tbody.addContent(tr);
             altColor = !altColor;
         }
     }
@@ -264,154 +762,39 @@
     /**
      * {@inheritDoc}
      */
-    @Override
-    public void addModulesSummary(Content summaryContentTree) {
-        List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.REQUIRES);
-        if (dirs != null && !dirs.isEmpty()) {
-            HtmlTree li = new HtmlTree(HtmlTag.LI);
-            li.addStyle(HtmlStyle.blockList);
-            addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
-                    contents.navModules, li);
-            String text = configuration.getText("doclet.Requires_Summary");
-            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
-                    configuration.getText("doclet.Requires_Summary"),
-                    configuration.getText("doclet.modules"));
-            addRequiresSummary(text, tableSummary, dirs, li);
-            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
-            summaryContentTree.addContent(ul);
-        }
-    }
-
-    /**
-     * Add the requires summary for the module.
-     *
-     * @param text the table caption
-     * @param tableSummary the summary for the table
-     * @param dirs the list of module directives
-     * @param htmltree the content tree to which the table will be added
-     */
-    public void addRequiresSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
-            Content htmltree) {
-        addSummary(text, tableSummary, htmltree, HtmlStyle.requiresSummary, requiresTableHeader, dirs);
-    }
-
-    /**
-     * Add the requires directive list for the module.
-     *
-     * @param direct the requires directive
-     * @param tbody the content tree to which the directive will be added
-     * @param altColor true if altColor style should be used or false if rowColor style should be used
-     */
-    public void addRequiresList(ModuleElement.RequiresDirective direct, Content tbody, boolean altColor) {
-        ModuleElement m = direct.getDependency();
-        Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName().toString()));
-        Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
-        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
-        tdSummary.addStyle(HtmlStyle.colLast);
-        addSummaryComment(m, tdSummary);
-        HtmlTree tr = HtmlTree.TR(thPackage);
-        tr.addContent(tdSummary);
-        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-        tbody.addContent(tr);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void addPackagesSummary(Content summaryContentTree) {
-        List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.EXPORTS);
-        if (dirs != null && !dirs.isEmpty()) {
-            HtmlTree li = new HtmlTree(HtmlTag.LI);
-            li.addStyle(HtmlStyle.blockList);
-            addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
-                    contents.navPackages, li);
-            String text = configuration.getText("doclet.Exported_Packages_Summary");
-            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
-                    configuration.getText("doclet.Exported_Packages_Summary"),
-                    configuration.getText("doclet.packages"));
-            addExportedPackagesSummary(text, tableSummary, dirs, li);
-            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
-            summaryContentTree.addContent(ul);
-        }
-    }
-
-    /**
-     * Add the exported packages summary for the module.
-     *
-     * @param text the table caption
-     * @param tableSummary the summary for the table
-     * @param dirs the list of module directives
-     * @param htmltree the content tree to which the table will be added
-     */
-    public void addExportedPackagesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
-            Content htmltree) {
-        addSummary(text, tableSummary, htmltree, HtmlStyle.packagesSummary, exportedPackagesTableHeader, dirs);
-    }
-
-    /**
-     * Add the exported packages list for the module.
-     *
-     * @param direct the requires directive
-     * @param tbody the content tree to which the directive will be added
-     * @param altColor true if altColor style should be used or false if rowColor style should be used
-     */
-    public void addExportedPackagesList(ModuleElement.ExportsDirective direct, Content tbody, boolean altColor) {
-        PackageElement pkg = direct.getPackage();
-        Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
-        Content tdPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, pkgLinkContent);
-        HtmlTree thModules = new HtmlTree(HtmlTag.TD);
-        thModules.addStyle(HtmlStyle.colSecond);
-        List<? extends ModuleElement> targetModules = direct.getTargetModules();
-        if (targetModules != null) {
-            List<? extends ModuleElement> mElements = direct.getTargetModules();
-            for (int i = 0; i < mElements.size(); i++) {
-                if (i > 0) {
-                    thModules.addContent(new HtmlTree(HtmlTag.BR));
-                }
-                ModuleElement m = mElements.get(i);
-                thModules.addContent(new StringContent(m.getQualifiedName().toString()));
-            }
-        } else {
-            thModules.addContent(configuration.getText("doclet.All_Modules"));
-        }
-        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
-        tdSummary.addStyle(HtmlStyle.colLast);
-        addSummaryComment(pkg, tdSummary);
-        HtmlTree tr = HtmlTree.TR(tdPackage);
-        tr.addContent(thModules);
-        tr.addContent(tdSummary);
-        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-        tbody.addContent(tr);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
     public void addServicesSummary(Content summaryContentTree) {
-        List<ModuleElement.Directive> usesDirs = directiveMap.get(DirectiveKind.USES);
-        List<ModuleElement.Directive> providesDirs = directiveMap.get(DirectiveKind.PROVIDES);
-        if ((usesDirs != null && !usesDirs.isEmpty()) || (providesDirs != null && !providesDirs.isEmpty())) {
+        if (display(uses) || display(provides)) {
             HtmlTree li = new HtmlTree(HtmlTag.LI);
             li.addStyle(HtmlStyle.blockList);
             addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
                     contents.navServices, li);
             String text;
             String tableSummary;
-            if (usesDirs != null && !usesDirs.isEmpty()) {
+            if (display(uses)) {
                 text = configuration.getText("doclet.Uses_Summary");
                 tableSummary = configuration.getText("doclet.Member_Table_Summary",
                         configuration.getText("doclet.Uses_Summary"),
                         configuration.getText("doclet.types"));
-                addUsesSummary(text, tableSummary, usesDirs, li);
+                Content table = getTableHeader(text, tableSummary, HtmlStyle.usesSummary, usesTableHeader);
+                Content tbody = new HtmlTree(HtmlTag.TBODY);
+                addUsesList(tbody);
+                if (!tbody.isEmpty()) {
+                    table.addContent(tbody);
+                    li.addContent(table);
             }
-            if (providesDirs != null && !providesDirs.isEmpty()) {
+            }
+            if (display(provides)) {
                 text = configuration.getText("doclet.Provides_Summary");
                 tableSummary = configuration.getText("doclet.Member_Table_Summary",
                         configuration.getText("doclet.Provides_Summary"),
                         configuration.getText("doclet.types"));
-                addProvidesSummary(text, tableSummary, providesDirs, li);
+                Content table = getTableHeader(text, tableSummary, HtmlStyle.providesSummary, providesTableHeader);
+                Content tbody = new HtmlTree(HtmlTag.TBODY);
+                addProvidesList(tbody);
+                if (!tbody.isEmpty()) {
+                    table.addContent(tbody);
+                    li.addContent(table);
+                }
             }
             HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
             summaryContentTree.addContent(ul);
@@ -419,79 +802,94 @@
     }
 
     /**
-     * Add the uses summary for the module.
-     *
-     * @param text the table caption
-     * @param tableSummary the summary for the table
-     * @param dirs the list of module directives
-     * @param htmltree the content tree to which the table will be added
-     */
-    public void addUsesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
-            Content htmltree) {
-        addSummary(text, tableSummary, htmltree, HtmlStyle.usesSummary, usesTableHeader, dirs);
-    }
-
-    /**
      * Add the uses list for the module.
      *
-     * @param direct the requires directive
      * @param tbody the content tree to which the directive will be added
-     * @param altColor true if altColor style should be used or false if rowColor style should be used
      */
-    public void addUsesList(ModuleElement.UsesDirective direct, Content tbody, boolean altColor) {
-        TypeElement type = direct.getService();
-        Content typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, type));
-        Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, typeLinkContent);
-        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+    public void addUsesList(Content tbody) {
+        boolean altColor = true;
+        Content typeLinkContent;
+        Content thType;
+        HtmlTree tdSummary;
+        Content description;
+        for (TypeElement t : uses) {
+            // For each uses directive in the module declaration, if we are in the "api" mode and
+            // if there are service types listed using @uses javadoc tag, check if the service type in
+            // the uses directive is specified using the @uses tag. If not, we do not display the
+            // service type in the "api" mode.
+            if (moduleMode == ModuleMode.API && display(usesTrees) && !usesTrees.containsKey(t)) {
+                continue;
+            }
+            typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t));
+            thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, typeLinkContent);
+            tdSummary = new HtmlTree(HtmlTag.TD);
         tdSummary.addStyle(HtmlStyle.colLast);
-        addSummaryComment(type, tdSummary);
-        HtmlTree tr = HtmlTree.TR(thPackage);
+            if (display(usesTrees)) {
+                description = usesTrees.get(t);
+                if (description != null) {
+                    tdSummary.addContent(description);
+                }
+            }
+            addSummaryComment(t, tdSummary);
+            HtmlTree tr = HtmlTree.TR(thType);
         tr.addContent(tdSummary);
         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
         tbody.addContent(tr);
+            altColor = !altColor;
+        }
     }
 
     /**
-     * Add the provides summary for the module.
+     * Add the provides list for the module.
      *
-     * @param text the table caption
-     * @param tableSummary the summary for the table
-     * @param dirs the list of module directives
-     * @param htmltree the content tree to which the table will be added
+     * @param tbody the content tree to which the directive will be added
      */
-    public void addProvidesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
-            Content htmltree) {
-        addSummary(text, tableSummary, htmltree, HtmlStyle.providesSummary, providesTableHeader, dirs);
+    public void addProvidesList(Content tbody) {
+        boolean altColor = true;
+        TypeElement srv;
+        SortedSet<TypeElement> implSet;
+        Content description;
+        for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) {
+            srv = entry.getKey();
+            // For each provides directive in the module declaration, if we are in the "api" mode and
+            // if there are service types listed using @provides javadoc tag, check if the service type in
+            // the provides directive is specified using the @provides tag. If not, we do not display the
+            // service type in the "api" mode.
+            if (moduleMode == ModuleMode.API && display(providesTrees) && !providesTrees.containsKey(srv)) {
+                continue;
     }
-
-    /**
-     * Add the exported packages list for the module.
-     *
-     * @param direct the requires directive
-     * @param tbody the content tree to which the directive will be added
-     * @param altColor true if altColor style should be used or false if rowColor style should be used
-     */
-    public void addProvidesList(ModuleElement.ProvidesDirective direct, Content tbody, boolean altColor) {
-        List<? extends TypeElement> impls = direct.getImplementations();
-        for (TypeElement impl : impls) {
-            TypeElement srv = direct.getService();
-            Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl));
+            implSet = entry.getValue();
             Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
             HtmlTree thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, srvLinkContent);
-            thType.addContent(new HtmlTree(HtmlTag.BR));
-            thType.addContent("(");
-            HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
-            thType.addContent(implSpan);
-            thType.addContent(Contents.SPACE);
-            thType.addContent(implLinkContent);
-            thType.addContent(")");
             HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
             tdDesc.addStyle(HtmlStyle.colLast);
+            if (display(providesTrees)) {
+                description = providesTrees.get(srv);
+                if (description != null) {
+                    tdDesc.addContent(description);
+                }
+            }
             addSummaryComment(srv, tdDesc);
+            // Only display the implementation details in the "all" mode.
+            if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
+                tdDesc.addContent(new HtmlTree(HtmlTag.BR));
+                tdDesc.addContent("(");
+                HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
+                tdDesc.addContent(implSpan);
+                tdDesc.addContent(Contents.SPACE);
+                String sep = "";
+                for (TypeElement impl : implSet) {
+                    tdDesc.addContent(sep);
+                    tdDesc.addContent(getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl)));
+                    sep = ", ";
+                }
+                tdDesc.addContent(")");
+            }
             HtmlTree tr = HtmlTree.TR(thType);
             tr.addContent(tdDesc);
             tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
             tbody.addContent(tr);
+            altColor = !altColor;
         }
     }
 
@@ -506,7 +904,7 @@
             CommentHelper ch = utils.getCommentHelper(mdle);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
-            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
                 List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
@@ -574,15 +972,17 @@
                 ? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription)
                 : contents.navModuleDescription);
         addNavGap(liNav);
-        liNav.addContent(showDirectives(DirectiveKind.REQUIRES)
+        liNav.addContent((display(requires) || display(additionalModules))
                 ? getHyperLink(SectionName.MODULES, contents.navModules)
                 : contents.navModules);
         addNavGap(liNav);
-        liNav.addContent(showDirectives(DirectiveKind.EXPORTS)
+        liNav.addContent((display(exportedPackages) || display(openedPackages) || display(concealedPackages)
+                || display(additionalPackages) || display(additionalOpenPackages))
                 ? getHyperLink(SectionName.PACKAGES, contents.navPackages)
                 : contents.navPackages);
         addNavGap(liNav);
-        liNav.addContent((showDirectives(DirectiveKind.USES) || showDirectives(DirectiveKind.PROVIDES))
+        liNav.addContent((display(uses) || (moduleMode == ModuleMode.API && display(usesTrees))
+                || display(provides) || (moduleMode == ModuleMode.API && display(providesTrees)))
                 ? getHyperLink(SectionName.SERVICES, contents.navServices)
                 : contents.navServices);
         ulNav.addContent(liNav);
@@ -590,16 +990,6 @@
     }
 
     /**
-     * Return true if the directive should be displayed.
-     *
-     * @param dirKind the kind of directive for the module
-     * @return true if the directive should be displayed
-     */
-    private boolean showDirectives(DirectiveKind dirKind) {
-        return directiveMap.get(dirKind) != null && !directiveMap.get(dirKind).isEmpty();
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
@@ -629,6 +1019,8 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @throws jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException
      */
     @Override
     public void printDocument(Content contentTree) throws DocFileIOException {
@@ -648,7 +1040,7 @@
             deprs = utils.getDeprecatedTrees(pkg);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
-            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
                 CommentHelper ch = utils.getCommentHelper(pkg);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -125,8 +125,8 @@
         }
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
-        ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
         if (configuration.showModules) {
+            ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
             Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
             Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
             moduleNameDiv.addContent(Contents.SPACE);
@@ -172,7 +172,7 @@
             CommentHelper ch = utils.getCommentHelper(packageElement);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
-            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
                 List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
@@ -223,7 +223,7 @@
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
                 if (utils.isDeprecated(klass)) {
-                    tdClassDescription.addContent(contents.deprecatedLabel);
+                    tdClassDescription.addContent(getDeprecatedPhrase(klass));
                     List<? extends DocTree> tags = utils.getDeprecatedTrees(klass);
                     if (!tags.isEmpty()) {
                         addSummaryDeprecatedComment(klass, tags.get(0), tdClassDescription);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -97,7 +97,7 @@
         Content caption;
         if (showTabs) {
             caption = getTableCaption(mw.methodTypes);
-            generateMethodTypesScript(mw.typeMap, mw.methodTypes);
+            generateTableTabTypesScript(mw.typeMap, mw.methodTypes, "methods");
         }
         else {
             caption = getTableCaption(mw.getCaption());
@@ -123,13 +123,13 @@
         for (MethodTypes type : methodTypes) {
             Content captionSpan;
             Content span;
-            if (type.isDefaultTab()) {
-                captionSpan = HtmlTree.SPAN(configuration.getContent(type.resourceKey()));
-                span = HtmlTree.SPAN(type.tabId(),
+            if (type.tableTabs().isDefaultTab()) {
+                captionSpan = HtmlTree.SPAN(configuration.getContent(type.tableTabs().resourceKey()));
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
                         HtmlStyle.activeTableTab, captionSpan);
             } else {
                 captionSpan = HtmlTree.SPAN(getMethodTypeLinks(type));
-                span = HtmlTree.SPAN(type.tabId(),
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
                         HtmlStyle.tableTab, captionSpan);
             }
             Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, Contents.SPACE);
@@ -146,8 +146,8 @@
      * @return the content tree for the method type link
      */
     public Content getMethodTypeLinks(MethodTypes methodType) {
-        String jsShow = "javascript:show(" + methodType.value() +");";
-        HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(methodType.resourceKey()));
+        String jsShow = "javascript:show(" + methodType.tableTabs().value() +");";
+        HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(methodType.tableTabs().resourceKey()));
         return link;
     }
 
@@ -187,7 +187,7 @@
         List<? extends DocTree> deprs = utils.getBlockTags(member, DocTree.Kind.DEPRECATED);
         Content div;
         if (utils.isDeprecated(member)) {
-            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(member));
             div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             div.addContent(Contents.SPACE);
             if (!deprs.isEmpty()) {
@@ -198,7 +198,7 @@
         } else {
             Element te = member.getEnclosingElement();
             if (te != null &&  utils.isTypeElement(te) && utils.isDeprecated(te)) {
-                Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+                Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(te));
                 div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
                 div.addContent(Contents.SPACE);
                 tdSummary.addContent(div);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -178,7 +178,7 @@
         if (utils.isTypeElement(element)) {
             if (utils.isDeprecated(element)) {
                 result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
-                        new StringContent(configuration.getText("doclet.Deprecated"))));
+                        htmlWriter.getDeprecatedPhrase(element)));
                 result.addContent(RawHtml.nbsp);
                 if (!deprs.isEmpty()) {
                     List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
@@ -190,7 +190,7 @@
         } else {
             if (utils.isDeprecated(element)) {
                 result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
-                        new StringContent(configuration.getText("doclet.Deprecated"))));
+                        htmlWriter.getDeprecatedPhrase(element)));
                 result.addContent(RawHtml.nbsp);
                 if (!deprs.isEmpty()) {
                     List<? extends DocTree> bodyTags = ch.getBody(configuration, deprs.get(0));
@@ -199,9 +199,10 @@
                         result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
                 }
             } else {
-                if (utils.isDeprecated(utils.getEnclosingTypeElement(element))) {
+                Element ee = utils.getEnclosingTypeElement(element);
+                if (utils.isDeprecated(ee)) {
                     result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
-                            new StringContent(configuration.getText("doclet.Deprecated"))));
+                        htmlWriter.getDeprecatedPhrase(ee)));
                     result.addContent(RawHtml.nbsp);
                 }
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -37,7 +37,7 @@
  * A sequence of Content nodes.
  */
 public class ContentBuilder extends Content {
-    protected List<Content> contents = Collections.<Content>emptyList();
+    protected List<Content> contents = Collections.emptyList();
 
     @Override
     public void addContent(Content content) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java	Fri Dec 16 11:58:18 2016 -0800
@@ -43,7 +43,7 @@
  */
 public class HtmlDocument extends Content {
 
-    private List<Content> docContent = Collections.<Content>emptyList();
+    private List<Content> docContent = Collections.emptyList();
 
     /**
      * Constructor to construct an HTML document.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Fri Dec 16 11:58:18 2016 -0800
@@ -53,8 +53,8 @@
 public class HtmlTree extends Content {
 
     private HtmlTag htmlTag;
-    private Map<HtmlAttr,String> attrs = Collections.<HtmlAttr,String>emptyMap();
-    private List<Content> content = Collections.<Content>emptyList();
+    private Map<HtmlAttr,String> attrs = Collections.emptyMap();
+    private List<Content> content = Collections.emptyList();
     public static final Content EMPTY = new StringContent("");
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -28,6 +28,7 @@
 import java.io.*;
 import java.util.*;
 
+import jdk.javadoc.doclet.DocletEnvironment.ModuleMode;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
@@ -35,7 +36,8 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
-import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
+import jdk.javadoc.internal.doclets.toolkit.util.ModulePackageTypes;
+import jdk.javadoc.internal.doclets.toolkit.util.TableTabTypes;
 
 
 /**
@@ -64,32 +66,37 @@
     protected Configuration configuration;
 
     /**
-     * Header for table displaying modules and description..
+     * Header for table displaying modules and description.
      */
     protected final List<String> moduleTableHeader;
 
     /**
-     * Header for tables displaying packages and description..
+     * Header for tables displaying packages and description.
      */
     protected final List<String> packageTableHeader;
 
     /**
-     * Header for tables displaying modules and description..
+     * Header for tables displaying modules and description.
      */
     protected final List<String> requiresTableHeader;
 
     /**
-     * Header for tables displaying packages and description..
+     * Header for tables displaying packages and description.
      */
     protected final List<String> exportedPackagesTableHeader;
 
     /**
-     * Header for tables displaying types and description..
+     * Header for tables displaying modules and exported packages.
+     */
+    protected final List<String> additionalPackagesTableHeader;
+
+    /**
+     * Header for tables displaying types and description.
      */
     protected final List<String> usesTableHeader;
 
     /**
-     * Header for tables displaying types and description..
+     * Header for tables displaying types and description.
      */
     protected final List<String> providesTableHeader;
 
@@ -129,12 +136,18 @@
         packageTableHeader.add(resources.getText("doclet.Package"));
         packageTableHeader.add(resources.getText("doclet.Description"));
         requiresTableHeader = new ArrayList<>();
+        requiresTableHeader.add(resources.getText("doclet.Modifier"));
         requiresTableHeader.add(resources.getText("doclet.Module"));
         requiresTableHeader.add(resources.getText("doclet.Description"));
         exportedPackagesTableHeader = new ArrayList<>();
         exportedPackagesTableHeader.add(resources.getText("doclet.Package"));
+        if (configuration.docEnv.getModuleMode() == ModuleMode.ALL) {
         exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
+        }
         exportedPackagesTableHeader.add(resources.getText("doclet.Description"));
+        additionalPackagesTableHeader = new ArrayList<>();
+        additionalPackagesTableHeader.add(resources.getText("doclet.Module"));
+        additionalPackagesTableHeader.add(resources.getText("doclet.Packages"));
         usesTableHeader = new ArrayList<>();
         usesTableHeader.add(resources.getText("doclet.Type"));
         usesTableHeader.add(resources.getText("doclet.Description"));
@@ -317,12 +330,15 @@
      * Generated javascript variables for the document.
      *
      * @param typeMap map comprising of method and type relationship
-     * @param methodTypes set comprising of all methods types for this class
+     * @param tabTypes set comprising of all table tab types for this class
+     * @param elementName packages or methods table for which tabs need to be displayed
      */
-    public void generateMethodTypesScript(Map<String,Integer> typeMap,
-            Set<MethodTypes> methodTypes) {
+    public void generateTableTabTypesScript(Map<String,Integer> typeMap,
+            Set<? extends TableTabTypes> tabTypes, String elementName) {
         String sep = "";
-        StringBuilder vars = new StringBuilder("var methods = {");
+        StringBuilder vars = new StringBuilder("var ");
+        vars.append(elementName)
+                .append(" = {");
         for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
             vars.append(sep);
             sep = ",";
@@ -334,18 +350,18 @@
         vars.append("};").append(DocletConstants.NL);
         sep = "";
         vars.append("var tabs = {");
-        for (MethodTypes entry : methodTypes) {
+        for (TableTabTypes entry : tabTypes) {
             vars.append(sep);
             sep = ",";
-            vars.append(entry.value())
+            vars.append(entry.tableTabs().value())
                     .append(":")
                     .append("[")
                     .append("\"")
-                    .append(entry.tabId())
+                    .append(entry.tableTabs().tabId())
                     .append("\"")
                     .append(sep)
                     .append("\"")
-                    .append(configuration.getText(entry.resourceKey()))
+                    .append(configuration.getText(entry.tableTabs().resourceKey()))
                     .append("\"]");
         }
         vars.append("};")
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Fri Dec 16 11:58:18 2016 -0800
@@ -3,10 +3,12 @@
 doclet.Overview=Overview
 doclet.Window_Overview=Overview List
 doclet.Window_Overview_Summary=Overview
+doclet.Element=Element
 doclet.Package=Package
 doclet.Module=Module
 doclet.All_Packages=All Packages
 doclet.All_Modules=All Modules
+doclet.None=None
 doclet.Tree=Tree
 doclet.Class_Hierarchy=Class Hierarchy
 doclet.Window_Class_Hierarchy=Class Hierarchy
@@ -71,6 +73,7 @@
 doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1}
 doclet.tag.invalid_usage=invalid usage of tag {0}
 doclet.Deprecated_API=Deprecated API
+doclet.Deprecated_For_Removal=Deprecated For Removal
 doclet.Deprecated_Modules=Deprecated Modules
 doclet.Deprecated_Packages=Deprecated Packages
 doclet.Deprecated_Classes=Deprecated Classes
@@ -84,6 +87,7 @@
 doclet.Deprecated_Methods=Deprecated Methods
 doclet.Deprecated_Enum_Constants=Deprecated Enum Constants
 doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements
+doclet.deprecated_for_removal=deprecated for removal
 doclet.deprecated_modules=deprecated modules
 doclet.deprecated_packages=deprecated packages
 doclet.deprecated_classes=deprecated classes
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java	Fri Dec 16 11:58:18 2016 -0800
@@ -263,9 +263,7 @@
         generateClassFiles(classtree);
         SortedSet<PackageElement> packages = new TreeSet<>(utils.makePackageComparator());
         packages.addAll(configuration.getSpecifiedPackageElements());
-        configuration.modulePackages.values().stream().forEach(pset -> {
-            packages.addAll(pset);
-        });
+        configuration.modulePackages.values().stream().forEach(packages::addAll);
         for (PackageElement pkg : packages) {
             generateClassFiles(utils.getAllClasses(pkg), classtree);
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -529,9 +529,7 @@
             buildInheritedSummary(writer, visibleMemberMap, summaryTreeList);
         if (!summaryTreeList.isEmpty()) {
             Content memberTree = writer.getMemberSummaryHeader(typeElement, memberSummaryTree);
-            summaryTreeList.stream().forEach((aSummaryTreeList) -> {
-                memberTree.addContent(aSummaryTreeList);
-            });
+            summaryTreeList.stream().forEach(memberTree::addContent);
             writer.addMemberTree(memberSummaryTree, memberTree);
         }
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Fri Dec 16 11:58:18 2016 -0800
@@ -82,7 +82,13 @@
 doclet.javafx_tag_misuse=Tags @propertyGetter, @propertySetter and @propertyDescription can only be used in JavaFX properties getters and setters.
 doclet.Package_Summary=Package Summary
 doclet.Requires_Summary=Requires
+doclet.Additional_Modules_Required_Summary=Additional Modules Required
+doclet.Additional_Exported_Packages_Summary=Additional Exported Packages
+doclet.Additional_Opened_Packages_Summary=Additional Opened Packages
 doclet.Exported_Packages_Summary=Exported Packages
+doclet.Opened_Packages_Summary=Opened Packages
+doclet.Concealed_Packages_Summary=Concealed Packages
+doclet.Packages_Summary=Packages
 doclet.Uses_Summary=Uses
 doclet.Provides_Summary=Provides
 doclet.Module_Summary=Module Summary
@@ -150,6 +156,7 @@
 doclet.Method_Detail=Method Detail
 doclet.Constructor_Detail=Constructor Detail
 doclet.Deprecated=Deprecated.
+doclet.DeprecatedForRemoval=Deprecated, for removal: This API element is subject to removal in a future version. 
 doclet.Hidden=Hidden
 doclet.Groupname_already_used=In -group option, groupname already used: {0}
 doclet.value_tag_invalid_reference={0} (referenced by @value tag) is an unknown reference.
@@ -160,6 +167,7 @@
 doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
 doclet.Constants_Table_Summary={0} table, listing constant fields, and values
 doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
+doclet.Additional_Packages_Table_Summary={0} table, listing {1}, and {2}
 doclet.fields=fields
 doclet.Fields=Fields
 doclet.properties=properties
@@ -187,7 +195,7 @@
 doclet.subinterfaces=subinterfaces
 doclet.Modifier=Modifier
 doclet.Type=Type
-doclet.Implementation=Implementation:
+doclet.Implementation=Implementation(s):
 doclet.Types=Types
 doclet.Members=Members
 doclet.SearchTags=SearchTags
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js	Fri Dec 16 11:58:18 2016 -0800
@@ -91,7 +91,7 @@
     count = 0;
     for (var key in methods) {
         var row = document.getElementById(key);
-        if ((methods[key] &  type) != 0) {
+        if ((methods[key] &  type) !== 0) {
             row.style.display = '';
             row.className = (count++ % 2) ? rowColor : altColor;
         }
@@ -101,6 +101,21 @@
     updateTabs(type);
 }
 
+function showPkgs(type)
+{
+    count = 0;
+    for (var key in packages) {
+        var row = document.getElementById(key);
+        if ((packages[key] &  type) !== 0) {
+            row.style.display = '';
+            row.className = (count++ % 2) ? rowColor : altColor;
+        }
+        else
+            row.style.display = 'none';
+    }
+    updatePkgsTabs(type);
+}
+
 function updateTabs(type)
 {
     for (var value in tabs) {
@@ -122,3 +137,19 @@
     top.packageFrame.location = pFrame;
     top.classFrame.location = cFrame;
 }
+
+function updatePkgsTabs(type)
+{
+    for (var value in tabs) {
+        var sNode = document.getElementById(tabs[value][0]);
+        var spanNode = sNode.firstChild;
+        if (value == type) {
+            sNode.className = activeTableTab;
+            spanNode.innerHTML = tabs[value][1];
+        }
+        else {
+            sNode.className = tableTab;
+            spanNode.innerHTML = "<a href=\"javascript:showPkgs(" + value + ");\">" + tabs[value][1] + "</a>";
+        }
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Fri Dec 16 11:58:18 2016 -0800
@@ -472,7 +472,7 @@
     border: none;
     height:16px;
 }
-.memberSummary caption span.activeTableTab span {
+.memberSummary caption span.activeTableTab span, .packagesSummary caption span.activeTableTab span {
     white-space:nowrap;
     padding-top:5px;
     padding-left:12px;
@@ -483,7 +483,7 @@
     background-color:#F8981D;
     height:16px;
 }
-.memberSummary caption span.tableTab span {
+.memberSummary caption span.tableTab span, .packagesSummary caption span.tableTab span {
     white-space:nowrap;
     padding-top:5px;
     padding-left:12px;
@@ -494,7 +494,8 @@
     background-color:#4D7A97;
     height:16px;
 }
-.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
+.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab,
+.packagesSummary caption span.tableTab, .packagesSummary caption span.activeTableTab {
     padding-top:0px;
     padding-left:0px;
     padding-right:0px;
@@ -511,7 +512,7 @@
     float:left;
     background-color:#F8981D;
 }
-.memberSummary .activeTableTab .tabEnd {
+.memberSummary .activeTableTab .tabEnd, .packagesSummary .activeTableTab .tabEnd {
     display:none;
     width:5px;
     margin-right:3px;
@@ -519,7 +520,7 @@
     float:left;
     background-color:#F8981D;
 }
-.memberSummary .tableTab .tabEnd {
+.memberSummary .tableTab .tabEnd, .packagesSummary .tableTab .tabEnd {
     display:none;
     width:5px;
     margin-right:3px;
@@ -562,21 +563,28 @@
 .providesSummary th.colFirst, .providesSummary th.colLast, .providesSummary td.colFirst,
 .providesSummary td.colLast {
     white-space:normal;
-    width:50%;
     font-size:13px;
 }
 .overviewSummary td.colFirst, .overviewSummary th.colFirst,
 .requiresSummary td.colFirst, .requiresSummary th.colFirst,
 .packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,
 .usesSummary td.colFirst, .usesSummary th.colFirst,
-.useSummary td.colFirst, .useSummary th.colFirst,
+.providesSummary td.colFirst, .providesSummary th.colFirst,
 .memberSummary td.colFirst, .memberSummary th.colFirst,
 .memberSummary td.colSecond, .memberSummary th.colSecond,
 .typeSummary td.colFirst{
-    width:25%;
     vertical-align:top;
 }
-td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover, th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover, th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.colSecond a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
+.packagesSummary th.colLast, .packagesSummary td.colLast {
+    white-space:normal;
+}
+td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover,
+td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover,
+th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover,
+th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.colSecond a:hover,
+td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover,
+.constantValuesContainer td a:link, .constantValuesContainer td a:active,
+.constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
     font-weight:bold;
 }
 .tableSubHeadingColor {
@@ -776,4 +784,4 @@
 .searchTagHolderResult {
     font-style:italic;
     font-size:12px;
-}
\ No newline at end of file
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java	Fri Dec 16 11:58:18 2016 -0800
@@ -50,6 +50,7 @@
 import com.sun.source.doctree.LinkTree;
 import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.ParamTree;
+import com.sun.source.doctree.ProvidesTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.ReturnTree;
 import com.sun.source.doctree.SeeTree;
@@ -61,6 +62,7 @@
 import com.sun.source.doctree.TextTree;
 import com.sun.source.doctree.ThrowsTree;
 import com.sun.source.doctree.UnknownBlockTagTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.doctree.ValueTree;
 import com.sun.source.doctree.VersionTree;
 import com.sun.source.util.DocTreePath;
@@ -107,12 +109,14 @@
             case AUTHOR:
             case DEPRECATED:
             case PARAM:
+            case PROVIDES:
             case RETURN:
             case SEE:
             case SERIAL_DATA:
             case SERIAL_FIELD:
             case THROWS:
             case UNKNOWN_BLOCK_TAG:
+            case USES:
             case VERSION:
                 return ((BlockTagTree)dtree).getTagName();
             case UNKNOWN_INLINE_TAG:
@@ -441,6 +445,11 @@
             }
 
             @Override
+            public Element visitProvides(ProvidesTree node, Void p) {
+                return visit(node.getServiceType(), null);
+            }
+
+            @Override
             public Element visitValue(ValueTree node, Void p) {
                 return visit(node.getReference(), null);
             }
@@ -456,12 +465,25 @@
             }
 
             @Override
+            public Element visitUses(UsesTree node, Void p) {
+                return visit(node.getServiceType(), null);
+            }
+
+            @Override
             protected Element defaultAction(DocTree node, Void p) {
                return null;
             }
         }.visit(dtree, null);
     }
 
+    public TypeElement getServiceType(Configuration c, DocTree dtree) {
+        Element e = getReferencedElement(c, dtree);
+        if (e != null) {
+            return c.utils.isTypeElement(e) ? (TypeElement) e : null;
+        }
+        return null;
+    }
+
     public  String getReferencedSignature(DocTree dtree) {
         return new SimpleDocTreeVisitor<String, Void>() {
             @Override
@@ -554,6 +576,11 @@
             }
 
             @Override
+            public List<? extends DocTree> visitProvides(ProvidesTree node, Void p) {
+                 return node.getDescription();
+            }
+
+            @Override
             public List<? extends DocTree> visitSince(SinceTree node, Void p) {
                 return node.getBody();
             }
@@ -609,6 +636,11 @@
             }
 
             @Override
+            public List<? extends DocTree> visitUses(UsesTree node, Void p) {
+                 return node.getDescription();
+            }
+
+            @Override
             protected List<? extends DocTree> defaultAction(DocTree node, Void p) {
                return Collections.emptyList();
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -52,6 +52,7 @@
     private final Configuration configuration;
     private final Utils utils;
     public static enum DeprElementKind {
+        REMOVAL,
         MODULE,
         PACKAGE,
         INTERFACE,
@@ -90,9 +91,13 @@
      * @param configuration the current configuration of the doclet.
      */
     private void buildDeprecatedAPIInfo() {
+        SortedSet<Element> rset = deprecatedMap.get(DeprElementKind.REMOVAL);
         SortedSet<ModuleElement> modules = configuration.modules;
         SortedSet<Element> mset = deprecatedMap.get(DeprElementKind.MODULE);
         for (Element me : modules) {
+            if (utils.isDeprecatedForRemoval(me)) {
+                rset.add(me);
+            }
             if (utils.isDeprecated(me)) {
                 mset.add(me);
             }
@@ -100,6 +105,9 @@
         SortedSet<PackageElement> packages = configuration.packages;
         SortedSet<Element> pset = deprecatedMap.get(DeprElementKind.PACKAGE);
         for (Element pe : packages) {
+            if (utils.isDeprecatedForRemoval(pe)) {
+                rset.add(pe);
+            }
             if (utils.isDeprecated(pe)) {
                 pset.add(pe);
             }
@@ -107,6 +115,9 @@
         for (Element e : configuration.getIncludedTypeElements()) {
             TypeElement te = (TypeElement)e;
             SortedSet<Element> eset;
+            if (utils.isDeprecatedForRemoval(e)) {
+                rset.add(e);
+            }
             if (utils.isDeprecated(e)) {
                 switch (e.getKind()) {
                     case ANNOTATION_TYPE:
@@ -133,18 +144,18 @@
                         break;
                 }
             }
-            composeDeprecatedList(deprecatedMap.get(DeprElementKind.FIELD),
+            composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.FIELD),
                     utils.getFields(te));
-            composeDeprecatedList(deprecatedMap.get(DeprElementKind.METHOD),
+            composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.METHOD),
                     utils.getMethods(te));
-            composeDeprecatedList(deprecatedMap.get(DeprElementKind.CONSTRUCTOR),
+            composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.CONSTRUCTOR),
                     utils.getConstructors(te));
             if (utils.isEnum(e)) {
-                composeDeprecatedList(deprecatedMap.get(DeprElementKind.ENUM_CONSTANT),
+                composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ENUM_CONSTANT),
                         utils.getEnumConstants(te));
             }
             if (utils.isAnnotationType(e)) {
-                composeDeprecatedList(deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE_MEMBER),
+                composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE_MEMBER),
                         utils.getAnnotationMembers(te));
 
             }
@@ -154,11 +165,16 @@
     /**
      * Add the members into a single list of deprecated members.
      *
+     * @param rset set of elements deprecated for removal.
+     * @param sset set of deprecated elements.
      * @param list List of all the particular deprecated members, e.g. methods.
      * @param members members to be added in the list.
      */
-    private void composeDeprecatedList(SortedSet<Element> sset, List<? extends Element> members) {
+    private void composeDeprecatedList(SortedSet<Element> rset, SortedSet<Element> sset, List<? extends Element> members) {
         for (Element member : members) {
+            if (utils.isDeprecatedForRemoval(member)) {
+                rset.add(member);
+            }
             if (utils.isDeprecated(member)) {
                 sset.add(member);
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MethodTypes.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MethodTypes.java	Fri Dec 16 11:58:18 2016 -0800
@@ -30,40 +30,23 @@
  *
  * @author Bhavesh Patel
  */
-public enum MethodTypes {
-    ALL(0xffff, "doclet.All_Methods", "t0", true),
-    STATIC(0x1, "doclet.Static_Methods", "t1", false),
-    INSTANCE(0x2, "doclet.Instance_Methods", "t2", false),
-    ABSTRACT(0x4, "doclet.Abstract_Methods", "t3", false),
-    CONCRETE(0x8, "doclet.Concrete_Methods", "t4", false),
-    DEFAULT(0x10, "doclet.Default_Methods", "t5", false),
-    DEPRECATED(0x20, "doclet.Deprecated_Methods", "t6", false);
+public enum MethodTypes implements TableTabTypes {
 
-    private final int value;
-    private final String resourceKey;
-    private final String tabId;
-    private final boolean isDefaultTab;
+    ALL(TableTabs.tab(0xffff, "doclet.All_Methods", "t0", true)),
+    STATIC(TableTabs.tab(0x1, "doclet.Static_Methods", "t1", false)),
+    INSTANCE(TableTabs.tab(0x2, "doclet.Instance_Methods", "t2", false)),
+    ABSTRACT(TableTabs.tab(0x4, "doclet.Abstract_Methods", "t3", false)),
+    CONCRETE(TableTabs.tab(0x8, "doclet.Concrete_Methods", "t4", false)),
+    DEFAULT(TableTabs.tab(0x10, "doclet.Default_Methods", "t5", false)),
+    DEPRECATED(TableTabs.tab(0x20, "doclet.Deprecated_Methods", "t6", false));
 
-    MethodTypes(int v, String k, String id, boolean dt) {
-        this.value = v;
-        this.resourceKey = k;
-        this.tabId = id;
-        this.isDefaultTab = dt;
+    private final TableTabs tabs;
+
+    private MethodTypes(TableTabs t) {
+        this.tabs = t;
     }
 
-    public int value() {
-        return value;
-    }
-
-    public String resourceKey() {
-        return resourceKey;
+    public TableTabs tableTabs() {
+        return this.tabs;
     }
-
-    public String tabId() {
-        return tabId;
     }
-
-    public boolean isDefaultTab() {
-        return isDefaultTab;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ModulePackageTypes.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,55 @@
+/*
+ * 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.javadoc.internal.doclets.toolkit.util;
+
+import jdk.javadoc.internal.doclets.toolkit.util.TableTabTypes.TableTabs;
+
+/**
+ * Enum representing module package types.
+ *
+ *  <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.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public enum ModulePackageTypes implements TableTabTypes {
+    ALL(TableTabs.tab(0xffff, "doclet.All_Packages", "t0", true)),
+    EXPORTED(TableTabs.tab(0x1, "doclet.Exported_Packages_Summary", "t1", false)),
+    OPENED(TableTabs.tab(0x2, "doclet.Opened_Packages_Summary", "t2", false)),
+    CONCEALED(TableTabs.tab(0x4, "doclet.Concealed_Packages_Summary", "t3", false));
+
+    private final TableTabs tabs;
+
+    private ModulePackageTypes(TableTabs t) {
+        this.tabs = t;
+    }
+
+    public TableTabs tableTabs() {
+        return this.tabs;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/TableTabTypes.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,76 @@
+/*
+ * 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.javadoc.internal.doclets.toolkit.util;
+
+/**
+ * Interface representing table tab types.
+ *
+ *  <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.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public interface TableTabTypes {
+
+    TableTabs tableTabs();
+
+    public static final class TableTabs {
+
+        private final int value;
+        private final String resourceKey;
+        private final String tabId;
+        private final boolean isDefaultTab;
+
+        private TableTabs(int v, String k, String id, boolean dt) {
+            this.value = v;
+            this.resourceKey = k;
+            this.tabId = id;
+            this.isDefaultTab = dt;
+        }
+
+        public static TableTabs tab(int value, String resourceKey, String tabId, boolean isDefaultTab) {
+            return new TableTabs(value, resourceKey, tabId, isDefaultTab);
+        }
+
+        public int value() {
+            return this.value;
+        }
+
+        public String resourceKey() {
+            return this.resourceKey;
+        }
+
+        public String tabId() {
+            return this.tabId;
+        }
+
+        public boolean isDefaultTab() {
+            return this.isDefaultTab;
+        }
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Fri Dec 16 11:58:18 2016 -0800
@@ -36,11 +36,13 @@
 
 import javax.lang.model.SourceVersion;
 import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.ModuleElement.RequiresDirective;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.TypeParameterElement;
@@ -74,10 +76,12 @@
 import com.sun.source.util.DocSourcePositions;
 import com.sun.source.util.DocTrees;
 import com.sun.source.util.TreePath;
+import com.sun.tools.javac.model.JavacTypes;
 import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.WorkArounds;
+import jdk.javadoc.internal.tool.DocEnvImpl;
 
 import static javax.lang.model.element.ElementKind.*;
 import static javax.lang.model.element.Modifier.*;
@@ -346,7 +350,12 @@
     }
 
     protected Location getLocationForPackage(PackageElement pd) {
-        return getLocationForModule(configuration.docEnv.getElementUtils().getModuleOf(pd));
+        ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(pd);
+
+        if (mdle == null)
+            return defaultLocation();
+
+        return getLocationForModule(mdle);
     }
 
     protected Location getLocationForModule(ModuleElement mdle) {
@@ -354,6 +363,10 @@
         if (loc != null)
             return loc;
 
+        return defaultLocation();
+    }
+
+    private Location defaultLocation() {
         JavaFileManager fm = configuration.docEnv.getJavaFileManager();
         return fm.hasLocation(StandardLocation.SOURCE_PATH)
                 ? StandardLocation.SOURCE_PATH
@@ -521,7 +534,7 @@
             }
 
             void addModifers(Set<Modifier> modifiers) {
-                String s = set.stream().map(m -> m.toString()).collect(Collectors.joining(" "));
+                String s = set.stream().map(Modifier::toString).collect(Collectors.joining(" "));
                 sb.append(s);
                 if (!s.isEmpty())
                     sb.append(" ");
@@ -1477,6 +1490,30 @@
     }
 
     /**
+     * Return true if the given Element is deprecated for removal.
+     *
+     * @param e the Element to check.
+     * @return true if the given Element is deprecated for removal.
+     */
+    public boolean isDeprecatedForRemoval(Element e) {
+        List<? extends AnnotationMirror> annotationList = e.getAnnotationMirrors();
+        JavacTypes jctypes = ((DocEnvImpl) configuration.docEnv).toolEnv.typeutils;
+        for (AnnotationMirror anno : annotationList) {
+            if (jctypes.isSameType(anno.getAnnotationType().asElement().asType(), getDeprecatedType())) {
+                Map<? extends ExecutableElement, ? extends AnnotationValue> pairs = anno.getElementValues();
+                if (!pairs.isEmpty()) {
+                    for (ExecutableElement element : pairs.keySet()) {
+                        if (element.getSimpleName().contentEquals("forRemoval")) {
+                            return Boolean.parseBoolean((pairs.get(element)).toString());
+                        }
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
      * A convenience method to get property name from the name of the
      * getter or setter method.
      * @param e the input method.
@@ -1642,7 +1679,7 @@
         return new Utils.ElementComparator<Element>() {
             @Override
             public int compare(Element mod1, Element mod2) {
-                return compareFullyQualifiedNames(mod1, mod2);
+                return compareNames(mod1, mod2);
             }
         };
     }
@@ -2157,6 +2194,64 @@
         return member.getEnclosingElement().getEnclosedElements().indexOf(member);
     }
 
+    private Map<ModuleElement, Set<PackageElement>> modulePackageMap = null;
+    public Map<ModuleElement, Set<PackageElement>> getModulePackageMap() {
+        if (modulePackageMap == null) {
+            modulePackageMap = new HashMap<>();
+            Set<PackageElement> pkgs = configuration.getIncludedPackageElements();
+            pkgs.forEach((pkg) -> {
+                ModuleElement mod = elementUtils.getModuleOf(pkg);
+                modulePackageMap.computeIfAbsent(mod, m -> new HashSet<>()).add(pkg);
+            });
+        }
+        return modulePackageMap;
+    }
+
+    public Map<ModuleElement, String> getDependentModules(ModuleElement mdle) {
+        Map<ModuleElement, String> result = new TreeMap<>(makeModuleComparator());
+        Deque<ModuleElement> queue = new ArrayDeque<>();
+        // get all the requires for the element in question
+        for (RequiresDirective rd : ElementFilter.requiresIn(mdle.getDirectives())) {
+            ModuleElement dep = rd.getDependency();
+            // add the dependency to work queue
+            if (!result.containsKey(dep)) {
+                if (rd.isTransitive()) {
+                    queue.addLast(dep);
+                }
+            }
+            // add all exports for the primary module
+            result.put(rd.getDependency(), getModifiers(rd));
+        }
+
+        // add only requires public for subsequent module dependencies
+        for (ModuleElement m = queue.poll(); m != null; m = queue.poll()) {
+            for (RequiresDirective rd : ElementFilter.requiresIn(m.getDirectives())) {
+                ModuleElement dep = rd.getDependency();
+                if (!result.containsKey(dep)) {
+                    if (rd.isTransitive()) {
+                        result.put(dep, getModifiers(rd));
+                        queue.addLast(dep);
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    public String getModifiers(RequiresDirective rd) {
+        StringBuilder modifiers = new StringBuilder();
+        String sep="";
+        if (rd.isTransitive()) {
+            modifiers.append("transitive");
+            sep = " ";
+        }
+        if (rd.isStatic()) {
+            modifiers.append(sep);
+            modifiers.append("static");
+        }
+        return (modifiers.length() == 0) ? " " : modifiers.toString();
+    }
+
     public long getLineNumber(Element e) {
         TreePath path = getTreePath(e);
         if (path == null) { // maybe null if synthesized
@@ -2983,6 +3078,10 @@
         return getBlockTags(element, DEPRECATED);
     }
 
+    public List<? extends DocTree> getProvidesTrees(Element element) {
+        return getBlockTags(element, PROVIDES);
+    }
+
     public List<? extends DocTree> getSeeTrees(Element element) {
         return getBlockTags(element, SEE);
     }
@@ -3026,6 +3125,10 @@
         return out;
     }
 
+    public List<? extends DocTree> getUsesTrees(Element element) {
+        return getBlockTags(element, USES);
+    }
+
     public List<? extends DocTree> getFirstSentenceTrees(Element element) {
         DocCommentTree dcTree = getDocCommentTree(element);
         if (dcTree == null) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java	Fri Dec 16 11:58:18 2016 -0800
@@ -255,13 +255,9 @@
                 vars.add(t.asType());
             });
         } else if (linkInfo.type != null && utils.isDeclaredType(linkInfo.type)) {
-            ((DeclaredType)linkInfo.type).getTypeArguments().stream().forEach((t) -> {
-                vars.add(t);
-            });
+            ((DeclaredType)linkInfo.type).getTypeArguments().stream().forEach(vars::add);
         } else if (ctype != null && utils.isDeclaredType(ctype)) {
-            ((DeclaredType)ctype).getTypeArguments().stream().forEach((t) -> {
-                vars.add(t);
-            });
+            ((DeclaredType)ctype).getTypeArguments().stream().forEach(vars::add);
         } else if (linkInfo.typeElement != null) {
             linkInfo.typeElement.getTypeParameters().stream().forEach((t) -> {
                 vars.add(t.asType());
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Fri Dec 16 11:58:18 2016 -0800
@@ -373,7 +373,7 @@
         // scan for modules with qualified subpackages
         ((List<String>)opts.computeIfAbsent(ToolOption.SUBPACKAGES, v -> Collections.EMPTY_LIST))
             .stream()
-            .map((packageName) -> new ModulePackage(packageName))
+            .map(ModulePackage::new)
             .forEachOrdered((mpkg) -> {
                 subPackages.add(mpkg);
                 if (mpkg.hasModule()) {
@@ -420,7 +420,7 @@
      */
     ElementsTable packages(Collection<String> packageNames) {
         packageNames.stream()
-            .map((packageName) -> new ModulePackage(packageName))
+            .map(ModulePackage::new)
             .forEachOrdered((mpkg) -> cmdLinePackages.add(mpkg));
         return this;
     }
@@ -443,7 +443,7 @@
     private void computeSubpackages() throws ToolException {
         ((List<String>) opts.computeIfAbsent(ToolOption.EXCLUDE, v -> Collections.EMPTY_LIST))
                 .stream()
-                .map((packageName) -> new ModulePackage(packageName))
+                .map(ModulePackage::new)
                 .forEachOrdered((mpkg) -> excludePackages.add(mpkg));
 
         excludePackages.forEach((p) -> {
@@ -620,7 +620,8 @@
         // add all specified packages
         specifiedPackageElements.forEach(pkg -> {
             ModuleElement mdle = toolEnv.elements.getModuleOf(pkg);
-            imodules.add(mdle);
+            if (mdle != null)
+                imodules.add(mdle);
             ipackages.add(pkg);
         });
 
@@ -633,7 +634,7 @@
         // add all types and its nested types
         specifiedTypeElements.forEach((klass) -> {
             ModuleElement mdle = toolEnv.elements.getModuleOf(klass);
-            if (!mdle.isUnnamed())
+            if (mdle != null && !mdle.isUnnamed())
                 imodules.add(mdle);
             PackageElement pkg = toolEnv.elements.getPackageOf(klass);
             ipackages.add(pkg);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocClassFinder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocClassFinder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -33,6 +33,7 @@
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.code.ClassFinder;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
 
 /** Javadoc uses an extended class finder that records package.html entries
  *
@@ -53,11 +54,7 @@
     }
 
     public static void preRegister(Context context) {
-        context.put(classFinderKey, new Context.Factory<ClassFinder>() {
-            public ClassFinder make(Context c) {
-                return new JavadocClassFinder(c);
-            }
-        });
+        context.put(classFinderKey, (Factory<ClassFinder>)JavadocClassFinder::new);
     }
 
     private ToolEnvironment toolEnv;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocEnter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocEnter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -57,11 +57,7 @@
     }
 
     public static void preRegister(Context context) {
-        context.put(enterKey, new Context.Factory<Enter>() {
-               public Enter make(Context c) {
-                   return new JavadocEnter(c);
-               }
-        });
+        context.put(enterKey, (Context.Factory<Enter>)JavadocEnter::new);
     }
 
     protected JavadocEnter(Context context) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocMemberEnter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocMemberEnter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -56,11 +56,7 @@
     }
 
     public static void preRegister(Context context) {
-        context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
-               public MemberEnter make(Context c) {
-                   return new JavadocMemberEnter(c);
-               }
-        });
+        context.put(memberEnterKey, (Context.Factory<MemberEnter>)JavadocMemberEnter::new);
     }
 
     final ToolEnvironment toolEnv;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTodo.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTodo.java	Fri Dec 16 11:58:18 2016 -0800
@@ -27,6 +27,7 @@
 
 import com.sun.tools.javac.comp.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.Context.Factory;
 
 /**
  *  Javadoc's own todo queue doesn't queue its inputs, as javadoc
@@ -41,11 +42,7 @@
  */
 public class JavadocTodo extends Todo {
     public static void preRegister(Context context) {
-        context.put(todoKey, new Context.Factory<Todo>() {
-               public Todo make(Context c) {
-                   return new JavadocTodo(c);
-               }
-        });
+        context.put(todoKey, (Factory<Todo>)JavadocTodo::new);
     }
 
     protected JavadocTodo(Context context) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java	Fri Dec 16 11:58:18 2016 -0800
@@ -33,6 +33,7 @@
 import javax.lang.model.element.Element;
 import javax.tools.Diagnostic.Kind;
 
+import com.sun.tools.javac.util.Context.Factory;
 import jdk.javadoc.doclet.Reporter;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.util.DocSourcePositions;
@@ -73,20 +74,12 @@
 
     public static void preRegister(Context context,
                                    final String programName) {
-        context.put(logKey, new Context.Factory<Log>() {
-            public Log make(Context c) {
-                return new Messager(c, programName);
-            }
-        });
+        context.put(logKey, (Factory<Log>)c -> new Messager(c, programName));
     }
 
     public static void preRegister(Context context, final String programName,
             final PrintWriter outWriter, final PrintWriter errWriter) {
-        context.put(logKey, new Context.Factory<Log>() {
-            public Log make(Context c) {
-                return new Messager(c, programName, outWriter, errWriter);
-            }
-        });
+        context.put(logKey, (Factory<Log>)c -> new Messager(c, programName, outWriter, errWriter));
     }
 
     @Override
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Fri Dec 16 11:58:18 2016 -0800
@@ -211,7 +211,7 @@
         Stream.of(ToolOption.values())
                     .filter(opt -> opt.kind == kind)
                     .sorted(comp)
-                    .forEach(opt -> showToolOption(opt));
+                    .forEach(this::showToolOption);
     }
 
     void showToolOption(ToolOption option) {
@@ -241,7 +241,7 @@
         doclet.getSupportedOptions().stream()
                 .filter(opt -> opt.getKind() == kind)
                 .sorted(comp)
-                .forEach(opt -> showDocletOption(opt));
+                .forEach(this::showDocletOption);
     }
 
     void showDocletOption(Doclet.Option option) {
@@ -338,7 +338,7 @@
                     nargv);
             return (rc == 0) ? OK : ERROR;
         }
-        return begin(Arrays.asList(argv), Collections.<JavaFileObject> emptySet());
+        return begin(Arrays.asList(argv), Collections.emptySet());
     }
 
     // Called by 199 API.
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java	Fri Dec 16 11:58:18 2016 -0800
@@ -56,8 +56,8 @@
     public static final String ModuleHashes             = "ModuleHashes";
     public static final String ModuleMainClass          = "ModuleMainClass";
     public static final String ModulePackages           = "ModulePackages";
+    public static final String ModuleResolution         = "ModuleResolution";
     public static final String ModuleTarget             = "ModuleTarget";
-    public static final String ModuleVersion            = "ModuleVersion";
     public static final String RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
     public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
     public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
@@ -128,8 +128,8 @@
             standardAttributes.put(ModuleHashes,      ModuleHashes_attribute.class);
             standardAttributes.put(ModuleMainClass,   ModuleMainClass_attribute.class);
             standardAttributes.put(ModulePackages,    ModulePackages_attribute.class);
+            standardAttributes.put(ModuleResolution,  ModuleResolution_attribute.class);
             standardAttributes.put(ModuleTarget,      ModuleTarget_attribute.class);
-            standardAttributes.put(ModuleVersion,     ModuleVersion_attribute.class);
             standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
             standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
             standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
@@ -191,8 +191,8 @@
         R visitModuleHashes(ModuleHashes_attribute attr, P p);
         R visitModuleMainClass(ModuleMainClass_attribute attr, P p);
         R visitModulePackages(ModulePackages_attribute attr, P p);
+        R visitModuleResolution(ModuleResolution_attribute attr, P p);
         R visitModuleTarget(ModuleTarget_attribute attr, P p);
-        R visitModuleVersion(ModuleVersion_attribute attr, P p);
         R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p);
         R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
         R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassTranslator.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassTranslator.java	Fri Dec 16 11:58:18 2016 -0800
@@ -38,7 +38,9 @@
 import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodHandle_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodType_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Module_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_NameAndType_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Package_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
 import com.sun.tools.classfile.ConstantPool.CPInfo;
@@ -242,6 +244,7 @@
         return true;
     }
 
+    @Override
     public CPInfo visitClass(CONSTANT_Class_info info, Map<Object, Object> translations) {
         CONSTANT_Class_info info2 = (CONSTANT_Class_info) translations.get(info);
         if (info2 == null) {
@@ -255,6 +258,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitDouble(CONSTANT_Double_info info, Map<Object, Object> translations) {
         CONSTANT_Double_info info2 = (CONSTANT_Double_info) translations.get(info);
         if (info2 == null) {
@@ -264,6 +268,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitFieldref(CONSTANT_Fieldref_info info, Map<Object, Object> translations) {
         CONSTANT_Fieldref_info info2 = (CONSTANT_Fieldref_info) translations.get(info);
         if (info2 == null) {
@@ -277,6 +282,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitFloat(CONSTANT_Float_info info, Map<Object, Object> translations) {
         CONSTANT_Float_info info2 = (CONSTANT_Float_info) translations.get(info);
         if (info2 == null) {
@@ -286,6 +292,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitInteger(CONSTANT_Integer_info info, Map<Object, Object> translations) {
         CONSTANT_Integer_info info2 = (CONSTANT_Integer_info) translations.get(info);
         if (info2 == null) {
@@ -295,6 +302,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Map<Object, Object> translations) {
         CONSTANT_InterfaceMethodref_info info2 = (CONSTANT_InterfaceMethodref_info) translations.get(info);
         if (info2 == null) {
@@ -308,6 +316,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) {
         CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info);
         if (info2 == null) {
@@ -322,6 +331,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) {
         CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info);
         if (info2 == null) {
@@ -331,19 +341,7 @@
         return info;
     }
 
-    public CPInfo visitNameAndType(CONSTANT_NameAndType_info info, Map<Object, Object> translations) {
-        CONSTANT_NameAndType_info info2 = (CONSTANT_NameAndType_info) translations.get(info);
-        if (info2 == null) {
-            ConstantPool cp2 = translate(info.cp, translations);
-            if (cp2 == info.cp)
-                info2 = info;
-            else
-                info2 = new CONSTANT_NameAndType_info(cp2, info.name_index, info.type_index);
-            translations.put(info, info2);
-        }
-        return info;
-    }
-
+    @Override
     public CPInfo visitMethodref(CONSTANT_Methodref_info info, Map<Object, Object> translations) {
         CONSTANT_Methodref_info info2 = (CONSTANT_Methodref_info) translations.get(info);
         if (info2 == null) {
@@ -357,6 +355,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitMethodHandle(CONSTANT_MethodHandle_info info, Map<Object, Object> translations) {
         CONSTANT_MethodHandle_info info2 = (CONSTANT_MethodHandle_info) translations.get(info);
         if (info2 == null) {
@@ -371,6 +370,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitMethodType(CONSTANT_MethodType_info info, Map<Object, Object> translations) {
         CONSTANT_MethodType_info info2 = (CONSTANT_MethodType_info) translations.get(info);
         if (info2 == null) {
@@ -385,6 +385,49 @@
         return info;
     }
 
+    @Override
+    public CPInfo visitModule(CONSTANT_Module_info info, Map<Object, Object> translations) {
+        CONSTANT_Module_info info2 = (CONSTANT_Module_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp)
+                info2 = info;
+            else
+                info2 = new CONSTANT_Module_info(cp2, info.name_index);
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
+    @Override
+    public CPInfo visitNameAndType(CONSTANT_NameAndType_info info, Map<Object, Object> translations) {
+        CONSTANT_NameAndType_info info2 = (CONSTANT_NameAndType_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp)
+                info2 = info;
+            else
+                info2 = new CONSTANT_NameAndType_info(cp2, info.name_index, info.type_index);
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
+    @Override
+    public CPInfo visitPackage(CONSTANT_Package_info info, Map<Object, Object> translations) {
+        CONSTANT_Package_info info2 = (CONSTANT_Package_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp)
+                info2 = info;
+            else
+                info2 = new CONSTANT_Package_info(cp2, info.name_index);
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
+    @Override
     public CPInfo visitString(CONSTANT_String_info info, Map<Object, Object> translations) {
         CONSTANT_String_info info2 = (CONSTANT_String_info) translations.get(info);
         if (info2 == null) {
@@ -398,6 +441,7 @@
         return info;
     }
 
+    @Override
     public CPInfo visitUtf8(CONSTANT_Utf8_info info, Map<Object, Object> translations) {
         CONSTANT_Utf8_info info2 = (CONSTANT_Utf8_info) translations.get(info);
         if (info2 == null) {
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -290,13 +290,6 @@
         }
 
         @Override
-        public Integer visitNameAndType(CONSTANT_NameAndType_info info, ClassOutputStream out) {
-            out.writeShort(info.name_index);
-            out.writeShort(info.type_index);
-            return 1;
-        }
-
-        @Override
         public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, ClassOutputStream out) {
             out.writeByte(info.reference_kind.tag);
             out.writeShort(info.reference_index);
@@ -315,6 +308,25 @@
         }
 
         @Override
+        public Integer visitModule(CONSTANT_Module_info info, ClassOutputStream out) {
+            out.writeShort(info.name_index);
+            return 1;
+        }
+
+        @Override
+        public Integer visitNameAndType(CONSTANT_NameAndType_info info, ClassOutputStream out) {
+            out.writeShort(info.name_index);
+            out.writeShort(info.type_index);
+            return 1;
+        }
+
+        @Override
+        public Integer visitPackage(CONSTANT_Package_info info, ClassOutputStream out) {
+            out.writeShort(info.name_index);
+            return 1;
+        }
+
+        @Override
         public Integer visitString(CONSTANT_String_info info, ClassOutputStream out) {
             out.writeShort(info.string_index);
             return 1;
@@ -425,14 +437,6 @@
         }
 
         @Override
-        public Void visitModulePackages(ModulePackages_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.packages_count);
-            for (int i: attr.packages_index)
-                out.writeShort(i);
-            return null;
-        }
-
-        @Override
         public Void visitConstantValue(ConstantValue_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.constantvalue_index);
             return null;
@@ -466,20 +470,6 @@
             return null;
         }
 
-        @Override
-        public Void visitModuleHashes(ModuleHashes_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.algorithm_index);
-            out.writeShort(attr.hashes_table.length);
-            for (ModuleHashes_attribute.Entry e: attr.hashes_table) {
-                out.writeShort(e.module_name_index);
-                out.writeShort(e.hash.length);
-                for (byte b: e.hash) {
-                    out.writeByte(b);
-                }
-            }
-            return null;
-        }
-
         protected void writeInnerClassesInfo(InnerClasses_attribute.Info info, ClassOutputStream out) {
             out.writeShort(info.inner_class_info_index);
             out.writeShort(info.outer_class_info_index);
@@ -543,20 +533,16 @@
         }
 
         @Override
-        public Void visitModuleMainClass(ModuleMainClass_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.main_class_index);
-            return null;
-        }
-
-        @Override
         public Void visitModule(Module_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.module_name);
             out.writeShort(attr.module_flags);
+            out.writeShort(attr.module_version_index);
 
             out.writeShort(attr.requires.length);
             for (Module_attribute.RequiresEntry e: attr.requires) {
                 out.writeShort(e.requires_index);
                 out.writeShort(e.requires_flags);
+                out.writeShort(e.requires_version_index);
             }
 
             out.writeShort(attr.exports.length);
@@ -595,8 +581,44 @@
         }
 
         @Override
-        public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) {
-            annotationWriter.write(attr.annotations, out);
+        public Void visitModuleHashes(ModuleHashes_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.algorithm_index);
+            out.writeShort(attr.hashes_table.length);
+            for (ModuleHashes_attribute.Entry e: attr.hashes_table) {
+                out.writeShort(e.module_name_index);
+                out.writeShort(e.hash.length);
+                for (byte b: e.hash) {
+                    out.writeByte(b);
+                }
+            }
+            return null;
+        }
+
+        @Override
+        public Void visitModuleMainClass(ModuleMainClass_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.main_class_index);
+            return null;
+        }
+
+        @Override
+        public Void visitModulePackages(ModulePackages_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.packages_count);
+            for (int i: attr.packages_index)
+                out.writeShort(i);
+            return null;
+        }
+
+        @Override
+        public Void visitModuleResolution(ModuleResolution_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.resolution_flags);
+            return null;
+        }
+
+        @Override
+        public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.os_name_index);
+            out.writeShort(attr.os_arch_index);
+            out.writeShort(attr.os_version_index);
             return null;
         }
 
@@ -607,13 +629,21 @@
         }
 
         @Override
-        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
+        public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
+            out.writeByte(attr.parameter_annotations.length);
+            for (Annotation[] annos: attr.parameter_annotations)
+                annotationWriter.write(annos, out);
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
             annotationWriter.write(attr.annotations, out);
             return null;
         }
 
         @Override
-        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
+        public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) {
             annotationWriter.write(attr.annotations, out);
             return null;
         }
@@ -627,10 +657,8 @@
         }
 
         @Override
-        public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
-            out.writeByte(attr.parameter_annotations.length);
-            for (Annotation[] annos: attr.parameter_annotations)
-                annotationWriter.write(annos, out);
+        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
+            annotationWriter.write(attr.annotations, out);
             return null;
         }
 
@@ -685,24 +713,10 @@
             return null;
         }
 
-        @Override
-        public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.os_name_index);
-            out.writeShort(attr.os_arch_index);
-            out.writeShort(attr.os_version_index);
-            return null;
-        }
-
         protected void writeAccessFlags(AccessFlags flags, ClassOutputStream p) {
             sharedOut.writeShort(flags.flags);
         }
 
-        @Override
-        public Void visitModuleVersion(ModuleVersion_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.version_index);
-            return null;
-        }
-
         protected StackMapTableWriter stackMapWriter;
     }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Code_attribute.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Code_attribute.java	Fri Dec 16 11:58:18 2016 -0800
@@ -103,34 +103,29 @@
     }
 
     public Iterable<Instruction> getInstructions() {
-        return new Iterable<Instruction>() {
-            public Iterator<Instruction> iterator() {
-                return new Iterator<Instruction>() {
+        return () -> new Iterator<Instruction>() {
 
-                    public boolean hasNext() {
-                        return (next != null);
-                    }
+            public boolean hasNext() {
+                return (next != null);
+            }
 
-                    public Instruction next() {
-                        if (next == null)
-                            throw new NoSuchElementException();
+            public Instruction next() {
+                if (next == null)
+                    throw new NoSuchElementException();
 
-                        current = next;
-                        pc += current.length();
-                        next = (pc < code.length ? new Instruction(code, pc) : null);
-                        return current;
-                    }
+                current = next;
+                pc += current.length();
+                next = (pc < code.length ? new Instruction(code, pc) : null);
+                return current;
+            }
 
-                    public void remove() {
-                        throw new UnsupportedOperationException("Not supported.");
-                    }
+            public void remove() {
+                throw new UnsupportedOperationException("Not supported.");
+            }
 
-                    Instruction current = null;
-                    int pc = 0;
-                    Instruction next = new Instruction(code, pc);
-
-                };
-            }
+            Instruction current = null;
+            int pc = 0;
+            Instruction next = new Instruction(code, pc);
 
         };
     }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java	Fri Dec 16 11:58:18 2016 -0800
@@ -117,6 +117,8 @@
     public static final int CONSTANT_MethodHandle = 15;
     public static final int CONSTANT_MethodType = 16;
     public static final int CONSTANT_InvokeDynamic = 18;
+    public static final int CONSTANT_Module = 19;
+    public static final int CONSTANT_Package = 20;
 
     public static enum RefKind {
         REF_getField(1),
@@ -213,10 +215,18 @@
                 pool[i] = new CONSTANT_Methodref_info(this, cr);
                 break;
 
+            case CONSTANT_Module:
+                pool[i] = new CONSTANT_Module_info(this, cr);
+                break;
+
             case CONSTANT_NameAndType:
                 pool[i] = new CONSTANT_NameAndType_info(this, cr);
                 break;
 
+            case CONSTANT_Package:
+                pool[i] = new CONSTANT_Package_info(this, cr);
+                break;
+
             case CONSTANT_String:
                 pool[i] = new CONSTANT_String_info(this, cr);
                 break;
@@ -276,10 +286,18 @@
         return ((CONSTANT_Class_info) get(index, CONSTANT_Class));
     }
 
+    public CONSTANT_Module_info getModuleInfo(int index) throws InvalidIndex, UnexpectedEntry {
+        return ((CONSTANT_Module_info) get(index, CONSTANT_Module));
+    }
+
     public CONSTANT_NameAndType_info getNameAndTypeInfo(int index) throws InvalidIndex, UnexpectedEntry {
         return ((CONSTANT_NameAndType_info) get(index, CONSTANT_NameAndType));
     }
 
+    public CONSTANT_Package_info getPackageInfo(int index) throws InvalidIndex, UnexpectedEntry {
+        return ((CONSTANT_Package_info) get(index, CONSTANT_Package));
+    }
+
     public String getUTF8Value(int index) throws InvalidIndex, UnexpectedEntry {
         return getUTF8Info(index).value;
     }
@@ -295,36 +313,32 @@
     }
 
     public Iterable<CPInfo> entries() {
-        return new Iterable<CPInfo>() {
-            public Iterator<CPInfo> iterator() {
-                return new Iterator<CPInfo>() {
+        return () -> new Iterator<CPInfo>() {
 
-                    public boolean hasNext() {
-                        return next < pool.length;
-                    }
+            public boolean hasNext() {
+                return next < pool.length;
+            }
 
-                    public CPInfo next() {
-                        current = pool[next];
-                        switch (current.getTag()) {
-                            case CONSTANT_Double:
-                            case CONSTANT_Long:
-                                next += 2;
-                                break;
-                            default:
-                                next += 1;
-                        }
-                        return current;
-                    }
+            public CPInfo next() {
+                current = pool[next];
+                switch (current.getTag()) {
+                    case CONSTANT_Double:
+                    case CONSTANT_Long:
+                        next += 2;
+                        break;
+                    default:
+                        next += 1;
+                }
+                return current;
+            }
 
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
 
-                    private CPInfo current;
-                    private int next = 1;
+            private CPInfo current;
+            private int next = 1;
 
-                };
-            }
         };
     }
 
@@ -339,10 +353,12 @@
         R visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, P p);
         R visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, P p);
         R visitLong(CONSTANT_Long_info info, P p);
-        R visitNameAndType(CONSTANT_NameAndType_info info, P p);
         R visitMethodref(CONSTANT_Methodref_info info, P p);
         R visitMethodHandle(CONSTANT_MethodHandle_info info, P p);
         R visitMethodType(CONSTANT_MethodType_info info, P p);
+        R visitModule(CONSTANT_Module_info info, P p);
+        R visitNameAndType(CONSTANT_NameAndType_info info, P p);
+        R visitPackage(CONSTANT_Package_info info, P p);
         R visitString(CONSTANT_String_info info, P p);
         R visitUtf8(CONSTANT_Utf8_info info, P p);
     }
@@ -781,6 +797,46 @@
         }
     }
 
+    public static class CONSTANT_Module_info extends CPInfo {
+        CONSTANT_Module_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            name_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_Module_info(ConstantPool cp, int name_index) {
+            super(cp);
+            this.name_index = name_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_Module;
+        }
+
+        public int  byteLength() {
+            return 3;
+        }
+
+        /**
+         * Get the raw value of the module name referenced by this constant pool entry.
+         * This will be the name of the module.
+         * @return the raw value of the module name
+         */
+        public String getName() throws ConstantPoolException {
+            return cp.getUTF8Value(name_index);
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_Module_info[name_index: " + name_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitModule(this, data);
+        }
+
+        public final int name_index;
+    }
+
     public static class CONSTANT_NameAndType_info extends CPInfo {
         CONSTANT_NameAndType_info(ConstantPool cp, ClassReader cr) throws IOException {
             super(cp);
@@ -823,6 +879,46 @@
         public final int type_index;
     }
 
+    public static class CONSTANT_Package_info extends CPInfo {
+        CONSTANT_Package_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            name_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_Package_info(ConstantPool cp, int name_index) {
+            super(cp);
+            this.name_index = name_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_Package;
+        }
+
+        public int  byteLength() {
+            return 3;
+        }
+
+        /**
+         * Get the raw value of the package name referenced by this constant pool entry.
+         * This will be the name of the package, in internal form.
+         * @return the raw value of the module name
+         */
+        public String getName() throws ConstantPoolException {
+            return cp.getUTF8Value(name_index);
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_Package_info[name_index: " + name_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitPackage(this, data);
+        }
+
+        public final int name_index;
+    }
+
     public static class CONSTANT_String_info extends CPInfo {
         CONSTANT_String_info(ConstantPool cp, ClassReader cr) throws IOException {
             super(cp);
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java	Fri Dec 16 11:58:18 2016 -0800
@@ -248,11 +248,7 @@
             boolean transitiveClosure)
             throws ClassFileNotFoundException {
         final Set<Dependency> results = new HashSet<>();
-        Recorder r = new Recorder() {
-            public void addDependency(Dependency d) {
-                results.add(d);
-            }
-        };
+        Recorder r = results::add;
         findAllDependencies(classFinder, rootClassNames, transitiveClosure, r);
         return results;
     }
@@ -565,7 +561,7 @@
         private Map<String,Location> locations = new ConcurrentHashMap<>();
 
         Location getLocation(String className) {
-            return locations.computeIfAbsent(className, cn -> new SimpleLocation(cn));
+            return locations.computeIfAbsent(className, SimpleLocation::new);
         }
 
         class Visitor implements ConstantPool.Visitor<Void,Void>, Type.Visitor<Void, Void> {
@@ -708,6 +704,10 @@
                 return visitRef(info, p);
             }
 
+            public Void visitModule(CONSTANT_Module_info info, Void p) {
+                return null;
+            }
+
             public Void visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
                 try {
                     new Signature(info.type_index).getType(constant_pool).accept(this, null);
@@ -717,6 +717,10 @@
                 }
             }
 
+            public Void visitPackage(CONSTANT_Package_info info, Void p) {
+                return null;
+            }
+
             public Void visitString(CONSTANT_String_info info, Void p) {
                 return null;
             }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModulePackages_attribute.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModulePackages_attribute.java	Fri Dec 16 11:58:18 2016 -0800
@@ -27,6 +27,8 @@
 
 import java.io.IOException;
 
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Package_info;
+
 /**
  * See JVMS, section 4.8.15.
  *
@@ -61,7 +63,8 @@
 
     public String getPackage(int index, ConstantPool constant_pool) throws ConstantPoolException {
         int package_index = packages_index[index];
-        return constant_pool.getUTF8Value(package_index);
+        CONSTANT_Package_info info = constant_pool.getPackageInfo(package_index);
+        return info.getName();
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleResolution_attribute.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,69 @@
+/*
+ * 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 com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.15.
+ *
+ *  <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.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class ModuleResolution_attribute extends Attribute {
+    public static final int DO_NOT_RESOLVE_BY_DEFAULT   = 0x0001;
+    public static final int WARN_DEPRECATED             = 0x0002;
+    public static final int WARN_DEPRECATED_FOR_REMOVAL = 0x0004;
+    public static final int WARN_INCUBATING             = 0x0008;
+
+    ModuleResolution_attribute(ClassReader cr, int name_index, int length)
+            throws IOException {
+        super(name_index, length);
+        resolution_flags = cr.readUnsignedShort();
+    }
+
+    public ModuleResolution_attribute(ConstantPool constant_pool,
+                              int resolution_flags)
+            throws ConstantPoolException {
+        this(constant_pool.getUTF8Index(Attribute.ModulePackages),
+             resolution_flags);
+    }
+
+    public ModuleResolution_attribute(int name_index,
+                              int resolution_flags) {
+        super(name_index, 2);
+        this.resolution_flags = resolution_flags;
+    }
+
+    @Override
+    public <R, D> R accept(Visitor<R, D> visitor, D data) {
+        return visitor.visitModuleResolution(this, data);
+    }
+
+    public final int resolution_flags;
+}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleVersion_attribute.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.15.
- *
- *  <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.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class ModuleVersion_attribute extends Attribute {
-    ModuleVersion_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        version_index = cr.readUnsignedShort();
-    }
-
-    public ModuleVersion_attribute(ConstantPool constant_pool, int version_index)
-            throws ConstantPoolException {
-        this(constant_pool.getUTF8Index(Attribute.ModuleVersion), version_index);
-    }
-
-    public ModuleVersion_attribute(int name_index, int version_index) {
-        super(name_index, 2);
-        this.version_index = version_index;
-    }
-
-    @Override
-    public <R, D> R accept(Visitor<R, D> visitor, D data) {
-        return visitor.visitModuleVersion(this, data);
-    }
-
-    public final int version_index;
-}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java	Fri Dec 16 11:58:18 2016 -0800
@@ -27,6 +27,8 @@
 
 import java.io.IOException;
 
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Module_info;
+
 /**
  * See Jigsaw.
  *
@@ -48,6 +50,8 @@
         module_name = cr.readUnsignedShort();
         module_flags = cr.readUnsignedShort();
 
+        module_version_index = cr.readUnsignedShort();
+
         requires_count = cr.readUnsignedShort();
         requires = new RequiresEntry[requires_count];
         for (int i = 0; i < requires_count; i++)
@@ -77,6 +81,7 @@
     public Module_attribute(int name_index,
             int module_name,
             int module_flags,
+            int module_version_index,
             RequiresEntry[] requires,
             ExportsEntry[] exports,
             OpensEntry[] opens,
@@ -85,6 +90,7 @@
         super(name_index, 2);
         this.module_name = module_name;
         this.module_flags = module_flags;
+        this.module_version_index = module_version_index;
         requires_count = requires.length;
         this.requires = requires;
         exports_count = exports.length;
@@ -109,6 +115,7 @@
 
     public final int module_name;
     public final int module_flags;
+    public final int module_version_index;
     public final int requires_count;
     public final RequiresEntry[] requires;
     public final int exports_count;
@@ -124,21 +131,25 @@
         RequiresEntry(ClassReader cr) throws IOException {
             requires_index = cr.readUnsignedShort();
             requires_flags = cr.readUnsignedShort();
+            requires_version_index = cr.readUnsignedShort();
         }
 
-        public RequiresEntry(int index, int flags) {
+        public RequiresEntry(int index, int flags, int version_index) {
             this.requires_index = index;
             this.requires_flags = flags;
+            this.requires_version_index = version_index;
         }
 
         public String getRequires(ConstantPool constant_pool) throws ConstantPoolException {
-            return constant_pool.getUTF8Value(requires_index);
+            CONSTANT_Module_info info = constant_pool.getModuleInfo(requires_index);
+            return info.getName();
         }
 
         public static final int length = 4;
 
         public final int requires_index;
         public final int requires_flags;
+        public final int requires_version_index;
     }
 
     public static class ExportsEntry {
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ReferenceFinder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ReferenceFinder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -136,14 +136,6 @@
             return false;
         }
 
-        public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ConstantPool cpool) {
-            return filter.accept(cpool, info);
-        }
-
-        public Boolean visitMethodref(CONSTANT_Methodref_info info, ConstantPool cpool) {
-            return filter.accept(cpool, info);
-        }
-
         public Boolean visitFieldref(CONSTANT_Fieldref_info info, ConstantPool cpool) {
             return filter.accept(cpool, info);
         }
@@ -160,6 +152,10 @@
             return false;
         }
 
+        public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ConstantPool cpool) {
+            return filter.accept(cpool, info);
+        }
+
         public Boolean visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ConstantPool cpool) {
             return false;
         }
@@ -168,15 +164,27 @@
             return false;
         }
 
+        public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitMethodref(CONSTANT_Methodref_info info, ConstantPool cpool) {
+            return filter.accept(cpool, info);
+        }
+
+        public Boolean visitMethodType(CONSTANT_MethodType_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitModule(CONSTANT_Module_info info, ConstantPool cpool) {
+            return false;
+        }
+
         public Boolean visitNameAndType(CONSTANT_NameAndType_info info, ConstantPool cpool) {
             return false;
         }
 
-        public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, ConstantPool cpool) {
-            return false;
-        }
-
-        public Boolean visitMethodType(CONSTANT_MethodType_info info, ConstantPool cpool) {
+        public Boolean visitPackage(CONSTANT_Package_info info, ConstantPool cpool) {
             return false;
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -51,8 +51,8 @@
 import com.sun.tools.classfile.ModuleHashes_attribute;
 import com.sun.tools.classfile.ModuleMainClass_attribute;
 import com.sun.tools.classfile.ModulePackages_attribute;
+import com.sun.tools.classfile.ModuleResolution_attribute;
 import com.sun.tools.classfile.ModuleTarget_attribute;
-import com.sun.tools.classfile.ModuleVersion_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
@@ -237,27 +237,6 @@
         return null;
     }
 
-    private String getJavaPackage(ModulePackages_attribute attr, int index) {
-        try {
-            return getJavaName(attr.getPackage(index, constant_pool));
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    @Override
-    public Void visitModulePackages(ModulePackages_attribute attr, Void ignore) {
-        println("ModulePackages: ");
-        indent(+1);
-        for (int i = 0; i < attr.packages_count; i++) {
-            print("#" + attr.packages_index[i]);
-            tab();
-            println("// " + getJavaPackage(attr, i));
-        }
-        indent(-1);
-        return null;
-    }
-
     @Override
     public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) {
         print("ConstantValue: ");
@@ -322,39 +301,6 @@
         }
     }
 
-    @Override
-    public Void visitModuleHashes(ModuleHashes_attribute attr, Void ignore) {
-        println("ModuleHashes:");
-        indent(+1);
-        print("algorithm #" + attr.algorithm_index);
-        tab();
-        println("// " + getAlgorithm(attr));
-        for (ModuleHashes_attribute.Entry e : attr.hashes_table) {
-            print("#" + e.module_name_index);
-            tab();
-            println("// " + getModuleName(e));
-            println("hash_length: " + e.hash.length);
-            println("hash: [" + toHex(e.hash) + "]");
-        }
-        indent(-1);
-        return null;
-    }
-
-    private String getAlgorithm(ModuleHashes_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.algorithm_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    private String getModuleName(ModuleHashes_attribute.Entry entry) {
-        try {
-            return constant_pool.getUTF8Value(entry.module_name_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
 
     @Override
     public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
@@ -449,15 +395,6 @@
         return null;
     }
 
-    @Override
-    public Void visitModuleMainClass(ModuleMainClass_attribute attr, Void ignore) {
-        print("ModuleMainClass: #" + attr.main_class_index);
-        tab();
-        print("// " + getJavaClassName(attr));
-        println();
-        return null;
-    }
-
     private String getJavaClassName(ModuleMainClass_attribute a) {
         try {
             return getJavaName(a.getMainClassName(constant_pool));
@@ -495,13 +432,11 @@
         println("Module:");
         indent(+1);
 
-        print(attr.module_name);
-        tab();
-        println("// " + constantWriter.stringValue(attr.module_name));
-
+        print("#" + attr.module_name);
+        print(",");
         print(String.format("%x", attr.module_flags));
         tab();
-        print("// ");
+        print("// " + constantWriter.stringValue(attr.module_name));
         if ((attr.module_flags & Module_attribute.ACC_OPEN) != 0)
             print(" ACC_OPEN");
         if ((attr.module_flags & Module_attribute.ACC_MANDATED) != 0)
@@ -509,6 +444,12 @@
         if ((attr.module_flags & Module_attribute.ACC_SYNTHETIC) != 0)
             print(" ACC_SYNTHETIC");
         println();
+        print("#" + attr.module_version_index);
+        if (attr.module_version_index != 0) {
+            tab();
+            print("// " + constantWriter.stringValue(attr.module_version_index));
+        }
+        println();
 
         printRequiresTable(attr);
         printExportsTable(attr);
@@ -538,6 +479,12 @@
             if ((e.requires_flags & Module_attribute.ACC_MANDATED) != 0)
                 print(" ACC_MANDATED");
             println();
+            print("#" + e.requires_version_index);
+            if (e.requires_version_index != 0) {
+                tab();
+                print("// " + constantWriter.stringValue(e.requires_version_index));
+            }
+            println();
         }
         indent(-1);
     }
@@ -627,6 +574,145 @@
     }
 
     @Override
+    public Void visitModuleHashes(ModuleHashes_attribute attr, Void ignore) {
+        println("ModuleHashes:");
+        indent(+1);
+        print("algorithm: #" + attr.algorithm_index);
+        tab();
+        println("// " + getAlgorithm(attr));
+        print(attr.hashes_table_length);
+        tab();
+        println("// hashes");
+        for (ModuleHashes_attribute.Entry e : attr.hashes_table) {
+            print("#" + e.module_name_index);
+            tab();
+            println("// " + getModuleName(e));
+            println("hash_length: " + e.hash.length);
+            println("hash: [" + toHex(e.hash) + "]");
+        }
+        indent(-1);
+        return null;
+    }
+
+    private String getAlgorithm(ModuleHashes_attribute attr) {
+        try {
+            return constant_pool.getUTF8Value(attr.algorithm_index);
+        } catch (ConstantPoolException e) {
+            return report(e);
+        }
+    }
+
+    private String getModuleName(ModuleHashes_attribute.Entry entry) {
+        try {
+            int utf8Index = constant_pool.getModuleInfo(entry.module_name_index).name_index;
+            return constant_pool.getUTF8Value(utf8Index);
+        } catch (ConstantPoolException e) {
+            return report(e);
+        }
+    }
+
+    @Override
+    public Void visitModuleMainClass(ModuleMainClass_attribute attr, Void ignore) {
+        print("ModuleMainClass: #" + attr.main_class_index);
+        tab();
+        print("// " + getJavaClassName(attr));
+        println();
+        return null;
+    }
+
+    @Override
+    public Void visitModulePackages(ModulePackages_attribute attr, Void ignore) {
+        println("ModulePackages: ");
+        indent(+1);
+        for (int i = 0; i < attr.packages_count; i++) {
+            print("#" + attr.packages_index[i]);
+            tab();
+            println("// " + getJavaPackage(attr, i));
+        }
+        indent(-1);
+        return null;
+    }
+
+    private String getJavaPackage(ModulePackages_attribute attr, int index) {
+        try {
+            return getJavaName(attr.getPackage(index, constant_pool));
+        } catch (ConstantPoolException e) {
+            return report(e);
+        }
+    }
+
+    @Override
+    public Void visitModuleResolution(ModuleResolution_attribute attr, Void ignore) {
+        println("ModuleResolution:");
+        indent(+1);
+        print(String.format("%x", attr.resolution_flags));
+        tab();
+        print("// ");
+        int flags = attr.resolution_flags;
+        if ((flags & ModuleResolution_attribute.DO_NOT_RESOLVE_BY_DEFAULT) != 0)
+            print(" DO_NOT_RESOLVE_BY_DEFAULT");
+        if ((flags & ModuleResolution_attribute.WARN_DEPRECATED) != 0)
+            print(" WARN_DEPRECATED");
+        if ((flags & ModuleResolution_attribute.WARN_DEPRECATED_FOR_REMOVAL) != 0)
+            print(" WARN_DEPRECATED_FOR_REMOVAL");
+        if ((flags & ModuleResolution_attribute.WARN_INCUBATING) != 0)
+            print(" WARN_INCUBATING");
+        println();
+        indent(-1);
+        return null;
+    }
+
+    @Override
+    public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) {
+        println("ModuleTarget:");
+        indent(+1);
+        print("os_name: #" + attr.os_name_index);
+        if (attr.os_name_index != 0) {
+            tab();
+            print("// " + getOSName(attr));
+        }
+        println();
+        print("os_arch: #" + attr.os_arch_index);
+        if (attr.os_arch_index != 0) {
+            tab();
+            print("// " + getOSArch(attr));
+        }
+        println();
+        print("os_version: #" + attr.os_version_index);
+        if (attr.os_version_index != 0) {
+            tab();
+            print("// " + getOSVersion(attr));
+        }
+        println();
+        indent(-1);
+        return null;
+    }
+
+    private String getOSName(ModuleTarget_attribute attr) {
+        try {
+            return constant_pool.getUTF8Value(attr.os_name_index);
+        } catch (ConstantPoolException e) {
+            return report(e);
+        }
+    }
+
+    private String getOSArch(ModuleTarget_attribute attr) {
+        try {
+            return constant_pool.getUTF8Value(attr.os_arch_index);
+        } catch (ConstantPoolException e) {
+            return report(e);
+        }
+    }
+
+    private String getOSVersion(ModuleTarget_attribute attr) {
+        try {
+            return constant_pool.getUTF8Value(attr.os_version_index);
+        } catch (ConstantPoolException e) {
+            return report(e);
+        }
+    }
+
+    @Override
     public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleAnnotations:");
         indent(+1);
@@ -929,74 +1015,6 @@
         return null;
     }
 
-    @Override
-    public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) {
-        println("ModuleTarget:");
-        indent(+1);
-        print("os_name: #" + attr.os_name_index);
-        if (attr.os_name_index != 0) {
-            tab();
-            print("// " + getOSName(attr));
-        }
-        println();
-        print("os_arch: #" + attr.os_arch_index);
-        if (attr.os_arch_index != 0) {
-            tab();
-            print("// " + getOSArch(attr));
-        }
-        println();
-        print("os_version: #" + attr.os_version_index);
-        if (attr.os_version_index != 0) {
-            tab();
-            print("// " + getOSVersion(attr));
-        }
-        println();
-        indent(-1);
-        return null;
-    }
-
-    private String getOSName(ModuleTarget_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.os_name_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    private String getOSArch(ModuleTarget_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.os_arch_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    private String getOSVersion(ModuleTarget_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.os_version_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    @Override
-    public Void visitModuleVersion(ModuleVersion_attribute attr, Void ignore) {
-        print("ModuleVersion: #" + attr.version_index);
-        indent(+1);
-        tab();
-        println("// " + getVersion(attr));
-        indent(-1);
-        return null;
-    }
-
-    private String getVersion(ModuleVersion_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.version_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
     static String getJavaName(String name) {
         return name.replace('/', '.');
     }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -58,6 +58,8 @@
 import com.sun.tools.classfile.Type.WildcardType;
 
 import static com.sun.tools.classfile.AccessFlags.*;
+import static com.sun.tools.classfile.ConstantPool.CONSTANT_Module;
+import static com.sun.tools.classfile.ConstantPool.CONSTANT_Package;
 
 /*
  *  The main javap class to write the contents of a class file as text.
@@ -166,7 +168,12 @@
                 Module_attribute modAttr = (Module_attribute) attr;
                 String name;
                 try {
-                    name = getJavaName(constant_pool.getUTF8Value(modAttr.module_name));
+                    // FIXME: compatibility code
+                    if (constant_pool.get(modAttr.module_name).getTag() == CONSTANT_Module) {
+                        name = getJavaName(constant_pool.getModuleInfo(modAttr.module_name).getName());
+                    } else {
+                        name = getJavaName(constant_pool.getUTF8Value(modAttr.module_name));
+                    }
                 } catch (ConstantPoolException e) {
                     name = report(e);
                 }
@@ -175,6 +182,10 @@
                 }
                 print("module ");
                 print(name);
+                if (modAttr.module_version_index != 0) {
+                    print("@");
+                    print(getUTF8Value(modAttr.module_version_index));
+                }
             } else {
                 // fallback for malformed class files
                 print("class ");
@@ -602,19 +613,31 @@
             if ((entry.requires_flags & Module_attribute.ACC_TRANSITIVE) != 0)
                 print(" transitive");
             print(" ");
-            print(getUTF8Value(entry.requires_index).replace('/', '.'));
+            String mname;
+            try {
+                mname = getModuleName(entry.requires_index);
+            } catch (ConstantPoolException e) {
+                mname = report(e);
+            }
+            print(mname);
             println(";");
         }
 
         for (Module_attribute.ExportsEntry entry: m.exports) {
             print("exports");
             print(" ");
-            print(getUTF8Value(entry.exports_index).replace('/', '.'));
+            String pname;
+            try {
+                pname = getPackageName(entry.exports_index).replace('/', '.');
+            } catch (ConstantPoolException e) {
+                pname = report(e);
+            }
+            print(pname);
             boolean first = true;
             for (int i: entry.exports_to_index) {
                 String mname;
                 try {
-                    mname = classFile.constant_pool.getUTF8Value(i).replace('/', '.');
+                    mname = getModuleName(i);
                 } catch (ConstantPoolException e) {
                     mname = report(e);
                 }
@@ -635,12 +658,18 @@
         for (Module_attribute.OpensEntry entry: m.opens) {
             print("opens");
             print(" ");
-            print(getUTF8Value(entry.opens_index).replace('/', '.'));
+            String pname;
+            try {
+                pname = getPackageName(entry.opens_index).replace('/', '.');
+            } catch (ConstantPoolException e) {
+                pname = report(e);
+            }
+            print(pname);
             boolean first = true;
             for (int i: entry.opens_to_index) {
                 String mname;
                 try {
-                    mname = classFile.constant_pool.getUTF8Value(i).replace('/', '.');
+                    mname = getModuleName(i);
                 } catch (ConstantPoolException e) {
                     mname = report(e);
                 }
@@ -684,6 +713,22 @@
         }
     }
 
+    String getModuleName(int index) throws ConstantPoolException {
+        if (constant_pool.get(index).getTag() == CONSTANT_Module) {
+            return constant_pool.getModuleInfo(index).getName();
+        } else {
+            return constant_pool.getUTF8Value(index);
+        }
+    }
+
+    String getPackageName(int index) throws ConstantPoolException {
+        if (constant_pool.get(index).getTag() == CONSTANT_Package) {
+            return constant_pool.getPackageInfo(index).getName();
+        } else {
+            return constant_pool.getUTF8Value(index);
+        }
+    }
+
     String getUTF8Value(int index) {
         try {
             return classFile.constant_pool.getUTF8Value(index);
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -109,13 +109,6 @@
                 return 2;
             }
 
-            public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
-                print("#" + info.name_index + ":#" + info.type_index);
-                tab();
-                println("// " + stringValue(info));
-                return 1;
-            }
-
             public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) {
                 print("#" + info.class_index + ".#" + info.name_and_type_index);
                 tab();
@@ -137,6 +130,27 @@
                 return 1;
             }
 
+            public Integer visitModule(CONSTANT_Module_info info, Void p) {
+                print("#" + info.name_index);
+                tab();
+                println("// " + stringValue(info));
+                return 1;
+            }
+
+            public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
+                print("#" + info.name_index + ":#" + info.type_index);
+                tab();
+                println("// " + stringValue(info));
+                return 1;
+            }
+
+            public Integer visitPackage(CONSTANT_Package_info info, Void p) {
+                print("#" + info.name_index);
+                tab();
+                println("// " + stringValue(info));
+                return 1;
+            }
+
             public Integer visitString(CONSTANT_String_info info, Void p) {
                 print("#" + info.string_index);
                 tab();
@@ -304,6 +318,14 @@
             return info.value + "l";
         }
 
+        public String visitModule(CONSTANT_Module_info info, Void p) {
+            try {
+                return checkName(info.getName());
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
         public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
             return getCheckedName(info) + ":" + getType(info);
         }
@@ -316,6 +338,14 @@
             }
         }
 
+        public String visitPackage(CONSTANT_Package_info info, Void p) {
+            try {
+                return checkName(info.getName());
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
         String getType(CONSTANT_NameAndType_info info) {
             try {
                 return info.getType();
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java	Fri Dec 16 11:58:18 2016 -0800
@@ -408,22 +408,20 @@
 
     private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
         final PrintWriter pw = getPrintWriterForWriter(w);
-        return new DiagnosticListener<JavaFileObject> () {
-            public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
-                switch (diagnostic.getKind()) {
-                    case ERROR:
-                        pw.print(getMessage("err.prefix"));
-                        break;
-                    case WARNING:
-                        pw.print(getMessage("warn.prefix"));
-                        break;
-                    case NOTE:
-                        pw.print(getMessage("note.prefix"));
-                        break;
-                }
-                pw.print(" ");
-                pw.println(diagnostic.getMessage(null));
+        return diagnostic -> {
+            switch (diagnostic.getKind()) {
+                case ERROR:
+                    pw.print(getMessage("err.prefix"));
+                    break;
+                case WARNING:
+                    pw.print(getMessage("warn.prefix"));
+                    break;
+                case NOTE:
+                    pw.print(getMessage("note.prefix"));
+                    break;
             }
+            pw.print(" ");
+            pw.println(diagnostic.getMessage(null));
         };
     }
 
@@ -643,9 +641,15 @@
 
         ClassFileInfo cfInfo = read(fo);
         if (!className.endsWith(".class")) {
-            String cfName = cfInfo.cf.getName();
-            if (!cfName.replaceAll("[/$]", ".").equals(className.replaceAll("[/$]", "."))) {
-                reportWarning("warn.unexpected.class", className, cfName.replace('/', '.'));
+            if (cfInfo.cf.this_class == 0) {
+                if (!className.equals("module-info")) {
+                    reportWarning("warn.unexpected.class", fo.getName(), className);
+                }
+            } else {
+                String cfName = cfInfo.cf.getName();
+                if (!cfName.replaceAll("[/$]", ".").equals(className.replaceAll("[/$]", "."))) {
+                    reportWarning("warn.unexpected.class", fo.getName(), className);
+                }
             }
         }
         write(cfInfo);
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties	Fri Dec 16 11:58:18 2016 -0800
@@ -27,7 +27,7 @@
 use -help for a list of possible options
 
 warn.prefix=Warning:
-warn.unexpected.class=Binary file {0} contains {1}
+warn.unexpected.class=File {0} does not contain class {1}
 
 note.prefix=Note:
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPSelector.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPSelector.java	Fri Dec 16 11:58:18 2016 -0800
@@ -76,11 +76,6 @@
     }
 
     @Override
-    public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) {
-        return null;
-    }
-
-    @Override
     public Void visitMethodref(ConstantPool.CONSTANT_Methodref_info info, CPEntries p) {
         p.methodRefs.add(info);
         return null;
@@ -97,6 +92,21 @@
     }
 
     @Override
+    public Void visitModule(ConstantPool.CONSTANT_Module_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitPackage(ConstantPool.CONSTANT_Package_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
     public Void visitString(ConstantPool.CONSTANT_String_info info, CPEntries p) {
         return null;
     }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Fri Dec 16 11:58:18 2016 -0800
@@ -147,11 +147,7 @@
     }
 
     public Iterable<ClassFile> getClassFiles() throws IOException {
-        return new Iterable<ClassFile>() {
-            public Iterator<ClassFile> iterator() {
-                return new FileIterator();
-            }
-        };
+        return FileIterator::new;
     }
 
     protected ClassFile readClassFile(Path p) throws IOException {
@@ -232,7 +228,7 @@
         protected Set<String> scan() {
             try (Stream<Path> stream = Files.walk(path, Integer.MAX_VALUE)) {
                 return stream.filter(ClassFileReader::isClass)
-                             .map(f -> path.relativize(f))
+                             .map(path::relativize)
                              .map(Path::toString)
                              .map(p -> p.replace(File.separatorChar, '/'))
                              .collect(Collectors.toSet());
@@ -264,11 +260,7 @@
 
         public Iterable<ClassFile> getClassFiles() throws IOException {
             final Iterator<ClassFile> iter = new DirectoryIterator();
-            return new Iterable<ClassFile>() {
-                public Iterator<ClassFile> iterator() {
-                    return iter;
-                }
-            };
+            return () -> iter;
         }
 
         class DirectoryIterator implements Iterator<ClassFile> {
@@ -387,11 +379,7 @@
 
         public Iterable<ClassFile> getClassFiles() throws IOException {
             final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile);
-            return new Iterable<ClassFile>() {
-                public Iterator<ClassFile> iterator() {
-                    return iter;
-                }
-            };
+            return () -> iter;
         }
     }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java	Fri Dec 16 11:58:18 2016 -0800
@@ -32,6 +32,7 @@
 import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.Dependencies;
+import com.sun.tools.classfile.Dependencies.ClassFileError;
 import com.sun.tools.classfile.Dependency;
 import com.sun.tools.classfile.Dependency.Location;
 
@@ -172,43 +173,41 @@
         parsedArchives.get(finder).add(archive);
 
         trace("parsing %s %s%n", archive.getName(), archive.path());
-        FutureTask<Set<Location>> task = new FutureTask<>(new Callable<>() {
-            public Set<Location> call() throws Exception {
-                Set<Location> targets = new HashSet<>();
-                for (ClassFile cf : archive.reader().getClassFiles()) {
-                    if (cf.access_flags.is(AccessFlags.ACC_MODULE))
-                        continue;
-
-                    String classFileName;
-                    try {
-                        classFileName = cf.getName();
-                    } catch (ConstantPoolException e) {
-                        throw new Dependencies.ClassFileError(e);
-                    }
+        FutureTask<Set<Location>> task = new FutureTask<>(() -> {
+            Set<Location> targets = new HashSet<>();
+            for (ClassFile cf : archive.reader().getClassFiles()) {
+                if (cf.access_flags.is(AccessFlags.ACC_MODULE))
+                    continue;
 
-                    // filter source class/archive
-                    String cn = classFileName.replace('/', '.');
-                    if (!finder.accept(archive, cn, cf.access_flags))
-                        continue;
-
-                    // tests if this class matches the -include
-                    if (!filter.matches(cn))
-                        continue;
-
-                    for (Dependency d : finder.findDependencies(cf)) {
-                        if (filter.accepts(d)) {
-                            archive.addClass(d.getOrigin(), d.getTarget());
-                            targets.add(d.getTarget());
-                        } else {
-                            // ensure that the parsed class is added the archive
-                            archive.addClass(d.getOrigin());
-                        }
-                        parsedClasses.putIfAbsent(d.getOrigin(), archive);
-                    }
+                String classFileName;
+                try {
+                    classFileName = cf.getName();
+                } catch (ConstantPoolException e) {
+                    throw new ClassFileError(e);
                 }
 
-                return targets;
+                // filter source class/archive
+                String cn = classFileName.replace('/', '.');
+                if (!finder.accept(archive, cn, cf.access_flags))
+                    continue;
+
+                // tests if this class matches the -include
+                if (!filter.matches(cn))
+                    continue;
+
+                for (Dependency d : finder.findDependencies(cf)) {
+                    if (filter.accepts(d)) {
+                        archive.addClass(d.getOrigin(), d.getTarget());
+                        targets.add(d.getTarget());
+                    } else {
+                        // ensure that the parsed class is added the archive
+                        archive.addClass(d.getOrigin());
+                    }
+                    parsedClasses.putIfAbsent(d.getOrigin(), archive);
+                }
             }
+
+            return targets;
         });
         tasks.add(task);
         pool.submit(task);
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java	Fri Dec 16 11:58:18 2016 -0800
@@ -209,7 +209,7 @@
                 visited.add(node);
                 edges.get(node).stream()
                      .filter(e -> includeAdjacent || !node.equals(u) || !e.equals(v))
-                     .forEach(e -> stack.push(e));
+                     .forEach(stack::push);
             }
         }
         assert !visited.contains(v);
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Fri Dec 16 11:58:18 2016 -0800
@@ -394,29 +394,29 @@
                 ModuleDescriptor descriptor = dropHashes(ModuleDescriptor.read(bin));
                 String mn = descriptor.name();
                 URI uri = URI.create("jrt:/" + path.getFileName().toString());
-                Supplier<ModuleReader> readerSupplier = new Supplier<>() {
+                Supplier<ModuleReader> readerSupplier = () -> new ModuleReader() {
                     @Override
-                    public ModuleReader get() {
-                        return new ModuleReader() {
-                            @Override
-                            public Optional<URI> find(String name) throws IOException {
-                                return name.equals(mn)
-                                    ? Optional.of(uri) : Optional.empty();
-                            }
+                    public Optional<URI> find(String name) throws IOException {
+                        return name.equals(mn)
+                            ? Optional.of(uri) : Optional.empty();
+                    }
 
-                            @Override
-                            public Stream<String> list() {
-                                return Stream.empty();
-                            }
+                    @Override
+                    public Stream<String> list() {
+                        return Stream.empty();
+                    }
 
-                            @Override
-                            public void close() {
-                            }
-                        };
+                    @Override
+                    public void close() {
                     }
                 };
 
-                return new ModuleReference(descriptor, uri, readerSupplier);
+                return new ModuleReference(descriptor, uri) {
+                    @Override
+                    public ModuleReader open() {
+                        return readerSupplier.get();
+                    }
+                };
             } catch (IOException e) {
                 throw new UncheckedIOException(e);
             }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Fri Dec 16 11:58:18 2016 -0800
@@ -889,15 +889,11 @@
             if (!ok && !options.nowarning) {
                 reportError("err.missing.dependences");
                 builder.visitMissingDeps(
-                    new Analyzer.Visitor() {
-                        @Override
-                        public void visitDependence(String origin, Archive originArchive,
-                                                    String target, Archive targetArchive) {
+                        (origin, originArchive, target, targetArchive) -> {
                             if (builder.notFound(targetArchive))
                                 log.format("   %-50s -> %-50s %s%n",
                                     origin, target, targetArchive.getName());
-                        }
-                    });
+                        });
             }
             return ok;
         }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Fri Dec 16 11:58:18 2016 -0800
@@ -69,21 +69,16 @@
 
         // A visitor to record the module-level dependences as well as
         // use of JDK internal APIs
-        Analyzer.Visitor visitor = new Analyzer.Visitor() {
-            @Override
-            public void visitDependence(String origin, Archive originArchive,
-                                        String target, Archive targetArchive)
-            {
-                Set<String> jdkInternals =
-                    deps.computeIfAbsent(originArchive, _k -> new HashMap<>())
-                        .computeIfAbsent(targetArchive, _k -> new HashSet<>());
+        Analyzer.Visitor visitor = (origin, originArchive, target, targetArchive) -> {
+            Set<String> jdkInternals =
+                deps.computeIfAbsent(originArchive, _k -> new HashMap<>())
+                    .computeIfAbsent(targetArchive, _k -> new HashSet<>());
 
-                Module module = targetArchive.getModule();
-                if (originArchive.getModule() != module &&
-                        module.isJDK() && !module.isExported(target)) {
-                    // use of JDK internal APIs
-                    jdkInternals.add(target);
-                }
+            Module module = targetArchive.getModule();
+            if (originArchive.getModule() != module &&
+                    module.isJDK() && !module.isExported(target)) {
+                // use of JDK internal APIs
+                jdkInternals.add(target);
             }
         };
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Profile.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Profile.java	Fri Dec 16 11:58:18 2016 -0800
@@ -39,22 +39,28 @@
  * Build the profile information.
  */
 enum Profile {
-    COMPACT1("compact1", 1, "java.compact1"),
-    COMPACT2("compact2", 2, "java.compact2"),
-    COMPACT3("compact3", 3, "java.compact3", "java.smartcardio", "jdk.sctp",
-                            "jdk.httpserver", "jdk.security.auth",
-                            "jdk.naming.dns", "jdk.naming.rmi",
-                            "jdk.management"),
-    // need a way to determine JRE modules
-    SE_JRE("Java SE JRE", 4, "java.se", "jdk.charsets",
-                            "jdk.crypto.ec", "jdk.crypto.pkcs11",
-                            "jdk.crypto.mscapi", "jdk.crypto.ucrypto",
-                            "jdk.localedata", "jdk.scripting.nashorn", "jdk.zipfs"),
-    FULL_JRE("Full JRE", 5, "java.se.ee", "jdk.charsets",
-                            "jdk.crypto.ec", "jdk.crypto.pkcs11",
-                            "jdk.crypto.mscapi", "jdk.crypto.ucrypto", "jdk.jvmstat",
-                            "jdk.localedata", "jdk.scripting.nashorn",
-                            "jdk.unsupported", "jdk.zipfs");
+    COMPACT1("compact1", 1, "java.logging",
+                            "java.scripting"),
+    COMPACT2("compact2", 2, "java.rmi",
+                            "java.sql",
+                            "java.xml",
+                            "jdk.xml.dom",
+                            "jdk.httpserver"),
+    COMPACT3("compact3", 3, "java.smartcardio",
+                            "java.compiler",
+                            "java.instrument",
+                            "java.management",
+                            "java.naming",
+                            "java.prefs",
+                            "java.security.jgss",
+                            "java.security.sasl",
+                            "java.sql.rowset",
+                            "java.xml.crypto",
+                            "jdk.management",
+                            "jdk.naming.dns",
+                            "jdk.naming.rmi",
+                            "jdk.sctp",
+                            "jdk.security.auth");
 
     final String name;
     final int profile;
@@ -80,12 +86,6 @@
         return JDK.isEmpty() ? 0 : Profile.values().length;
     }
 
-    Optional<Module> findModule(String name) {
-        return modules.containsKey(name)
-            ? Optional.of(modules.get(name))
-            : Optional.empty();
-    }
-
     /**
      * Returns the Profile for the given package name; null if not found.
      */
@@ -137,6 +137,9 @@
 
     // for debugging
     public static void main(String[] args) throws IOException {
+        // initialize Profiles
+        new JdepsConfiguration.Builder().allModules().build();
+
         // find platform modules
         if (Profile.getProfileCount() == 0) {
             System.err.println("No profile is present in this JDK");
@@ -147,6 +150,6 @@
         }
         System.out.println("All JDK modules:-");
         JDK.stream().sorted(Comparator.comparing(Module::name))
-           .forEach(m -> System.out.println(m));
+           .forEach(System.out::println);
     }
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ArgTokenizer.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ArgTokenizer.java	Fri Dec 16 11:58:18 2016 -0800
@@ -30,6 +30,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
+
 import static java.util.stream.Collectors.toList;
 
 /**
@@ -139,7 +141,7 @@
      */
     int optionCount() {
         return (int) options.entrySet().stream()
-                .filter(e -> e.getValue())
+                .filter(Entry::getValue)
                 .count();
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Fri Dec 16 11:58:18 2016 -0800
@@ -125,7 +125,7 @@
 
                 boolean smart = allowSmart &&
                                 suggestions.stream()
-                                           .anyMatch(s -> s.matchesType());
+                                           .anyMatch(Suggestion::matchesType);
 
                 lastTest = test;
                 lastCursor = cursor;
@@ -133,16 +133,16 @@
 
                 suggestions.stream()
                            .filter(s -> !smart || s.matchesType())
-                           .map(s -> s.continuation())
+                           .map(Suggestion::continuation)
                            .forEach(result::add);
 
                 boolean onlySmart = suggestions.stream()
-                                               .allMatch(s -> s.matchesType());
+                                               .allMatch(Suggestion::matchesType);
 
                 if (smart && !onlySmart) {
                     Optional<String> prefix =
                             suggestions.stream()
-                                       .map(s -> s.continuation())
+                                       .map(Suggestion::continuation)
                                        .reduce(ConsoleIOContext::commonPrefix);
 
                     String prefixStr = prefix.orElse("").substring(cursor - anchor[0]);
@@ -281,7 +281,7 @@
                                                               term.isAnsiSupported());
             Function<Documentation, String> convertor;
             if (firstInvocation) {
-                convertor = d -> d.signature();
+                convertor = Documentation::signature;
             } else {
                 convertor = d -> formatter.formatJavadoc(d.signature(), d.javadoc()) +
                                  (d.javadoc() == null ? repl.messageFormat("jshell.console.no.javadoc")
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ContinuousCompletionProvider.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ContinuousCompletionProvider.java	Fri Dec 16 11:58:18 2016 -0800
@@ -38,10 +38,8 @@
 
 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);
+    static final BiPredicate<String, String> STARTSWITH_MATCHER = String::startsWith;
+    static final BiPredicate<String, String> PERFECT_MATCHER = String::equals;
 
     private final Supplier<Map<String, CompletionProvider>> wordCompletionProviderSupplier;
     private final BiPredicate<String, String> matcher;
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Fri Dec 16 11:58:18 2016 -0800
@@ -882,7 +882,7 @@
 
         void showTruncationSettings(Mode sm) {
             if (sm == null) {
-                modeMap.values().forEach(m -> showTruncationSettings(m));
+                modeMap.values().forEach(this::showTruncationSettings);
             } else {
                 List<Mode.Setting> trunc = sm.cases.get(TRUNCATION_FIELD);
                 if (trunc != null) {
@@ -897,7 +897,7 @@
 
         void showPromptSettings(Mode sm) {
             if (sm == null) {
-                modeMap.values().forEach(m -> showPromptSettings(m));
+                modeMap.values().forEach(this::showPromptSettings);
             } else {
                 hard("/set prompt %s %s %s",
                         sm.name,
@@ -908,7 +908,7 @@
 
         void showModeSettings(String umode, String msg) {
             if (umode == null) {
-                modeMap.values().forEach(n -> showModeSettings(n));
+                modeMap.values().forEach(this::showModeSettings);
             } else {
                 Mode m;
                 String retained = retainedMap.get(umode);
@@ -1272,7 +1272,7 @@
                 return null;
             }
             if (at.isQuoted() ||
-                    !id.codePoints().allMatch(cp -> Character.isJavaIdentifierPart(cp))) {
+                    !id.codePoints().allMatch(Character::isJavaIdentifierPart)) {
                 errorat(err, id);
                 return null;
             }
@@ -1307,8 +1307,8 @@
             // Failing an exact match, go searching
             Mode[] matches = modeMap.entrySet().stream()
                     .filter(e -> e.getKey().startsWith(umode))
-                    .map(e -> e.getValue())
-                    .toArray(size -> new Mode[size]);
+                    .map(Entry::getValue)
+                    .toArray(Mode[]::new);
             if (matches.length == 1) {
                 return matches[0];
             } else {
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Fri Dec 16 11:58:18 2016 -0800
@@ -452,7 +452,7 @@
     <T> void hardPairs(Stream<T> stream, Function<T, String> a, Function<T, String> b) {
         Map<String, String> a2b = stream.collect(toMap(a, b,
                 (m1, m2) -> m1,
-                () -> new LinkedHashMap<>()));
+                LinkedHashMap::new));
         for (Entry<String, String> e : a2b.entrySet()) {
             hard("%s", e.getKey());
             rawout(prefix(e.getValue(), feedback.getPre() + "\t", feedback.getPost()));
@@ -953,7 +953,7 @@
                        .stream()
                        .filter(filter)
                        .filter(command -> command.command.startsWith(cmd))
-                       .toArray(size -> new Command[size]);
+                       .toArray(Command[]::new);
     }
 
     private static Path toPathResolvingUserHome(String pathString) {
@@ -1125,7 +1125,7 @@
                                 ? Stream.of(String.valueOf(k.id()) + " ", ((DeclarationSnippet) k).name() + " ")
                                 : Stream.of(String.valueOf(k.id()) + " "))
                         .filter(k -> k.startsWith(argPrefix))
-                        .map(k -> new ArgSuggestion(k))
+                        .map(ArgSuggestion::new)
                         .collect(Collectors.toList());
         };
     }
@@ -1154,7 +1154,7 @@
                 result = new FixedCompletionProvider(commands.values().stream()
                         .filter(cmd -> cmd.kind.showInHelp || cmd.kind == CommandKind.HELP_SUBJECT)
                         .map(c -> c.command + " ")
-                        .toArray(size -> new String[size]))
+                        .toArray(String[]::new))
                         .completionSuggestions(code, cursor, anchor);
             } else if (code.startsWith("/se")) {
                 result = new FixedCompletionProvider(SET_SUBCOMMANDS)
@@ -1264,33 +1264,33 @@
 
     {
         registerCommand(new Command("/list",
-                arg -> cmdList(arg),
+                this::cmdList,
                 snippetWithOptionCompletion(SNIPPET_HISTORY_OPTION_COMPLETION_PROVIDER,
                         this::allSnippets)));
         registerCommand(new Command("/edit",
-                arg -> cmdEdit(arg),
+                this::cmdEdit,
                 snippetWithOptionCompletion(SNIPPET_OPTION_COMPLETION_PROVIDER,
                         this::allSnippets)));
         registerCommand(new Command("/drop",
-                arg -> cmdDrop(arg),
+                this::cmdDrop,
                 snippetCompletion(this::dropableSnippets),
                 CommandKind.REPLAY));
         registerCommand(new Command("/save",
-                arg -> cmdSave(arg),
+                this::cmdSave,
                 saveCompletion()));
         registerCommand(new Command("/open",
-                arg -> cmdOpen(arg),
+                this::cmdOpen,
                 FILE_COMPLETION_PROVIDER));
         registerCommand(new Command("/vars",
-                arg -> cmdVars(arg),
+                this::cmdVars,
                 snippetWithOptionCompletion(SNIPPET_OPTION_COMPLETION_PROVIDER,
                         this::allVarSnippets)));
         registerCommand(new Command("/methods",
-                arg -> cmdMethods(arg),
+                this::cmdMethods,
                 snippetWithOptionCompletion(SNIPPET_OPTION_COMPLETION_PROVIDER,
                         this::allMethodSnippets)));
         registerCommand(new Command("/types",
-                arg -> cmdTypes(arg),
+                this::cmdTypes,
                 snippetWithOptionCompletion(SNIPPET_OPTION_COMPLETION_PROVIDER,
                         this::allTypeSnippets)));
         registerCommand(new Command("/imports",
@@ -1303,24 +1303,24 @@
                 arg -> cmdReset(),
                 EMPTY_COMPLETION_PROVIDER));
         registerCommand(new Command("/reload",
-                arg -> cmdReload(arg),
+                this::cmdReload,
                 reloadCompletion()));
         registerCommand(new Command("/classpath",
-                arg -> cmdClasspath(arg),
+                this::cmdClasspath,
                 classPathCompletion(),
                 CommandKind.REPLAY));
         registerCommand(new Command("/history",
                 arg -> cmdHistory(),
                 EMPTY_COMPLETION_PROVIDER));
         registerCommand(new Command("/debug",
-                arg -> cmdDebug(arg),
+                this::cmdDebug,
                 EMPTY_COMPLETION_PROVIDER,
                 CommandKind.HIDDEN));
         registerCommand(new Command("/help",
-                arg -> cmdHelp(arg),
+                this::cmdHelp,
                 helpCompletion()));
         registerCommand(new Command("/set",
-                arg -> cmdSet(arg),
+                this::cmdSet,
                 new ContinuousCompletionProvider(Map.of(
                         // need more completion for format for usability
                         "format", feedback.modeCompletions(),
@@ -1335,7 +1335,7 @@
                         STARTSWITH_MATCHER)));
         registerCommand(new Command("/?",
                 "help.quest",
-                arg -> cmdHelp(arg),
+                this::cmdHelp,
                 helpCompletion(),
                 CommandKind.NORMAL));
         registerCommand(new Command("/!",
@@ -1450,7 +1450,7 @@
         }
         String[] matches = Arrays.stream(subs)
                 .filter(s -> s.startsWith(sub))
-                .toArray(size -> new String[size]);
+                .toArray(String[]::new);
         if (matches.length == 0) {
             // There are no matching sub-commands
             errormsg("jshell.err.arg", cmd, sub);
@@ -1784,7 +1784,7 @@
         if (subject != null) {
             Command[] matches = commands.values().stream()
                     .filter(c -> c.command.startsWith(subject))
-                    .toArray(size -> new Command[size]);
+                    .toArray(Command[]::new);
             if (matches.length == 1) {
                 String cmd = matches[0].command;
                 if (cmd.equals("/set")) {
@@ -2414,7 +2414,7 @@
      */
     List<Diag> errorsOnly(List<Diag> diagnostics) {
         return diagnostics.stream()
-                .filter(d -> d.isError())
+                .filter(Diag::isError)
                 .collect(toList());
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java	Fri Dec 16 11:58:18 2016 -0800
@@ -51,36 +51,33 @@
             throw new IllegalStateException("Already initialized.");
         initialized = true;
 
-        Thread reader = new Thread() {
-            @Override
-            public void run() {
-                try {
-                    int read;
-                    while (true) {
-                        //to support external terminal editors, the "cmdin.read" must not run when
-                        //an external editor is running. At the same time, it needs to run while the
-                        //user's code is running (so Ctrl-C is detected). Hence waiting here until
-                        //there is a confirmed need for input.
-                        StopDetectingInputStream.State currentState = waitInputNeeded();
-                        if (currentState == StopDetectingInputStream.State.CLOSED) {
-                            break;
-                        }
-                        if ((read = input.read()) == (-1)) {
-                            break;
-                        }
-                        if (read == 3 && currentState == StopDetectingInputStream.State.BUFFER) {
-                            stop.run();
-                        } else {
-                            write(read);
-                        }
+        Thread reader = new Thread(() -> {
+            try {
+                int read;
+                while (true) {
+                    //to support external terminal editors, the "cmdin.read" must not run when
+                    //an external editor is running. At the same time, it needs to run while the
+                    //user's code is running (so Ctrl-C is detected). Hence waiting here until
+                    //there is a confirmed need for input.
+                    State currentState = waitInputNeeded();
+                    if (currentState == State.CLOSED) {
+                        break;
                     }
-                } catch (IOException ex) {
-                    errorHandler.accept(ex);
-                } finally {
-                    shutdown();
+                    if ((read = input.read()) == (-1)) {
+                        break;
+                    }
+                    if (read == 3 && currentState == State.BUFFER) {
+                        stop.run();
+                    } else {
+                        write(read);
+                    }
                 }
+            } catch (IOException ex) {
+                errorHandler.accept(ex);
+            } finally {
+                shutdown();
             }
-        };
+        });
         reader.setDaemon(true);
         reader.start();
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ClassTracker.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ClassTracker.java	Fri Dec 16 11:58:18 2016 -0800
@@ -126,6 +126,6 @@
 
     // Lookup the ClassInfo by class name, create if it does not exist.
     ClassInfo get(String className) {
-        return map.computeIfAbsent(className, k -> new ClassInfo(k));
+        return map.computeIfAbsent(className, ClassInfo::new);
     }
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Corraller.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Corraller.java	Fri Dec 16 11:58:18 2016 -0800
@@ -149,8 +149,7 @@
             }
             JCNewClass exp = make.NewClass(null,
                     null, expClass, List.of(make.Literal(keyIndex)), null);
-            resolutionExceptionBlock = make.Block(0L, List.<JCStatement>of(
-                    make.Throw(exp)));
+            resolutionExceptionBlock = make.Block(0L, List.of(make.Throw(exp)));
         }
         return resolutionExceptionBlock;
     }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/DiagList.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/DiagList.java	Fri Dec 16 11:58:18 2016 -0800
@@ -72,7 +72,7 @@
 
     @Override
     public boolean addAll(Collection<? extends Diag> c) {
-        return c.stream().filter(d -> add(d)).count() > 0;
+        return c.stream().filter(this::add).count() > 0;
     }
 
     @Override
@@ -110,7 +110,7 @@
                     Snippet snn = d.snippetOrNull();
                     return snn == u.snippet();
                 })
-                .collect(Collectors.toCollection(() -> new DiagList()));
+                .collect(Collectors.toCollection(DiagList::new));
     }
 
     boolean hasErrors() {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Fri Dec 16 11:58:18 2016 -0800
@@ -635,7 +635,7 @@
         while (true) {
             state.debug(DBG_GEN, "compileAndLoad  %s\n", ins);
 
-            ins.stream().forEach(u -> u.initialize());
+            ins.stream().forEach(Unit::initialize);
             ins.stream().forEach(u -> u.setWrap(ins, ins));
             AnalyzeTask at = state.taskFactory.new AnalyzeTask(outerWrapSet(ins));
             ins.stream().forEach(u -> u.setDiagnostics(at));
@@ -654,7 +654,7 @@
             boolean success;
             while (true) {
                 List<Unit> legit = ins.stream()
-                        .filter(u -> u.isDefined())
+                        .filter(Unit::isDefined)
                         .collect(toList());
                 state.debug(DBG_GEN, "compileAndLoad ins = %s -- legit = %s\n",
                         ins, legit);
@@ -693,7 +693,7 @@
                     // loop by replacing all that have been replaced
                     if (!toReplace.isEmpty()) {
                         replaced.addAll(toReplace);
-                        replaced.stream().forEach(u -> u.markForReplacement());
+                        replaced.stream().forEach(Unit::markForReplacement);
                     }
 
                     success = toReplace.isEmpty();
@@ -703,7 +703,7 @@
 
             // add any new dependencies to the working set
             List<Unit> newDependencies = ins.stream()
-                    .flatMap(u -> u.effectedDependents())
+                    .flatMap(Unit::effectedDependents)
                     .collect(toList());
             state.debug(DBG_GEN, "compileAndLoad %s -- deps: %s  success: %s\n",
                     ins, newDependencies, success);
@@ -711,7 +711,7 @@
                 // all classes that could not be directly loaded (because they
                 // are new) have been redefined, and no new dependnencies were
                 // identified
-                ins.stream().forEach(u -> u.finish());
+                ins.stream().forEach(Unit::finish);
                 return ins;
             }
         }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Fri Dec 16 11:58:18 2016 -0800
@@ -235,8 +235,8 @@
                             // malformed declaration, return error
                             pos = token.pos;
                             List<JCTree> err = isVoid
-                                    ? List.<JCTree>of(toP(F.at(pos).MethodDef(mods, name, t, typarams,
-                                                            List.<JCVariableDecl>nil(), List.<JCExpression>nil(), null, null)))
+                                    ? List.of(toP(F.at(pos).MethodDef(mods, name, t, typarams,
+                                                            List.nil(), List.nil(), null, null)))
                                     : null;
                             return List.<JCTree>of(syntaxError(token.pos, err, "expected", LPAREN));
                         }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -64,6 +64,7 @@
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import java.util.function.Predicate;
 
 import javax.lang.model.element.Element;
@@ -280,7 +281,7 @@
         String requiredPrefix = identifier;
         return computeSuggestions(codeWrap, cursor, anchor).stream()
                 .filter(s -> s.continuation().startsWith(requiredPrefix) && !s.continuation().equals(REPL_DOESNOTMATTER_CLASS_NAME))
-                .sorted(Comparator.comparing(s -> s.continuation()))
+                .sorted(Comparator.comparing(Suggestion::continuation))
                 .collect(collectingAndThen(toList(), Collections::unmodifiableList));
     }
 
@@ -509,7 +510,7 @@
     @Override
     public List<SnippetWrapper> wrappers(String input) {
         return proc.eval.sourceToSnippetsWithWrappers(input).stream()
-                .map(sn -> wrapper(sn))
+                .map(this::wrapper)
                 .collect(toList());
     }
 
@@ -637,7 +638,7 @@
         return IS_STATIC.or(IS_CLASS).or(IS_INTERFACE).negate().test(el) ||
                 IS_PACKAGE.test(encl);
     };
-    private final Function<Element, Iterable<? extends Element>> IDENTITY = el -> Collections.singletonList(el);
+    private final Function<Element, Iterable<? extends Element>> IDENTITY = Collections::singletonList;
     private final Function<Boolean, String> DEFAULT_PAREN = hasParams -> hasParams ? "(" : "()";
     private final Function<Boolean, String> NO_PAREN = hasParams -> "";
 
@@ -831,7 +832,7 @@
         };
         @SuppressWarnings("unchecked")
         List<Element> result = Util.stream(scopeIterable)
-                             .flatMap(s -> localElements(s))
+                             .flatMap(this::localElements)
                              .flatMap(el -> Util.stream((Iterable<Element>)elementConvertor.apply(el)))
                              .collect(toCollection(ArrayList :: new));
         result.addAll(listPackages(at, ""));
@@ -1118,7 +1119,7 @@
         }
 
         if (guessKind(code) == Kind.IMPORT)
-            return Collections.<Documentation>emptyList();
+            return Collections.emptyList();
 
         OuterWrap codeWrap = proc.outerMap.wrapInTrialClass(Wrap.methodWrap(code));
         AnalyzeTask at = proc.taskFactory.new AnalyzeTask(codeWrap, keepParameterNames);
@@ -1127,7 +1128,7 @@
         TreePath tp = pathFor(topLevel, sp, codeWrap.snippetIndexToWrapIndex(cursor));
 
         if (tp == null)
-            return Collections.<Documentation>emptyList();
+            return Collections.emptyList();
 
         TreePath prevPath = null;
         while (tp != null && tp.getLeaf().getKind() != Kind.METHOD_INVOCATION &&
@@ -1138,7 +1139,7 @@
         }
 
         if (tp == null)
-            return Collections.<Documentation>emptyList();
+            return Collections.emptyList();
 
         Stream<Element> elements;
         Iterable<Pair<ExecutableElement, ExecutableType>> candidates;
@@ -1174,19 +1175,19 @@
                 el.asType().getKind() == TypeKind.ERROR ||
                 (el.getKind() == ElementKind.PACKAGE && el.getEnclosedElements().isEmpty())) {
                 //erroneous element:
-                return Collections.<Documentation>emptyList();
+                return Collections.emptyList();
             }
 
             elements = Stream.of(el);
         } else {
-            return Collections.<Documentation>emptyList();
+            return Collections.emptyList();
         }
 
         List<Documentation> result = Collections.emptyList();
 
         try (JavadocHelper helper = JavadocHelper.create(at.task, findSources())) {
             result = elements.map(el -> constructDocumentation(at, helper, el, computeJavadoc))
-                             .filter(r -> r != null)
+                             .filter(Objects::nonNull)
                              .collect(Collectors.toList());
         } catch (IOException ex) {
             proc.debug(ex, "JavadocHelper.close()");
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java	Fri Dec 16 11:58:18 2016 -0800
@@ -168,11 +168,11 @@
             // Snippets to add to imports
             Collection<Snippet> plus = plusUnfiltered.stream()
                     .filter(u -> !units.contains(u))
-                    .map(u -> u.snippet())
+                    .map(Unit::snippet)
                     .collect(toList());
             // Snippets to wrap in an outer
             List<Snippet> snippets = units.stream()
-                    .map(u -> u.snippet())
+                    .map(Unit::snippet)
                     .collect(toList());
             // Snippet wraps to wrap in an outer
             List<Wrap> wraps = units.stream()
@@ -305,8 +305,8 @@
             return true;
         }
         ClassBytecodes[] cbcs = toRedefine.stream()
-                .map(ci -> ci.toClassBytecodes())
-                .toArray(size -> new ClassBytecodes[size]);
+                .map(ClassInfo::toClassBytecodes)
+                .toArray(ClassBytecodes[]::new);
         try {
             state.executionControl().redefine(cbcs);
             state.classTracker.markLoaded(cbcs);
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java	Fri Dec 16 11:58:18 2016 -0800
@@ -359,7 +359,7 @@
 
         @Override
         public String toString() {
-            return "CompoundWrap(" + Arrays.stream(os).map(u -> u.toString()).collect(joining(",")) + ")";
+            return "CompoundWrap(" + Arrays.stream(os).map(Object::toString).collect(joining(",")) + ")";
         }
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -65,7 +65,7 @@
         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));
+        input.put("in", System::setIn);
         forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input);
     }
 
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java	Fri Dec 16 11:58:18 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4927552 8026567 8071982
+ * @bug      4927552 8026567 8071982 8162674
  * @summary  <DESC>
  * @author   jamieh
  * @library  ../lib
@@ -79,14 +79,138 @@
                 "<pre>@Deprecated\n"
                 + "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n"
                 + "extends java.lang.Object</pre>",
-                "<pre>@Deprecated\n"
+                "<pre>@Deprecated(forRemoval=true)\n"
                 + "public&nbsp;int field</pre>\n"
-                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>",
-                "<pre>@Deprecated\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;</div>",
+                "<pre>@Deprecated(forRemoval=true)\n"
                 + "public&nbsp;DeprecatedClassByAnnotation()</pre>\n"
-                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>",
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;</div>",
                 "<pre>@Deprecated\n"
                 + "public&nbsp;void&nbsp;method()</pre>\n"
                 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>");
+
+        checkOutput("pkg/TestAnnotationType.html", true,
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n"
+                + "</div>\n"
+                + "<br>\n"
+                + "<pre>@Deprecated(forRemoval=true)\n"
+                + "@Documented\n"
+                + "public @interface <span class=\"memberNameLabel\">TestAnnotationType</span></pre>",
+                "<pre>@Deprecated(forRemoval=true)\n"
+                + "static final&nbsp;int&nbsp;field</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This "
+                + "API element is subject to removal in a future version. </span>&nbsp;<span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
+                "<pre>@Deprecated(forRemoval=true)\n"
+                + "int&nbsp;required</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;"
+                + "<span class=\"deprecationComment\">annotation_test3 passes.</span></div>",
+                "<pre>java.lang.String&nbsp;optional</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;<span class=\"deprecationComment\">annotation_test2 passes.</span></div>");
+
+        checkOutput("pkg/TestClass.html", true,
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n"
+                + "</div>\n"
+                + "<br>\n"
+                + "<pre>@Deprecated(forRemoval=true)\n"
+                + "public class <span class=\"typeNameLabel\">TestClass</span>\n"
+                + "extends java.lang.Object</pre>",
+                "<pre>@Deprecated(forRemoval=true)\n"
+                + "public&nbsp;TestClass()</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;"
+                + "<span class=\"deprecationComment\">class_test3 passes.</span></div>");
+
+        checkOutput("pkg/TestEnum.html", true,
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n"
+                + "</div>\n"
+                + "<br>\n"
+                + "<pre>@Deprecated(forRemoval=true)\n"
+                + "public enum <span class=\"typeNameLabel\">TestEnum</span>\n"
+                + "extends java.lang.Enum&lt;<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>&gt;</pre>",
+                "<pre>@Deprecated(forRemoval=true)\n"
+                + "public static final&nbsp;<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;"
+                + "<span class=\"deprecationComment\">enum_test3 passes.</span></div>");
+
+        checkOutput("pkg/TestError.html", true,
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n"
+                + "</div>\n"
+                + "<br>\n"
+                + "<pre>@Deprecated(forRemoval=true)\n"
+                + "public class <span class=\"typeNameLabel\">TestError</span>\n"
+                + "extends java.lang.Error</pre>");
+
+        checkOutput("pkg/TestException.html", true,
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n"
+                + "</div>\n"
+                + "<br>\n"
+                + "<pre>@Deprecated(forRemoval=true)\n"
+                + "public class <span class=\"typeNameLabel\">TestException</span>\n"
+                + "extends java.lang.Exception</pre>");
+
+        checkOutput("pkg/TestInterface.html", true,
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n"
+                + "</div>\n"
+                + "<br>\n"
+                + "<pre>@Deprecated(forRemoval=true)\n"
+                + "public class <span class=\"typeNameLabel\">TestInterface</span>\n"
+                + "extends java.lang.Object</pre>");
+
+        checkOutput("deprecated-list.html", true,
+                "<ul>\n"
+                + "<li><a href=\"#forRemoval\">Deprecated For Removal</a></li>\n"
+                + "<li><a href=\"#class\">Deprecated Classes</a></li>\n"
+                + "<li><a href=\"#enum\">Deprecated Enums</a></li>\n"
+                + "<li><a href=\"#exception\">Deprecated Exceptions</a></li>\n"
+                + "<li><a href=\"#error\">Deprecated Errors</a></li>\n"
+                + "<li><a href=\"#annotation.type\">Deprecated Annotation Types</a></li>\n"
+                + "<li><a href=\"#field\">Deprecated Fields</a></li>\n"
+                + "<li><a href=\"#method\">Deprecated Methods</a></li>\n"
+                + "<li><a href=\"#constructor\">Deprecated Constructors</a></li>\n"
+                + "<li><a href=\"#enum.constant\">Deprecated Enum Constants</a></li>\n"
+                + "<li><a href=\"#annotation.type.member\">Deprecated Annotation Type Elements</a></li>\n"
+                + "</ul>",
+                "<a name=\"forRemoval\">",
+                "<table class=\"deprecatedSummary\" summary=\"Deprecated For Removal table, listing deprecated for removal, and an explanation\">\n"
+                + "<caption><span>Deprecated For Removal</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Element</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>",
+                "<table class=\"deprecatedSummary\" summary=\"Deprecated Enums table, listing deprecated enums, and an explanation\">\n"
+                + "<caption><span>Deprecated Enums</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Enum</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"pkg/TestEnum.html\" title=\"enum in pkg\">pkg.TestEnum</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n"
+                + "</td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>",
+                "<table class=\"deprecatedSummary\" summary=\"Deprecated Exceptions table, listing deprecated exceptions, and an explanation\">\n"
+                + "<caption><span>Deprecated Exceptions</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Exceptions</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"pkg/TestException.html\" title=\"class in pkg\">pkg.TestException</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n"
+                + "</td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>");
     }
 }
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/DeprecatedClassByAnnotation.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/DeprecatedClassByAnnotation.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,10 +26,10 @@
 @Deprecated()
 public class DeprecatedClassByAnnotation {
 
-    @Deprecated()
+    @Deprecated(forRemoval=true)
     public int field;
 
-    @Deprecated()
+    @Deprecated(forRemoval=true)
     public DeprecatedClassByAnnotation() {}
 
     @Deprecated()
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestAnnotationType.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestAnnotationType.java	Fri Dec 16 11:58:18 2016 -0800
@@ -28,6 +28,7 @@
 /**
  * @deprecated annotation_test1 passes.
  */
+@Deprecated(forRemoval=true)
 @Documented public @interface TestAnnotationType {
 
     /**
@@ -38,10 +39,12 @@
    /**
      * @deprecated annotation_test3 passes.
      */
+    @Deprecated(forRemoval=true)
     int required();
 
     /**
      * @deprecated annotation_test4 passes.
      */
+    @Deprecated(forRemoval=true)
     int field = 0;
 }
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,6 +26,7 @@
 /**
  * @deprecated class_test1 passes.
  */
+@Deprecated(forRemoval=true)
 public class TestClass {
 
     /**
@@ -36,6 +37,7 @@
     /**
      * @deprecated class_test3 passes.
      */
+    @Deprecated(forRemoval=true)
     public TestClass() {}
 
     /**
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestEnum.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestEnum.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,10 +26,17 @@
 /**
  * @deprecated enum_test1 passes.
  */
+@Deprecated(forRemoval=true)
 public enum TestEnum {
 
     /**
      * @deprecated enum_test2 passes.
      */
-    ONE, TWO, THREE;
+    ONE, TWO, THREE,
+
+    /**
+     * @deprecated enum_test3 passes.
+     */
+    @Deprecated(forRemoval=true)
+    FOR_REMOVAL;
 }
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestError.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestError.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,6 +26,7 @@
 /**
  * @deprecated error_test1 passes.
  */
+@Deprecated(forRemoval=true)
 public class TestError extends Error {
 
     /**
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestException.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestException.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,6 +26,7 @@
 /**
  * @deprecated exception_test1 passes.
  */
+@Deprecated(forRemoval=true)
 public class TestException extends Exception {
 
     /**
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestInterface.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestInterface.java	Fri Dec 16 11:58:18 2016 -0800
@@ -30,6 +30,7 @@
 /**
  * @deprecated interface_test1 passes.
  */
+@Deprecated(forRemoval=true)
 public class TestInterface {
 
     /**
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Fri Dec 16 11:58:18 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688
+ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -45,8 +45,8 @@
     void testHtml4() {
         javadoc("-d", "out", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "module1,module2",
-                "testpkgmdl1", "testpkgmdl2");
+                "--module", "moduleA,moduleB",
+                "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkDescription(true);
         checkNoDescription(false);
@@ -66,8 +66,8 @@
     void testHtml5() {
         javadoc("-d", "out-html5", "-html5", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "module1,module2",
-                "testpkgmdl1", "testpkgmdl2");
+                "--module", "moduleA,moduleB",
+                "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkHtml5Description(true);
         checkHtml5NoDescription(false);
@@ -87,8 +87,8 @@
     void testHtml4NoComment() {
         javadoc("-d", "out-nocomment", "-nocomment", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "module1,module2",
-                "testpkgmdl1", "testpkgmdl2");
+                "--module", "moduleA,moduleB",
+                "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkDescription(false);
         checkNoDescription(true);
@@ -104,8 +104,8 @@
     void testHtml5NoComment() {
         javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "module1,module2",
-                "testpkgmdl1", "testpkgmdl2");
+                "--module", "moduleA,moduleB",
+                "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkHtml5Description(false);
         checkHtml5NoDescription(true);
@@ -154,8 +154,8 @@
                 "-tag", "regular:a:Regular Tag:",
                 "-tag", "moduletag:s:Module Tag:",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduletags,module2",
-                "testpkgmdltags", "testpkgmdl2");
+                "--module", "moduletags,moduleB",
+                "testpkgmdltags", "testpkgmdlB");
         checkExit(Exit.OK);
         checkModuleTags();
     }
@@ -167,8 +167,8 @@
     void testModuleSummary() {
         javadoc("-d", "out-moduleSummary", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "module1,module2",
-                "testpkgmdl1", "testpkgmdl2", "module2/testpkg2mdl2");
+                "--module", "moduleA,moduleB",
+                "testpkgmdlA", "testpkgmdlB", "moduleB/testpkg2mdlB");
         checkExit(Exit.OK);
         checkModuleSummary();
         checkNegatedModuleSummary();
@@ -181,8 +181,8 @@
     void testModuleFilesAndLinks() {
         javadoc("-d", "out-modulelinks",
                 "--module-source-path", testSrc,
-                "--add-modules", "module1",
-                "testpkgmdl1");
+                "--module", "moduleA",
+                "testpkgmdlA");
         checkExit(Exit.OK);
         checkModuleFilesAndLinks(true);
         checkNegatedOverviewFrame();
@@ -197,8 +197,8 @@
                 "-tag", "regular:a:Regular Tag:",
                 "-tag", "moduletag:s:Module Tag:",
                 "--module-source-path", testSrc,
-                "--module", "module1,module2,moduletags",
-                "testpkgmdl1", "testpkgmdl2", "testpkgmdltags");
+                "--module", "moduleA,moduleB,moduletags",
+                "testpkgmdlA", "testpkgmdlB", "testpkgmdltags");
         checkExit(Exit.OK);
         checkModuleDeprecation(true);
     }
@@ -210,100 +210,135 @@
     void testModuleAnnotation() {
         javadoc("-d", "out-moduleanno",
                 "--module-source-path", testSrc,
-                "--module", "module1,module2",
-                "testpkgmdl1", "testpkgmdl2");
+                "--module", "moduleA,moduleB",
+                "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkModuleAnnotation();
     }
 
+    /**
+     * Test module summary pages in "api" mode.
+     */
+    @Test
+    void testApiMode() {
+        javadoc("-d", "out-api", "-use", "--show-module-contents=api", "-author", "-version",
+                "-tag", "regular:a:Regular Tag:",
+                "-tag", "moduletag:s:Module Tag:",
+                "--module-source-path", testSrc,
+                "--module", "moduleA,moduleB,moduleC,moduletags",
+                "testpkgmdlA", "moduleA/concealedpkgmdlA", "testpkgmdlB", "testpkg2mdlB", "testpkgmdlC", "testpkgmdltags");
+        checkExit(Exit.OK);
+        checkModuleModeCommon();
+        checkModuleModeApi(true);
+        checkModuleModeAll(false);
+    }
+
+    /**
+     * Test module summary pages in "all" mode.
+     */
+    @Test
+    void testAllMode() {
+        javadoc("-d", "out-all", "-use", "--show-module-contents=all", "-author", "-version",
+                "-tag", "regular:a:Regular Tag:",
+                "-tag", "moduletag:s:Module Tag:",
+                "--module-source-path", testSrc,
+                "--module", "moduleA,moduleB,moduleC,moduletags",
+                "testpkgmdlA", "moduleA/concealedpkgmdlA", "testpkgmdlB", "testpkg2mdlB", "testpkgmdlC", "testpkgmdltags");
+        checkExit(Exit.OK);
+        checkModuleModeCommon();
+        checkModuleModeApi(false);
+        checkModuleModeAll(true);
+    }
+
     void checkDescription(boolean found) {
-        checkOutput("module1-summary.html", found,
+        checkOutput("moduleA-summary.html", found,
                 "<!-- ============ MODULE DESCRIPTION =========== -->\n"
                 + "<a name=\"module.description\">\n"
                 + "<!--   -->\n"
                 + "</a>\n"
-                + "<div class=\"block\">This is a test description for the module1 module. Search "
+                + "<div class=\"block\">This is a test description for the moduleA module. Search "
                 + "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
-        checkOutput("module2-summary.html", found,
+        checkOutput("moduleB-summary.html", found,
                 "<!-- ============ MODULE DESCRIPTION =========== -->\n"
                 + "<a name=\"module.description\">\n"
                 + "<!--   -->\n"
                 + "</a>\n"
-                + "<div class=\"block\">This is a test description for the module2 module. Search "
+                + "<div class=\"block\">This is a test description for the moduleB module. Search "
                 + "word <a id=\"search_word\">search_word</a> with no description.</div>");
     }
 
     void checkNoDescription(boolean found) {
-        checkOutput("module1-summary.html", found,
-                "<div class=\"contentContainer\">\n"
-                + "<ul class=\"blockList\">\n"
-                + "<li class=\"blockList\">\n"
-                + "<ul class=\"blockList\">\n"
-                + "<li class=\"blockList\">\n"
-                + "<!-- ============ MODULES SUMMARY =========== -->");
-        checkOutput("module2-summary.html", found,
+        checkOutput("moduleA-summary.html", found,
                 "<div class=\"contentContainer\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
                 + "<!-- ============ MODULES SUMMARY =========== -->");
+        checkOutput("moduleB-summary.html", found,
+                "<div class=\"contentContainer\">\n"
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<!-- ============ PACKAGES SUMMARY =========== -->");
     }
 
     void checkHtml5Description(boolean found) {
-        checkOutput("module1-summary.html", found,
+        checkOutput("moduleA-summary.html", found,
                 "<section role=\"region\">\n"
-                + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+                + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+                + " This API element is subject to removal in a future version. </span>\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
                 + "</div>\n"
                 + "<!-- ============ MODULE DESCRIPTION =========== -->\n"
                 + "<a id=\"module.description\">\n"
                 + "<!--   -->\n"
                 + "</a>\n"
-                + "<div class=\"block\">This is a test description for the module1 module. Search "
+                + "<div class=\"block\">This is a test description for the moduleA module. Search "
                 + "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
-        checkOutput("module2-summary.html", found,
+        checkOutput("moduleB-summary.html", found,
                 "<section role=\"region\">\n"
                 + "<!-- ============ MODULE DESCRIPTION =========== -->\n"
                 + "<a id=\"module.description\">\n"
                 + "<!--   -->\n"
                 + "</a>\n"
-                + "<div class=\"block\">This is a test description for the module2 module. Search "
+                + "<div class=\"block\">This is a test description for the moduleB module. Search "
                 + "word <a id=\"search_word\">search_word</a> with no description.</div>");
     }
 
     void checkHtml5NoDescription(boolean found) {
-        checkOutput("module1-summary.html", found,
+        checkOutput("moduleA-summary.html", found,
                 "<div class=\"contentContainer\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
                 + "<!-- ============ MODULES SUMMARY =========== -->");
-        checkOutput("module2-summary.html", found,
+        checkOutput("moduleB-summary.html", found,
                 "<div class=\"contentContainer\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
-                + "<!-- ============ MODULES SUMMARY =========== -->");
+                + "<!-- ============ PACKAGES SUMMARY =========== -->");
     }
 
     void checkModuleLink() {
         checkOutput("overview-summary.html", true,
                 "<li>Module</li>");
-        checkOutput("module1-summary.html", true,
+        checkOutput("moduleA-summary.html", true,
                 "<li class=\"navBarCell1Rev\">Module</li>");
-        checkOutput("module2-summary.html", true,
+        checkOutput("moduleB-summary.html", true,
                 "<li class=\"navBarCell1Rev\">Module</li>");
-        checkOutput("testpkgmdl1/class-use/TestClassInModule1.html", true,
-                "<li><a href=\"../../module1-summary.html\">Module</a></li>");
-        checkOutput("testpkgmdl2/package-summary.html", true,
-                "<li><a href=\"../module2-summary.html\">Module</a></li>");
-        checkOutput("testpkgmdl2/TestClassInModule2.html", true,
-                "<li><a href=\"../module2-summary.html\">Module</a></li>");
-        checkOutput("testpkgmdl2/class-use/TestClassInModule2.html", true,
-                "<li><a href=\"../../module2-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdlA/class-use/TestClassInModuleA.html", true,
+                "<li><a href=\"../../moduleA-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdlB/package-summary.html", true,
+                "<li><a href=\"../moduleB-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdlB/TestClassInModuleB.html", true,
+                "<li><a href=\"../moduleB-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdlB/class-use/TestClassInModuleB.html", true,
+                "<li><a href=\"../../moduleB-summary.html\">Module</a></li>");
     }
 
     void checkNoModuleLink() {
@@ -321,30 +356,22 @@
     void checkModuleTags() {
         checkOutput("moduletags-summary.html", true,
                 "Type Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in "
-                + "testpkgmdltags\"><code>TestClassInModuleTags</code></a>.");
-        checkOutput("moduletags-summary.html", true,
+                + "testpkgmdltags\"><code>TestClassInModuleTags</code></a>.",
                 "Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#"
-                + "testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.");
-        checkOutput("moduletags-summary.html", true,
-                "Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.");
-        checkOutput("moduletags-summary.html", true,
+                + "testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.",
+                "Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.",
                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
-                + "<dd>JDK 9</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>JDK 9</dd>",
                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
                 + "<dd>\"Test see tag\", \n"
                 + "<a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>"
-                + "TestClassInModuleTags</code></a></dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "TestClassInModuleTags</code></a></dd>",
                 "<dt><span class=\"simpleTagLabel\">Regular Tag:</span></dt>\n"
-                + "<dd>Just a regular simple tag.</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>Just a regular simple tag.</dd>",
                 "<dt><span class=\"simpleTagLabel\">Module Tag:</span></dt>\n"
-                + "<dd>Just a simple module tag.</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>Just a simple module tag.</dd>",
                 "<dt><span class=\"simpleTagLabel\">Version:</span></dt>\n"
-                + "<dd>1.0</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>1.0</dd>",
                 "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n"
                 + "<dd>Bhavesh Patel</dd>");
         checkOutput("testpkgmdltags/TestClassInModuleTags.html", false,
@@ -421,102 +448,70 @@
     }
 
     void checkModuleSummary() {
-        checkOutput("module1-summary.html", true,
+        checkOutput("moduleA-summary.html", true,
                 "<ul class=\"subNavList\">\n"
                 + "<li>Module:&nbsp;</li>\n"
                 + "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a "
                 + "href=\"#modules.summary\">Modules</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">"
                 + "Packages</a>&nbsp;|&nbsp;Services</li>\n"
-                + "</ul>");
-        checkOutput("module1-summary.html", true,
-                "<!-- ============ MODULES SUMMARY =========== -->\n"
-                + "<a name=\"modules.summary\">\n"
-                + "<!--   -->\n"
-                + "</a>");
-        checkOutput("module1-summary.html", true,
-                "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdl1/package-summary.html\">testpkgmdl1</a></th>\n"
-                + "<td class=\"colSecond\">All Modules</td>\n"
-                + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("module1-summary.html", true,
-                "<!-- ============ PACKAGES SUMMARY =========== -->\n"
-                + "<a name=\"packages.summary\">\n"
-                + "<!--   -->\n"
-                + "</a>");
-        checkOutput("module1-summary.html", true,
-                "<tr class=\"rowColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"module2-summary.html\">module2</a></th>\n"
-                + "<td class=\"colLast\">\n"
-                + "<div class=\"block\">This is a test description for the module2 module.</div>\n"
-                + "</td>\n"
-                + "</tr>");
-        checkOutput("module2-summary.html", true,
-                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a "
-                + "href=\"#modules.summary\">Modules</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">"
-                + "Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">Services</a></li>");
-        checkOutput("module2-summary.html", true,
+                + "</ul>",
                 "<!-- ============ MODULES SUMMARY =========== -->\n"
                 + "<a name=\"modules.summary\">\n"
                 + "<!--   -->\n"
-                + "</a>");
-        checkOutput("module2-summary.html", true,
-                "<tr class=\"rowColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdl2/package-summary.html\">"
-                + "testpkg2mdl2</a></th>\n"
-                + "<td class=\"colSecond\">module1</td>\n"
+                + "</a>",
+                "<tr class=\"altColor\" id=\"i0\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlA/package-summary.html\">testpkgmdlA</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("module2-summary.html", true,
+                + "</tr>",
                 "<!-- ============ PACKAGES SUMMARY =========== -->\n"
                 + "<a name=\"packages.summary\">\n"
                 + "<!--   -->\n"
-                + "</a>");
-        checkOutput("module2-summary.html", true,
+                + "</a>",
                 "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"java.base-summary.html\">java.base</a></th>\n"
+                + "<td class=\"colFirst\">transitive</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+                + "</td>\n"
+                + "</tr>");
+        checkOutput("moduleB-summary.html", true,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;Modules&nbsp;|&nbsp;"
+                + "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">"
+                + "Services</a></li>",
+                "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+                + "<a name=\"packages.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>",
+                "<tr class=\"altColor\" id=\"i0\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("module2-summary.html", true,
+                + "</tr>",
+                "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+                + "<a name=\"packages.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>",
                 "<!-- ============ SERVICES SUMMARY =========== -->\n"
                 + "<a name=\"services.summary\">\n"
                 + "<!--   -->\n"
-                + "</a>");
-        checkOutput("module2-summary.html", true,
-                "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdl2/TestClassInModule2.html\" "
-                + "title=\"class in testpkgmdl2\">TestClassInModule2</a></th>\n"
-                + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("module2-summary.html", true,
+                + "</a>",
                 "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdl2/TestInterfaceInModule2.html\" "
-                + "title=\"interface in testpkg2mdl2\">TestInterfaceInModule2</a><br>"
-                + "(<span class=\"implementationLabel\">Implementation:</span>&nbsp;"
-                + "<a href=\"testpkgmdl2/TestClassInModule2.html\" title=\"class in testpkgmdl2\">"
-                + "TestClassInModule2</a>)</th>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
+                + "<td class=\"colLast\">With a test description for uses.&nbsp;</td>\n"
+                + "</tr>",
+                "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterface2InModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterface2InModuleB</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr");
-        checkOutput("module2-summary.html", true,
-                "<caption><span>Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "</tr>",
+                "<caption><span>Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
-                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
-                + "</tr>");
-        checkOutput("module2-summary.html", true,
-                "<caption><span>Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
-                + "<tr>\n"
-                + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
-                + "</tr>");
-        checkOutput("module2-summary.html", true,
+                + "</tr>",
                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Type</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
-                + "</tr>");
-        checkOutput("module2-summary.html", true,
+                + "</tr>",
                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Type</th>\n"
@@ -525,7 +520,7 @@
     }
 
     void checkNegatedModuleSummary() {
-        checkOutput("module1-summary.html", false,
+        checkOutput("moduleA-summary.html", false,
                 "<!-- ============ SERVICES SUMMARY =========== -->\n"
                 + "<a name=\"services.summary\">\n"
                 + "<!--   -->\n"
@@ -534,13 +529,12 @@
 
     void checkModuleClickThroughLinks() {
         checkOutput("module-overview-frame.html", true,
-                "<li><a href=\"module1-frame.html\" target=\"packageListFrame\" "
-                + "onclick=\"updateModuleFrame('module1-type-frame.html','module1-summary.html');"
-                + "\">module1</a></li>");
-        checkOutput("module-overview-frame.html", true,
-                "<li><a href=\"module2-frame.html\" target=\"packageListFrame\" "
-                + "onclick=\"updateModuleFrame('module2-type-frame.html','module2-summary.html');"
-                + "\">module2</a></li>");
+                "<li><a href=\"moduleA-frame.html\" target=\"packageListFrame\" "
+                + "onclick=\"updateModuleFrame('moduleA-type-frame.html','moduleA-summary.html');"
+                + "\">moduleA</a></li>",
+                "<li><a href=\"moduleB-frame.html\" target=\"packageListFrame\" "
+                + "onclick=\"updateModuleFrame('moduleB-type-frame.html','moduleB-summary.html');"
+                + "\">moduleB</a></li>");
         checkOutput("script.js", true,
                 "function updateModuleFrame(pFrame, cFrame)\n"
                 + "{\n"
@@ -551,66 +545,234 @@
 
     void checkModuleClickThrough(boolean found) {
         checkFiles(found,
-                "module1-type-frame.html",
-                "module2-type-frame.html");
+                "moduleA-type-frame.html",
+                "moduleB-type-frame.html");
     }
 
     void checkModuleFilesAndLinks(boolean found) {
-        checkOutput("testpkgmdl1/package-summary.html", found,
-                "<li><a href=\"../module1-summary.html\">Module</a></li>");
-        checkOutput("testpkgmdl1/package-summary.html", found,
+        checkOutput("testpkgmdlA/package-summary.html", found,
+                "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
                 "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
-                + "<a href=\"../module1-summary.html\">module1</a></div>");
-        checkOutput("testpkgmdl1/TestClassInModule1.html", found,
-                "<li><a href=\"../module1-summary.html\">Module</a></li>");
-        checkOutput("testpkgmdl1/TestClassInModule1.html", found,
+                + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
+        checkOutput("testpkgmdlA/TestClassInModuleA.html", found,
+                "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
                 "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
-                + "<a href=\"../module1-summary.html\">module1</a></div>");
+                + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
         checkFiles(found,
-                "module1-frame.html",
-                "module1-summary.html",
+                "moduleA-frame.html",
+                "moduleA-summary.html",
                 "module-overview-frame.html");
     }
 
     void checkModulesInSearch(boolean found) {
         checkOutput("index-all.html", found,
                 "<dl>\n"
-                + "<dt><a href=\"module1-summary.html\">module1</a> - module module1</dt>\n"
+                + "<dt><a href=\"moduleA-summary.html\">moduleA</a> - module moduleA</dt>\n"
                 + "<dd>\n"
-                + "<div class=\"block\">This is a test description for the module1 module.</div>\n"
+                + "<div class=\"block\">This is a test description for the moduleA module.</div>\n"
                 + "</dd>\n"
-                + "<dt><a href=\"module2-summary.html\">module2</a> - module module2</dt>\n"
+                + "<dt><a href=\"moduleB-summary.html\">moduleB</a> - module moduleB</dt>\n"
                 + "<dd>\n"
-                + "<div class=\"block\">This is a test description for the module2 module.</div>\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
                 + "</dd>\n"
-                + "</dl>");
-        checkOutput("index-all.html", found,
+                + "</dl>",
                 "<dl>\n"
-                + "<dt><span class=\"searchTagLink\"><a href=\"module1-summary.html#searchphrase\">"
-                + "search phrase</a></span> - Search tag in module1</dt>\n"
+                + "<dt><span class=\"searchTagLink\"><a href=\"moduleA-summary.html#searchphrase\">"
+                + "search phrase</a></span> - Search tag in moduleA</dt>\n"
                 + "<dd>with description</dd>\n"
-                + "<dt><span class=\"searchTagLink\"><a href=\"module2-summary.html#search_word\">"
-                + "search_word</a></span> - Search tag in module2</dt>\n"
+                + "<dt><span class=\"searchTagLink\"><a href=\"moduleB-summary.html#search_word\">"
+                + "search_word</a></span> - Search tag in moduleB</dt>\n"
                 + "<dd>&nbsp;</dd>\n"
                 + "</dl>");
 }
 
+    void checkModuleModeCommon() {
+        checkOutput("overview-summary.html", true,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleA module.</div>\n"
+                + "</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+                + "</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduletags-summary.html\">moduletags</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleA module.<br>\n"
+                + " Type Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>TestClassInModuleTags</code></a>.<br>\n"
+                + " Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.<br>\n"
+                + " Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.<br></div>\n"
+                + "</td>");
+        checkOutput("moduleA-summary.html", true,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a href=\"#modules.summary\">"
+                + "Modules</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;Services</li>",
+                "<td class=\"colFirst\">transitive</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+                + "</td>",
+                "<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>");
+        checkOutput("moduleB-summary.html", true,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
+                + "<td class=\"colLast\">With a test description for uses.&nbsp;</td>");
+        checkOutput("moduletags-summary.html", true,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a href=\"#modules.summary\">Modules"
+                + "</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;Services</li>",
+                "<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
+                + "<caption><span>Additional Modules Required</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<td class=\"colFirst\">transitive</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+                + "</td>",
+                "<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<td class=\"colFirst\">transitive static</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleA module.</div>\n"
+                + "</td>",
+                "<table class=\"requiresSummary\" summary=\"Requires table, listing modules, and an explanation\">\n"
+                + "<caption><span>Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
+                "<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
+                + "<caption><span>Additional Modules Required</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
+                "<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>");
+    }
+
+    void checkModuleModeApi(boolean found) {
+        checkOutput("moduleA-summary.html", found,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlA/package-summary.html\">testpkgmdlA</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+        checkOutput("moduleB-summary.html", found,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;Modules&nbsp;|&nbsp;"
+                + "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">Services</a></li>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<table class=\"packagesSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
+                + "<caption><span>Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\" id=\"i0\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>");
+        checkOutput("moduletags-summary.html", found,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdltags/package-summary.html\">testpkgmdltags</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+    }
+
+    void checkModuleModeAll(boolean found) {
+        checkOutput("moduleA-summary.html", found,
+                "<td class=\"colFirst\"> </td>\n"
+                + "<th class=\"colSecond\" scope=\"row\">java.base</th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<td class=\"colFirst\"> </td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleC-summary.html\">moduleC</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleC module.</div>\n"
+                + "</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleC-summary.html\">moduleC</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlC/package-summary.html\">testpkgmdlC</a></td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlA/package-summary.html\">testpkgmdlA</a></th>\n"
+                + "<td class=\"colSecond\">All Modules</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(1);\">Exported Packages</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(4);\">"
+                + "Concealed Packages</a></span><span class=\"tabEnd\">&nbsp;</span></span></caption>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"concealedpkgmdlA/package-summary.html\">concealedpkgmdlA</a></th>\n"
+                + "<td class=\"colSecond\">None</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+        checkOutput("moduleB-summary.html", found,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a href=\"#modules.summary\">"
+                + "Modules</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">Services</a></li>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+                + "<td class=\"colSecond\">All Modules</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<td class=\"colFirst\"> </td>\n"
+                + "<th class=\"colSecond\" scope=\"row\">java.base</th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClass2InModuleB.html\" title=\"class in testpkgmdlB\">TestClass2InModuleB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterface2InModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterface2InModuleB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"testpkgmdlB/TestClass2InModuleB.html\" "
+                + "title=\"class in testpkgmdlB\">TestClass2InModuleB</a>)</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterfaceInModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterfaceInModuleB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"testpkgmdlB/TestClassInModuleB.html\" "
+                + "title=\"class in testpkgmdlB\">TestClassInModuleB</a>)</td>",
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t1\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:showPkgs(1);\">Exported Packages</a></span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t2\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:showPkgs(2);\">Opened Packages</a></span><span class=\"tabEnd\">&nbsp;</span></span></caption>");
+        checkOutput("moduleC-summary.html", found,
+                "<caption><span>Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>");
+        checkOutput("moduletags-summary.html", found,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdltags/package-summary.html\">testpkgmdltags</a></th>\n"
+                + "<td class=\"colSecond\">All Modules</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+    }
+
     void checkModuleDeprecation(boolean found) {
-        checkOutput("module1-summary.html", found,
-                "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+        checkOutput("moduleA-summary.html", found,
+                "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+                + " This API element is subject to removal in a future version. </span>\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
                 + "</div>");
         checkOutput("deprecated-list.html", found,
                 "<ul>\n"
+                + "<li><a href=\"#forRemoval\">Deprecated For Removal</a></li>\n"
                 + "<li><a href=\"#module\">Deprecated Modules</a></li>\n"
                 + "</ul>",
                 "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"module1-summary.html\">module1</a></th>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
                 + "<td class=\"colLast\">\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
                 + "</td>\n"
                 + "</tr>");
-        checkOutput("module2-summary.html", !found,
+        checkOutput("moduleB-summary.html", !found,
                 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated using just the javadoc tag.</span></div>");
         checkOutput("moduletags-summary.html", found,
@@ -620,11 +782,11 @@
     }
 
     void checkModuleAnnotation() {
-        checkOutput("module2-summary.html", true,
-                "<p><a href=\"testpkgmdl2/AnnotationType.html\" title=\"annotation in testpkgmdl2\">@AnnotationType</a>(<a href=\"testpkgmdl2/AnnotationType.html#optional--\">optional</a>=\"Module Annotation\",\n"
-                + "                <a href=\"testpkgmdl2/AnnotationType.html#required--\">required</a>=2016)\n"
+        checkOutput("moduleB-summary.html", true,
+                "<p><a href=\"testpkgmdlB/AnnotationType.html\" title=\"annotation in testpkgmdlB\">@AnnotationType</a>(<a href=\"testpkgmdlB/AnnotationType.html#optional--\">optional</a>=\"Module Annotation\",\n"
+                + "                <a href=\"testpkgmdlB/AnnotationType.html#required--\">required</a>=2016)\n"
                 + "</p>");
-        checkOutput("module2-summary.html", false,
+        checkOutput("moduleB-summary.html", false,
                 "@AnnotationTypeUndocumented");
 }
 
--- a/langtools/test/jdk/javadoc/doclet/testModules/module1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-/**
-  * This is a test description for the module1 module. Search phrase {@index "search phrase" with description}.
-  *
-  * @deprecated This module is deprecated.
-  */
-@Deprecated
-module module1 {
-    requires module2;
-
-    exports testpkgmdl1;
-}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module1/testpkgmdl1/TestClassInModule1.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * 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 testpkgmdl1;
-
-public class TestClassInModule1 {
-}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-
-/**
-  * This is a test description for the module2 module. Search word {@index search_word} with no description.
-  *
-  * @deprecated This module is deprecated using just the javadoc tag.
-  */
-@testpkgmdl2.AnnotationType(optional="Module Annotation", required=2016)
-@testpkgmdl2.AnnotationTypeUndocumented(optional="Module Annotation", required=2016)
-module module2 {
-    exports testpkgmdl2;
-
-    exports testpkg2mdl2 to module1;
-
-    uses testpkgmdl2.TestClassInModule2;
-
-    provides testpkg2mdl2.TestInterfaceInModule2 with testpkgmdl2.TestClassInModule2;
-}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkg2mdl2/TestInterfaceInModule2.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * 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 testpkg2mdl2;
-
-public interface TestInterfaceInModule2 {
-    void testMethod();
-}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationType.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-package testpkgmdl2;
-
-import java.lang.annotation.*;
-
-/**
- * This is a test annotation type.
- */
-@Documented public @interface AnnotationType {
-
-    /**
-     * The copyright holder.
-     *
-     * @return a string.
-     */
-    String optional() default "unknown";
-
-   /**
-    * The year of the copyright.
-    *
-    * @return an int.
-    */
-    int required();
-}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationTypeUndocumented.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-package testpkgmdl2;
-
-import java.lang.annotation.*;
-
-/**
- * This is a test annotation type this is not documented because it
- * is missing the @Documented tag.
- */
-public @interface AnnotationTypeUndocumented {
-
-    /**
-     * The copyright holder.
-     *
-     * @return a string.
-     */
-    String optional() default "unknown";
-
-   /**
-    * The year of the copyright.
-    *
-    * @return an int.
-    */
-    int required();
-}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/TestClassInModule2.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * 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 testpkgmdl2;
-
-import testpkg2mdl2.TestInterfaceInModule2;
-
-public class TestClassInModule2 implements TestInterfaceInModule2 {
-    void testMethod() {}
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleA/concealedpkgmdlA/ConcealedClassInModuleA.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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 concealedpkgmdlA;
+
+public class ConcealedClassInModuleA {
+    public void testMethodConcealedClass() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+/**
+  * This is a test description for the moduleA module. Search phrase {@index "search phrase" with description}.
+  *
+  * @deprecated This module is deprecated.
+  */
+@Deprecated(forRemoval=true)
+module moduleA {
+    requires transitive moduleB;
+    requires moduleC;
+
+    exports testpkgmdlA;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleA/testpkgmdlA/TestClassInModuleA.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 testpkgmdlA;
+
+public class TestClassInModuleA {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleB/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/**
+  * This is a test description for the moduleB module. Search word {@index search_word} with no description.
+  *
+  * @uses testpkgmdlB.TestClassInModuleB With a test description for uses.
+  * @provides testpkg2mdlB.TestInterface2InModuleB
+  * @deprecated This module is deprecated using just the javadoc tag.
+  */
+@testpkgmdlB.AnnotationType(optional="Module Annotation", required=2016)
+@testpkgmdlB.AnnotationTypeUndocumented(optional="Module Annotation", required=2016)
+module moduleB {
+    opens testpkgmdlB;
+
+    exports testpkg2mdlB to moduleA;
+
+    uses testpkgmdlB.TestClassInModuleB;
+    uses testpkgmdlB.TestClass2InModuleB;
+
+    provides testpkg2mdlB.TestInterfaceInModuleB with testpkgmdlB.TestClassInModuleB;
+    provides testpkg2mdlB.TestInterface2InModuleB with testpkgmdlB.TestClass2InModuleB;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleB/testpkg2mdlB/TestInterface2InModuleB.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,29 @@
+/*
+ * 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 testpkg2mdlB;
+
+public interface TestInterface2InModuleB {
+    void testMethod2();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleB/testpkg2mdlB/TestInterfaceInModuleB.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,29 @@
+/*
+ * 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 testpkg2mdlB;
+
+public interface TestInterfaceInModuleB {
+    void testMethod();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/AnnotationType.java	Fri Dec 16 11:58:18 2016 -0800
@@ -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.
+ */
+
+package testpkgmdlB;
+
+import java.lang.annotation.*;
+
+/**
+ * This is a test annotation type.
+ */
+@Documented public @interface AnnotationType {
+
+    /**
+     * The copyright holder.
+     *
+     * @return a string.
+     */
+    String optional() default "unknown";
+
+   /**
+    * The year of the copyright.
+    *
+    * @return an int.
+    */
+    int required();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/AnnotationTypeUndocumented.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package testpkgmdlB;
+
+import java.lang.annotation.*;
+
+/**
+ * This is a test annotation type this is not documented because it
+ * is missing the @Documented tag.
+ */
+public @interface AnnotationTypeUndocumented {
+
+    /**
+     * The copyright holder.
+     *
+     * @return a string.
+     */
+    String optional() default "unknown";
+
+   /**
+    * The year of the copyright.
+    *
+    * @return an int.
+    */
+    int required();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/TestClass2InModuleB.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,31 @@
+/*
+ * 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 testpkgmdlB;
+
+import testpkg2mdlB.TestInterface2InModuleB;
+
+public class TestClass2InModuleB implements TestInterface2InModuleB {
+    void testMethod2() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/TestClassInModuleB.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,31 @@
+/*
+ * 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 testpkgmdlB;
+
+import testpkg2mdlB.TestInterfaceInModuleB;
+
+public class TestClassInModuleB implements TestInterfaceInModuleB {
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleC/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+/**
+  * This is a test description for the moduleC module.
+  */
+module moduleC {
+
+    exports testpkgmdlC to moduleA;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleC/testpkgmdlC/TestClassInModuleC.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,29 @@
+/*
+ * 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 testpkgmdlC;
+
+public class TestClassInModuleC {
+    public void testMethodClassModuleC() { }
+}
--- a/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -24,7 +24,7 @@
  */
 
 /**
-  * This is a test description for the module1 module.<br>
+  * This is a test description for the moduleA module.<br>
   * Type Link: {@link testpkgmdltags.TestClassInModuleTags}.<br>
   * Member Link: {@link testpkgmdltags.TestClassInModuleTags#testMethod(String)}.<br>
   * Package Link: {@link testpkgmdltags}.<br>
@@ -39,7 +39,7 @@
   */
 @Deprecated
 module moduletags {
-    requires module2;
+    requires transitive static moduleA;
 
     exports testpkgmdltags;
 }
--- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Fri Dec 16 11:58:18 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363
+ * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib
@@ -111,7 +111,7 @@
                 + "    border: none;\n"
                 + "    height:16px;\n"
                 + "}",
-                ".memberSummary caption span.activeTableTab span {\n"
+                ".memberSummary caption span.activeTableTab span, .packagesSummary caption span.activeTableTab span {\n"
                 + "    white-space:nowrap;\n"
                 + "    padding-top:5px;\n"
                 + "    padding-left:12px;\n"
@@ -122,7 +122,7 @@
                 + "    background-color:#F8981D;\n"
                 + "    height:16px;\n"
                 + "}",
-                ".memberSummary caption span.tableTab span {\n"
+                ".memberSummary caption span.tableTab span, .packagesSummary caption span.tableTab span {\n"
                 + "    white-space:nowrap;\n"
                 + "    padding-top:5px;\n"
                 + "    padding-left:12px;\n"
@@ -138,11 +138,10 @@
                 + ".requiresSummary td.colFirst, .requiresSummary th.colFirst,\n"
                 + ".packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,\n"
                 + ".usesSummary td.colFirst, .usesSummary th.colFirst,\n"
-                + ".useSummary td.colFirst, .useSummary th.colFirst,\n"
+                + ".providesSummary td.colFirst, .providesSummary th.colFirst,\n"
                 + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
                 + ".memberSummary td.colSecond, .memberSummary th.colSecond,\n"
                 + ".typeSummary td.colFirst{\n"
-                + "    width:25%;\n"
                 + "    vertical-align:top;\n"
                 + "}",
                 ".overviewSummary td, .memberSummary td, .typeSummary td,\n"
@@ -151,7 +150,8 @@
                 + "    text-align:left;\n"
                 + "    padding:0px 0px 12px 10px;\n"
                 + "}",
-                ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n"
+                ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab,\n"
+                + ".packagesSummary caption span.tableTab, .packagesSummary caption span.activeTableTab {\n"
                 + "    padding-top:0px;\n"
                 + "    padding-left:0px;\n"
                 + "    padding-right:0px;\n"
--- a/langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1183,16 +1183,6 @@
     private static class AbstractAttributeVisitor<T> implements Attribute.Visitor<Void, T> {
 
         @Override
-        public Void visitBootstrapMethods(BootstrapMethods_attribute attr, T p) {
-            return null;
-        }
-
-        @Override
-        public Void visitModulePackages(ModulePackages_attribute attr, T p) {
-            return null;
-        }
-
-        @Override
         public Void visitDefault(DefaultAttribute attr, T p) {
             return null;
         }
@@ -1203,6 +1193,11 @@
         }
 
         @Override
+        public Void visitBootstrapMethods(BootstrapMethods_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
         public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, T p) {
             return null;
         }
@@ -1238,11 +1233,6 @@
         }
 
         @Override
-        public Void visitModuleHashes(ModuleHashes_attribute attr, T p) {
-            return null;
-        }
-
-        @Override
         public Void visitInnerClasses(InnerClasses_attribute attr, T p) {
             return null;
         }
@@ -1263,11 +1253,6 @@
         }
 
         @Override
-        public Void visitModuleMainClass(ModuleMainClass_attribute attr, T p) {
-            return null;
-        }
-
-        @Override
         public Void visitMethodParameters(MethodParameters_attribute attr, T p) {
             return null;
         }
@@ -1278,7 +1263,27 @@
         }
 
         @Override
-        public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, T p) {
+        public Void visitModuleHashes(ModuleHashes_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
+        public Void visitModuleMainClass(ModuleMainClass_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
+        public Void visitModulePackages(ModulePackages_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
+        public Void visitModuleResolution(ModuleResolution_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
+        public Void visitModuleTarget(ModuleTarget_attribute attr, T p) {
             return null;
         }
 
@@ -1288,26 +1293,31 @@
         }
 
         @Override
+        public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
         public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, T p) {
             return null;
         }
 
         @Override
-        public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, T p) {
-            return null;
-        }
-
-        @Override
         public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, T p) {
             return null;
         }
 
         @Override
-        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, T p) {
-            return null;
-        }
-
-        @Override
         public Void visitSignature(Signature_attribute attr, T p) {
             return null;
         }
@@ -1341,17 +1351,6 @@
         public Void visitSynthetic(Synthetic_attribute attr, T p) {
             return null;
         }
-
-        @Override
-        public Void visitModuleTarget(ModuleTarget_attribute attr, T p) {
-            return null;
-        }
-
-        @Override
-        public Void visitModuleVersion(ModuleVersion_attribute attr, T p) {
-            return null;
-        }
-
     }
 
     private static final Attribute.Visitor<Void, ExpectedTypeAnnotation> typeAnnoMatcher
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/ProvidesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.doclint
+ * @build DocLintTester
+ * @run main DocLintTester -ref ProvidesTest.out ProvidesTest.java
+ */
+
+/**
+ * Invalid use of provides in class documentation.
+ *
+ * @provides UsesTest
+ */
+public class ProvidesTest {
+    /**
+     * Invalid use of provides in field documentation
+     *
+     * @provides UsesTest Test description.
+     */
+    public int invalid_param;
+
+    /**
+     * Invalid use of provides in method documentation
+     *
+     * @provides UsesTest Test description.
+     */
+    public class InvalidParam { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/ProvidesTest.out	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,28 @@
+ProvidesTest.java:13: error: invalid use of @provides
+ * @provides UsesTest
+   ^
+ProvidesTest.java:13: error: service-type not found
+ * @provides UsesTest
+   ^
+ProvidesTest.java:13: error: reference not found
+ * @provides UsesTest
+             ^
+ProvidesTest.java:19: error: invalid use of @provides
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:19: error: service-type not found
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:19: error: reference not found
+     * @provides UsesTest Test description.
+                 ^
+ProvidesTest.java:26: error: invalid use of @provides
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:26: error: service-type not found
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:26: error: reference not found
+     * @provides UsesTest Test description.
+                 ^
+9 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/UsesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.doclint
+ * @build DocLintTester
+ * @run main DocLintTester -ref UsesTest.out UsesTest.java
+ */
+
+/**
+ * Invalid use of uses in class documentation.
+ *
+ * @uses ProvidesTest
+ */
+public class UsesTest {
+    /**
+     * Invalid use of uses in field documentation
+     *
+     * @uses ProvidesTest Test description.
+     */
+    public int invalid_param;
+
+    /**
+     * Invalid use of uses in method documentation
+     *
+     * @uses ProvidesTest Test description.
+     */
+    public class InvalidParam { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/UsesTest.out	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,28 @@
+UsesTest.java:13: error: invalid use of @uses
+ * @uses ProvidesTest
+   ^
+UsesTest.java:13: error: service-type not found
+ * @uses ProvidesTest
+   ^
+UsesTest.java:13: error: reference not found
+ * @uses ProvidesTest
+         ^
+UsesTest.java:19: error: invalid use of @uses
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:19: error: service-type not found
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:19: error: reference not found
+     * @uses ProvidesTest Test description.
+             ^
+UsesTest.java:26: error: invalid use of @uses
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:26: error: service-type not found
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:26: error: reference not found
+     * @uses ProvidesTest Test description.
+             ^
+9 errors
--- a/langtools/test/tools/javac/MethodParameters/AttributeVisitor.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/MethodParameters/AttributeVisitor.java	Fri Dec 16 11:58:18 2016 -0800
@@ -47,8 +47,8 @@
     public R visitModuleHashes(ModuleHashes_attribute attr, P p) { return null; }
     public R visitModuleMainClass(ModuleMainClass_attribute attr, P p) { return null; }
     public R visitModulePackages(ModulePackages_attribute attr, P p) { return null; }
+    public R visitModuleResolution(ModuleResolution_attribute attr, P p) { return null; }
     public R visitModuleTarget(ModuleTarget_attribute attr, P p) { return null; }
-    public R visitModuleVersion(ModuleVersion_attribute attr, P p) { return null; }
     public R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p) { return null; }
     public R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p) { return null; }
     public R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p) { return null; }
--- a/langtools/test/tools/javac/T6403466.out	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/T6403466.out	Fri Dec 16 11:58:18 2016 -0800
@@ -20,11 +20,11 @@
 Finished TaskEvent[ENTER,T6403466Wrapper.java,null]
 Started TaskEvent[ANNOTATION_PROCESSING_ROUND,null,null]
 Finished TaskEvent[ANNOTATION_PROCESSING_ROUND,null,null]
-Finished TaskEvent[ANNOTATION_PROCESSING,null,null]
 Started TaskEvent[ENTER,T6403466.java,null]
 Started TaskEvent[ENTER,T6403466Wrapper.java,null]
 Finished TaskEvent[ENTER,T6403466.java,null]
 Finished TaskEvent[ENTER,T6403466Wrapper.java,null]
+Finished TaskEvent[ANNOTATION_PROCESSING,null,null]
 Started TaskEvent[ANALYZE,T6403466.java,T6403466]
 Finished TaskEvent[ANALYZE,T6403466.java,T6403466]
 Started TaskEvent[GENERATE,T6403466.java,T6403466]
--- a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java	Fri Dec 16 11:58:18 2016 -0800
@@ -112,6 +112,8 @@
                 "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod", "layerClass");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$Module",
                 "addExportsMethod", "addUsesMethod", "getModuleMethod", "getUnnamedModuleMethod");
+        ignore("com/sun/tools/javac/util/JDK9Wrappers$ModuleDescriptor$Version",
+                "versionClass", "parseMethod");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$ModuleFinder",
                 "moduleFinderClass", "ofMethod");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$ServiceLoaderHelper",
--- a/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -46,7 +46,7 @@
 
     @Test
     public void testEmptyModule(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .write(base);
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
@@ -54,7 +54,7 @@
 
     @Test
     public void testExports(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .exports("pack")
                 .write(base);
         tb.writeJavaFiles(base, "package pack; public class C extends java.util.ArrayList{ }");
@@ -64,7 +64,7 @@
 
     @Test
     public void testSeveralExports(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .exports("pack")
                 .exports("pack2")
                 .exports("pack3")
@@ -83,7 +83,7 @@
 
     @Test
     public void testQualifiedExports(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .exportsTo("pack", "jdk.compiler")
                 .write(base);
         tb.writeJavaFiles(base, "package pack; public class A { }");
@@ -93,7 +93,7 @@
 
     @Test
     public void testQualifiedDynamicExports(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .exportsTo("pack", "jdk.compiler")
                 .write(base);
         tb.writeJavaFiles(base, "package pack; public class A { }");
@@ -103,7 +103,7 @@
 
     @Test
     public void testSeveralQualifiedExports(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .exportsTo("pack", "jdk.compiler, jdk.jdeps")
                 .exportsTo("pack2", "jdk.jdeps")
                 .exportsTo("pack3", "jdk.compiler")
@@ -122,7 +122,7 @@
 
     @Test
     public void testRequires(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .requires("jdk.compiler")
                 .write(base);
         compile(base);
@@ -131,7 +131,7 @@
 
     @Test
     public void testRequiresTransitive(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .requires("jdk.jdeps", RequiresFlag.TRANSITIVE)
                 .write(base);
         compile(base);
@@ -140,7 +140,7 @@
 
     @Test
     public void testRequiresStatic(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .requires("jdk.jdeps", RequiresFlag.STATIC)
                 .write(base);
         compile(base);
@@ -149,26 +149,26 @@
 
     @Test
     public void testSeveralRequires(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1x")
                 .requires("jdk.jdeps", RequiresFlag.TRANSITIVE)
                 .requires("jdk.compiler")
-                .requires("m2", RequiresFlag.STATIC)
-                .requires("m3")
-                .requires("m4", RequiresFlag.TRANSITIVE)
-                .requires("m5", RequiresFlag.STATIC, RequiresFlag.TRANSITIVE)
-                .write(base.resolve("m1"));
-        tb.writeJavaFiles(base.resolve("m2"), "module m2 { }");
-        tb.writeJavaFiles(base.resolve("m3"), "module m3 { }");
-        tb.writeJavaFiles(base.resolve("m4"), "module m4 { }");
-        tb.writeJavaFiles(base.resolve("m5"), "module m5 { }");
+                .requires("m2x", RequiresFlag.STATIC)
+                .requires("m3x")
+                .requires("m4x", RequiresFlag.TRANSITIVE)
+                .requires("m5x", RequiresFlag.STATIC, RequiresFlag.TRANSITIVE)
+                .write(base.resolve("m1x"));
+        tb.writeJavaFiles(base.resolve("m2x"), "module m2x { }");
+        tb.writeJavaFiles(base.resolve("m3x"), "module m3x { }");
+        tb.writeJavaFiles(base.resolve("m4x"), "module m4x { }");
+        tb.writeJavaFiles(base.resolve("m5x"), "module m5x { }");
         compile(base, "--module-source-path", base.toString(),
                 "-d", base.toString());
-        testModuleAttribute(base.resolve("m1"), moduleDescriptor);
+        testModuleAttribute(base.resolve("m1x"), moduleDescriptor);
     }
 
     @Test
     public void testProvides(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .provides("java.util.Collection", "pack2.D")
                 .write(base);
         tb.writeJavaFiles(base, "package pack2; public class D extends java.util.ArrayList{ }");
@@ -178,7 +178,7 @@
 
     @Test
     public void testSeveralProvides(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .provides("java.util.Collection", "pack2.D")
                 .provides("java.util.List", "pack2.D")
                 .requires("jdk.compiler")
@@ -192,7 +192,7 @@
 
     @Test
     public void testUses(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .uses("java.util.List")
                 .write(base);
         compile(base);
@@ -201,7 +201,7 @@
 
     @Test
     public void testSeveralUses(Path base) throws Exception {
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m")
                 .uses("java.util.List")
                 .uses("java.util.Collection")
                 .requires("jdk.compiler")
@@ -213,22 +213,22 @@
 
     @Test
     public void testComplex(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
-        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+        Path m1 = base.resolve("m1x");
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1x")
                 .exports("pack1")
                 .exports("pack3")
-                .exportsTo("packTo1", "m2")
-                .exportsTo("packTo3", "m3")
+                .exportsTo("packTo1", "m2x")
+                .exportsTo("packTo3", "m3x")
                 .requires("jdk.compiler")
-                .requires("m2", RequiresFlag.TRANSITIVE)
-                .requires("m3", RequiresFlag.STATIC)
-                .requires("m4", RequiresFlag.TRANSITIVE, RequiresFlag.STATIC)
+                .requires("m2x", RequiresFlag.TRANSITIVE)
+                .requires("m3x", RequiresFlag.STATIC)
+                .requires("m4x", RequiresFlag.TRANSITIVE, RequiresFlag.STATIC)
                 .provides("java.util.List", "pack1.C", "pack2.D")
                 .uses("java.util.List")
                 .uses("java.nio.file.Path")
                 .requires("jdk.jdeps", RequiresFlag.STATIC, RequiresFlag.TRANSITIVE)
-                .requires("m5", RequiresFlag.STATIC)
-                .requires("m6", RequiresFlag.TRANSITIVE)
+                .requires("m5x", RequiresFlag.STATIC)
+                .requires("m6x", RequiresFlag.TRANSITIVE)
                 .requires("java.compiler")
                 .exportsTo("packTo4", "java.compiler")
                 .exportsTo("packTo2", "java.compiler")
@@ -244,11 +244,11 @@
                 "package packTo2; public class T2 {}",
                 "package packTo3; public class T3 {}",
                 "package packTo4; public class T4 {}");
-        tb.writeJavaFiles(base.resolve("m2"), "module m2 { }");
-        tb.writeJavaFiles(base.resolve("m3"), "module m3 { }");
-        tb.writeJavaFiles(base.resolve("m4"), "module m4 { }");
-        tb.writeJavaFiles(base.resolve("m5"), "module m5 { }");
-        tb.writeJavaFiles(base.resolve("m6"), "module m6 { }");
+        tb.writeJavaFiles(base.resolve("m2x"), "module m2x { }");
+        tb.writeJavaFiles(base.resolve("m3x"), "module m3x { }");
+        tb.writeJavaFiles(base.resolve("m4x"), "module m4x { }");
+        tb.writeJavaFiles(base.resolve("m5x"), "module m5x { }");
+        tb.writeJavaFiles(base.resolve("m6x"), "module m6x { }");
         compile(base, "--module-source-path", base.toString(),
                 "-d", base.toString());
         testModuleAttribute(m1, moduleDescriptor);
--- a/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java	Fri Dec 16 11:58:18 2016 -0800
@@ -93,10 +93,10 @@
         tr.checkContains(actualRequires, moduleDescriptor.requires, "Lists of requires don't match");
     }
 
-    private void testExports(ModuleDescriptor moduleDescriptor, Module_attribute module, ConstantPool constantPool) throws ConstantPool.InvalidIndex, ConstantPool.UnexpectedEntry {
+    private void testExports(ModuleDescriptor moduleDescriptor, Module_attribute module, ConstantPool constantPool) throws ConstantPoolException {
         tr.checkEquals(module.exports_count, moduleDescriptor.exports.size(), "Wrong amount of exports.");
         for (Module_attribute.ExportsEntry export : module.exports) {
-            String pkg = constantPool.getUTF8Value(export.exports_index);
+            String pkg = constantPool.getPackageInfo(export.exports_index).getName();
             if (tr.checkTrue(moduleDescriptor.exports.containsKey(pkg), "Unexpected export " + pkg)) {
                 Export expectedExport = moduleDescriptor.exports.get(pkg);
                 tr.checkEquals(expectedExport.mask, export.exports_flags, "Wrong export flags");
@@ -104,7 +104,7 @@
                 tr.checkEquals(export.exports_to_count, expectedTo.size(), "Wrong amount of exports to");
                 List<String> actualTo = new ArrayList<>();
                 for (int toIdx : export.exports_to_index) {
-                    actualTo.add(constantPool.getUTF8Value(toIdx).replace('/', '.'));
+                    actualTo.add(constantPool.getModuleInfo(toIdx).getName().replace('/', '.'));
                 }
                 tr.checkContains(actualTo, expectedTo, "Lists of \"exports to\" don't match.");
             }
--- a/langtools/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-     requires m2;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m1x {
+     requires m2x;
+}
--- a/langtools/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {
-     requires m1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m2x {
+     requires m1x;
+}
--- a/langtools/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-module blah {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+module blah {}
--- a/langtools/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-module blah {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+module blah {}
--- a/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-@Deprecated
-module m1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+@Deprecated
+module m1x {}
--- a/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {
-    requires m1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m2x {
+    requires m1x;
+}
--- a/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-@Deprecated(forRemoval=true)
-module m1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+@Deprecated(forRemoval=true)
+module m1x {}
--- a/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {
-    requires m1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m2x {
+    requires m1x;
+}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1/api/Api.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-package api;
-
-public class Api {
-     public Impl getImpl() {
-         return null;
-     }
-}
-
-class Impl {}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-     exports api;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1x/api/Api.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package api;
+
+public class Api {
+     public Impl getImpl() {
+         return null;
+     }
+}
+
+class Impl {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m1x {
+     exports api;
+}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/api1/Api1.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package api1;
-
-public class Api1 {
-}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-     exports api1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1x/api1/Api1.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package api1;
+
+public class Api1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m1x {
+     exports api1;
+}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/api2/Api2.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-package api2;
-
-public class Api2 {
-     public api1.Api1 getApi1() {
-         return null;
-     }
-}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {
-     requires m1;
-     exports api2;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2x/api2/Api2.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+package api2;
+
+public class Api2 {
+     public api1.Api1 getApi1() {
+         return null;
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+module m2x {
+     requires m1x;
+     exports api2;
+}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/api/Api.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-package api;
-
-public class Api {
-     public impl.Impl getImpl() {
-         return null;
-     }
-}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/impl/Impl.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package impl;
-
-public class Impl {
-}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-     exports api;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1x/api/Api.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+package api;
+
+public class Api {
+     public impl.Impl getImpl() {
+         return null;
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1x/impl/Impl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package impl;
+
+public class Impl {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m1x {
+     exports api;
+}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/api/Api.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-package api;
-
-public class Api {
-     public qapi.QApi get() {
-         return null;
-     }
-}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-     exports api;
-     exports qapi to m2;
-}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/qapi/QApi.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package qapi;
-
-public class QApi {
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1x/api/Api.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+package api;
+
+public class Api {
+     public qapi.QApi get() {
+         return null;
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+module m1x {
+     exports api;
+     exports qapi to m2x;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1x/qapi/QApi.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package qapi;
+
+public class QApi {
+}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {
-     requires m1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m2x {
+     requires m1x;
+}
--- a/langtools/test/tools/javac/diags/examples/ModuleInfoWithoutModule/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-// No module description here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModuleInfoWithoutModule/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+// No module description here
--- a/langtools/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/additional/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/additional/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+module m1x {
+}
--- a/langtools/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+module m2x {
+}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1/p1/C1.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package p1;
-
-public class C1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+module m1x {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/p1/C1.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package p1;
+
+public class C1 {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2/p2/C2.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-package p2;
-
-public class C2 {
-    p1.C1 c1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+module m2x {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/p2/C2.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package p2;
+
+public class C2 {
+    p1.C1 c1;
+}
--- a/langtools/test/tools/javac/diags/examples/NotInProfile.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/diags/examples/NotInProfile.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, 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
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.not.in.profile
-// options: -profile compact1
+// options: --release 8 -profile compact1
 
 class NotInProfile {
     Class<?> c = java.awt.Frame.class;
--- a/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1/exported/Api1.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package exported;
-
-public class Api1 {
-}
--- a/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module lib1 {
-     exports exported;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1x/exported/Api1.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package exported;
+
+public class Api1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module lib1x {
+     exports exported;
+}
--- a/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2/exported/Api2.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package exported;
-
-public class Api2 {
-}
--- a/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module lib2 {
-     exports exported;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2x/exported/Api2.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package exported;
+
+public class Api2 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module lib2x {
+     exports exported;
+}
--- a/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/use/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/use/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -22,6 +22,6 @@
  */
 
 module use {
-     requires lib1;
-     requires lib2;
+     requires lib1x;
+     requires lib2x;
 }
--- a/langtools/test/tools/javac/diags/examples/PackageEmptyOrNotFound/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-    exports p1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PackageEmptyOrNotFound/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m1x {
+    exports p1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PoorChoiceForModuleName/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+// key: compiler.warn.poor.choice.for.module.name
+// options: -Xlint:module
+
+module mango19 {}
--- a/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/exported/Service.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package exported;
-
-public interface Service {
-}
--- a/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/exported/ServiceImplementation.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package exported;
-
-public class ServiceImplementation implements Service {
-}
--- a/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {
-     exports exported;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1x/exported/Service.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package exported;
+
+public interface Service {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1x/exported/ServiceImplementation.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package exported;
+
+public class ServiceImplementation implements Service {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m1x {
+     exports exported;
+}
--- a/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-module m2 {
-     requires m1;
-     provides exported.Service with exported.ServiceImplementation;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m2x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+module m2x {
+     requires m1x;
+     provides exported.Service with exported.ServiceImplementation;
+}
--- a/langtools/test/tools/javac/diags/examples/TooManyModules/p1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/diags/examples/TooManyModules/p1/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -21,4 +21,4 @@
  * questions.
  */
 
-module m1 {}
+module m1x {}
--- a/langtools/test/tools/javac/diags/examples/TooManyModules/p2/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/diags/examples/TooManyModules/p2/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -21,4 +21,4 @@
  * questions.
  */
 
-module m2 {}
+module m2x {}
--- a/langtools/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1/UnnamedPackageInNamedModule.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-class UnnamedPackageInNamedModule {}
--- a/langtools/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-module m1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1x/UnnamedPackageInNamedModule.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+class UnnamedPackageInNamedModule {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1x/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+module m1x {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnModuleNotFound/WarnModuleNotFound.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+// key: compiler.warn.module.not.found
+// options: -Xlint:module
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnModuleNotFound/modulesourcepath/m/api/Api.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package api;
+
+public class Api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnModuleNotFound/modulesourcepath/m/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m {
+     exports api to does.not.exist;
+}
--- a/langtools/test/tools/javac/doctree/DocCommentTester.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/doctree/DocCommentTester.java	Fri Dec 16 11:58:18 2016 -0800
@@ -498,6 +498,17 @@
                 return null;
             }
 
+            public Void visitProvides(ProvidesTree node, Void p) {
+                header(node);
+                indent(+1);
+                print("serviceName", node.getServiceType());
+                print("description", node.getDescription());
+                indent(-1);
+                indent();
+                out.println("]");
+                return null;
+            }
+
             public Void visitReference(ReferenceTree node, Void p) {
                 header(node, compress(node.getSignature()));
                 return null;
@@ -617,6 +628,17 @@
                 return null;
             }
 
+            public Void visitUses(UsesTree node, Void p) {
+                header(node);
+                indent(+1);
+                print("serviceName", node.getServiceType());
+                print("description", node.getDescription());
+                indent(-1);
+                indent();
+                out.println("]");
+                return null;
+            }
+
             public Void visitValue(ValueTree node, Void p) {
                 header(node);
                 indent(+1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doctree/ProvidesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,75 @@
+/*
+ * 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 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.tree
+ *          jdk.compiler/com.sun.tools.javac.util
+ * @build DocCommentTester
+ * @run main DocCommentTester ProvidesTest.java
+ */
+
+class ProvidesTest {
+    /**
+     * abc.
+     * @provides UsesTest
+      */
+    void simple_provides() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Provides[PROVIDES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:17, UsesTest]
+      description: empty
+    ]
+]
+*/
+
+    /**
+     * abc.
+     * @provides UsesTest Test description for provides.
+      */
+    void provides_with_description() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Provides[PROVIDES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:17, UsesTest]
+      description: 1
+        Text[TEXT, pos:26, Test_description_for_provides.]
+    ]
+]
+*/
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doctree/UsesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,75 @@
+/*
+ * 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 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.tree
+ *          jdk.compiler/com.sun.tools.javac.util
+ * @build DocCommentTester
+ * @run main DocCommentTester UsesTest.java
+ */
+
+class UsesTest {
+    /**
+     * abc.
+     * @uses ProvidesTest
+      */
+    void simple_uses() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Uses[USES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:13, ProvidesTest]
+      description: empty
+    ]
+]
+*/
+
+    /**
+     * abc.
+     * @uses ProvidesTest Test description for uses.
+      */
+    void uses_with_description() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Uses[USES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:13, ProvidesTest]
+      description: 1
+        Text[TEXT, pos:26, Test_description_for_uses.]
+    ]
+]
+*/
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/file/ModuleAndPackageLocations.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,213 @@
+/*
+ * 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 8171005
+ * @summary Verify behavior of JavaFileManager methods w.r.t. module/package oriented locations
+ * @library /tools/lib
+ * @modules java.compiler
+ * @build toolbox.TestRunner ModuleAndPackageLocations
+ * @run main ModuleAndPackageLocations
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import toolbox.TestRunner;
+import toolbox.TestRunner.Test;
+
+public class ModuleAndPackageLocations extends TestRunner {
+
+    public static void main(String... args) throws Exception {
+        new ModuleAndPackageLocations().runTests(m -> new Object[] { Paths.get(m.getName()) });
+    }
+
+    public ModuleAndPackageLocations() {
+        super(System.err);
+    }
+
+    @Test
+    public void testListLocations(Path outerBase) throws Exception {
+        doRunTest(outerBase, (base, fm) -> {
+            assertLocations(fm.listLocationsForModules(StandardLocation.MODULE_SOURCE_PATH),
+                            toSet("MODULE_SOURCE_PATH[a]:false:false",
+                                  "MODULE_SOURCE_PATH[b]:false:false",
+                                  "MODULE_SOURCE_PATH[c]:false:false"));
+            assertLocations(fm.listLocationsForModules(StandardLocation.MODULE_PATH),
+                            toSet("MODULE_PATH[0.X,a]:false:false",
+                                  "MODULE_PATH[0.X,b]:false:false"),
+                            toSet("MODULE_PATH[1.X,c]:false:false",
+                                  "MODULE_PATH[1.X,b]:false:false"));
+            assertLocations(fm.listLocationsForModules(StandardLocation.SOURCE_OUTPUT),
+                            toSet("SOURCE_OUTPUT[a]:false:true",
+                                  "SOURCE_OUTPUT[b]:false:true"));
+
+            fm.getLocationForModule(StandardLocation.SOURCE_OUTPUT, "c");
+
+            assertLocations(fm.listLocationsForModules(StandardLocation.SOURCE_OUTPUT),
+                            toSet("SOURCE_OUTPUT[a]:false:true",
+                                  "SOURCE_OUTPUT[b]:false:true",
+                                  "SOURCE_OUTPUT[c]:false:true"));
+        });
+    }
+
+    @Test
+    public void testGetModuleForPath(Path outerBase) throws Exception {
+        doRunTest(outerBase, (base, fm) -> {
+            Location cOutput = fm.getLocationForModule(StandardLocation.SOURCE_OUTPUT, "c");
+            JavaFileObject testFO = fm.getJavaFileForOutput(cOutput, "test.Test", Kind.CLASS, null);
+            testFO.openOutputStream().close();
+            Location cOutput2 = fm.getLocationForModule(StandardLocation.SOURCE_OUTPUT, testFO, "test");
+
+            if (cOutput != cOutput2) {
+                throw new AssertionError("Unexpected location: " + cOutput2 + ", expected: " +cOutput);
+            }
+        });
+    }
+
+    @Test
+    public void testRejects(Path outerBase) throws Exception {
+        doRunTest(outerBase, (base, fm) -> {
+            assertRefused(() -> fm.getClassLoader(StandardLocation.MODULE_SOURCE_PATH));
+            assertRefused(() -> fm.getFileForInput(StandardLocation.MODULE_SOURCE_PATH, "", ""));
+            assertRefused(() -> fm.getFileForOutput(StandardLocation.MODULE_SOURCE_PATH, "", "", null));
+            assertRefused(() -> fm.getJavaFileForInput(StandardLocation.MODULE_SOURCE_PATH, "", Kind.SOURCE));
+            assertRefused(() -> fm.getJavaFileForOutput(StandardLocation.MODULE_SOURCE_PATH, "", Kind.SOURCE, null));
+            assertRefused(() -> fm.getLocationForModule(StandardLocation.SOURCE_PATH, "test"));
+            JavaFileObject out = fm.getJavaFileForInput(StandardLocation.CLASS_OUTPUT, "test.Test", Kind.CLASS);
+            assertRefused(() -> fm.getLocationForModule(StandardLocation.SOURCE_PATH, out, "test"));
+            assertRefused(() -> fm.inferBinaryName(StandardLocation.MODULE_PATH, out));
+            assertRefused(() -> fm.inferModuleName(StandardLocation.MODULE_SOURCE_PATH));
+            assertRefused(() -> fm.list(StandardLocation.MODULE_SOURCE_PATH, "test", EnumSet.allOf(Kind.class), false));
+            assertRefused(() -> fm.listLocationsForModules(StandardLocation.SOURCE_PATH));
+        });
+    }
+
+    void doRunTest(Path base, TestExec test) throws Exception {
+        try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
+            Path msp  = base.resolve("msp");
+            Path msp1 = msp.resolve("1");
+            Path msp2 = msp.resolve("2");
+
+            Files.createDirectories(msp1.resolve("a"));
+            Files.createDirectories(msp1.resolve("b"));
+            Files.createDirectories(msp2.resolve("b"));
+            Files.createDirectories(msp2.resolve("c"));
+
+            Path mp  = base.resolve("mp");
+            Path mp1 = mp.resolve("1");
+            Path mp2 = mp.resolve("2");
+
+            touch(mp1.resolve("a/module-info.class"),
+                  mp1.resolve("b/module-info.class"),
+                  mp2.resolve("b/module-info.class"),
+                  mp2.resolve("c/module-info.class"));
+
+            Path so  = base.resolve("so");
+
+            Files.createDirectories(so.resolve("a"));
+            Files.createDirectories(so.resolve("b"));
+
+            List<String> mspOpt = Arrays.asList(msp1.toAbsolutePath().toString() +
+                                                File.pathSeparatorChar +
+                                                msp2.toAbsolutePath().toString());
+
+            List<String> mpOpt = Arrays.asList(mp1.toAbsolutePath().toString() +
+                                               File.pathSeparatorChar +
+                                               mp2.toAbsolutePath().toString());
+
+            fm.handleOption("--module-source-path", mspOpt.iterator());
+            fm.handleOption("--module-path", mpOpt.iterator());
+            fm.handleOption("-s", Arrays.asList(so.toString()).iterator());
+
+            test.run(base, fm);
+        }
+    }
+
+    private Set<String> toSet(String... values) {
+        return new HashSet<>(Arrays.asList(values));
+    }
+
+    private void touch(Path... paths) throws IOException {
+        for (Path p : paths) {
+            Files.createDirectories(p.getParent());
+            Files.newOutputStream(p).close();
+        }
+    }
+
+    @SafeVarargs
+    private void assertLocations(Iterable<Set<Location>> locations, Set<String>... expected) {
+        List<Set<String>> actual =
+                StreamSupport.stream(locations.spliterator(), true)
+                             .map(locs -> locs.stream()
+                                              .map(l -> toString(l))
+                                              .collect(Collectors.toSet()))
+                             .collect(Collectors.toList());
+
+        if (!Objects.equals(actual, Arrays.asList(expected))) {
+            throw new AssertionError("Unexpected output: " + actual);
+        }
+    }
+
+    private void assertRefused(Callable r) throws Exception {
+        try {
+            r.call();
+            throw new AssertionError("Expected exception did not occur");
+        } catch (IllegalArgumentException ex) {
+            //ok
+        }
+    }
+
+    private static String toString(Location l) {
+        return l.getName().replaceAll("\\[([0-9])\\.[0-9]:", "[$1.X,") + ":" +
+               l.isModuleOrientedLocation() + ":" + l.isOutputLocation();
+    }
+
+    static interface TestExec {
+        public void run(Path base, JavaFileManager fm) throws Exception;
+    }
+
+    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/generics/inference/CaptureLowerBound.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBound.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1,31 +1,9 @@
 /*
- * Copyright (c) 2014, 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
+ * @test /nodynamiccopyright/
  * @bug 8039214
  * @summary Capture variable as an inference variable's lower bound
  * @compile CaptureLowerBound.java
+ * @compile/fail/ref=CaptureLowerBound7.out -Xlint:-options -source 7 -XDrawDiagnostics CaptureLowerBound.java
  */
 
 public class CaptureLowerBound {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBound7.out	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,2 @@
+CaptureLowerBound.java:17:7: compiler.err.cant.apply.symbol: kindname.method, m, CaptureLowerBound.I<? extends X,X>, CaptureLowerBound.C<compiler.misc.type.captureof: 1, ?>, kindname.class, CaptureLowerBound, (compiler.misc.inferred.do.not.conform.to.lower.bounds: compiler.misc.type.captureof: 1, ?, java.lang.Object)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundArray.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,22 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8075793
+ * @summary Capture variable as an inference lower bound followed by an array write
+ * @compile/fail/ref=CaptureLowerBoundArray.out -XDrawDiagnostics CaptureLowerBoundArray.java
+ * @compile -Xlint:-options -source 7 CaptureLowerBoundArray.java
+ */
+
+class CaptureLowerBoundArray {
+
+    interface I<T> {
+        T[] getArray();
+    }
+
+    <T> T[] m(T[] arg) { return null; }
+
+    void test(I<? extends Exception> i) {
+        m(i.getArray())[0] = new Exception();
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundArray.out	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,2 @@
+CaptureLowerBoundArray.java:18:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Exception, compiler.misc.type.captureof: 1, ? extends java.lang.Exception)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundAssign.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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 8075793
+ * @summary Capture variable as an inference lower bound followed by an invariant assignment
+ * @compile CaptureLowerBoundAssign.java
+ * @compile -Xlint:-options -source 7 CaptureLowerBoundAssign.java
+ */
+
+class CaptureLowerBoundAssign {
+
+    static class C<T> {}
+
+    <T> C<T> m(C<? extends T> x) { return null; }
+
+    void test(C<? extends Number> arg) {
+        C<Number> c = m(arg);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundDeref.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,24 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8075793
+ * @summary Capture variable as an inference lower bound followed by a member reference
+ * @compile/fail/ref=CaptureLowerBoundDeref.out -XDrawDiagnostics CaptureLowerBoundDeref.java
+ * @compile -Xlint:-options -source 7 CaptureLowerBoundDeref.java
+ */
+
+class CaptureLowerBoundDeref {
+
+    interface Wrapper<T> {
+        I<T> get();
+    }
+
+    interface I<T> {}
+
+    interface K<T> { void take(T arg); }
+
+    <T> K<T> m(I<? extends T> arg) { return null; }
+
+    void test(Wrapper<?> w) {
+        m(w.get()).take(new Object());
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundDeref.out	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,2 @@
+CaptureLowerBoundDeref.java:22:19: compiler.err.cant.apply.symbol: kindname.method, take, compiler.misc.type.captureof: 1, ?, java.lang.Object, kindname.interface, CaptureLowerBoundDeref.K<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, compiler.misc.type.captureof: 1, ?))
+1 error
--- a/langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.java	Fri Dec 16 11:58:18 2016 -0800
@@ -3,6 +3,7 @@
  * @bug 8039214
  * @summary Capture variable as an inference variable's lower bound
  * @compile/fail/ref=CaptureLowerBoundNeg.out -XDrawDiagnostics CaptureLowerBoundNeg.java
+ * @compile -Xlint:-options -source 7 CaptureLowerBoundNeg.java
  */
 
 public class CaptureLowerBoundNeg {
--- a/langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.out	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.out	Fri Dec 16 11:58:18 2016 -0800
@@ -1,2 +1,2 @@
-CaptureLowerBoundNeg.java:16:29: compiler.err.cant.apply.symbol: kindname.method, take, compiler.misc.type.captureof: 1, ? extends java.lang.Object, java.lang.Object, kindname.class, CaptureLowerBoundNeg.D<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, compiler.misc.type.captureof: 1, ? extends java.lang.Object))
+CaptureLowerBoundNeg.java:17:29: compiler.err.cant.apply.symbol: kindname.method, take, compiler.misc.type.captureof: 1, ? extends java.lang.Object, java.lang.Object, kindname.class, CaptureLowerBoundNeg.D<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, compiler.misc.type.captureof: 1, ? extends java.lang.Object))
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureUpperBoundDeref.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,22 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8075793
+ * @summary Capture variable as an inference upper bound followed by a member reference
+ * @compile/fail/ref=CaptureUpperBoundDeref.out -XDrawDiagnostics CaptureUpperBoundDeref.java
+ * @compile -Xlint:-options -source 7 CaptureUpperBoundDeref.java
+ */
+
+class CaptureUpperBoundDeref {
+
+    interface Wrapper<T> {
+        I<T> get();
+    }
+
+    interface I<T> {}
+
+    <T> T m(I<? super T> arg) { return null; }
+
+    void test(Wrapper<? super String> w) {
+        m(w.get()).substring(0);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureUpperBoundDeref.out	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,2 @@
+CaptureUpperBoundDeref.java:20:19: compiler.err.cant.resolve.location.args: kindname.method, substring, , int, (compiler.misc.location: kindname.class, java.lang.Object, null)
+1 error
--- a/langtools/test/tools/javac/generics/inference/NestedCapture.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/generics/inference/NestedCapture.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,6 +26,7 @@
  * @bug 8039214
  * @summary Capture variable passed through multiple levels of nested inference
  * @compile NestedCapture.java
+ * @compile -Xlint:-options -source 7 NestedCapture.java
  */
 
 abstract class NestedCapture {
--- a/langtools/test/tools/javac/generics/inference/NestedWildcards.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/generics/inference/NestedWildcards.java	Fri Dec 16 11:58:18 2016 -0800
@@ -26,6 +26,7 @@
  * @bug 8039214
  * @summary Nested generic methods that work on wildcard-parameterized types
  * @compile NestedWildcards.java
+ * @compile -Xlint:-options -source 7 NestedWildcards.java
  */
 
 public class NestedWildcards {
--- a/langtools/test/tools/javac/lambda/ByteCodeTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/lambda/ByteCodeTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -619,6 +619,36 @@
         }
 
         @Override
+        public String visitModule(CONSTANT_Module_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.name_index), c.name_index);
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitPackage(CONSTANT_Package_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.name_index), c.name_index);
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
         public String visitString(CONSTANT_String_info c, Integer p) {
 
             try {
--- a/langtools/test/tools/javac/lib/DPrinter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/lib/DPrinter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -1085,6 +1085,13 @@
             return visitBlockTag(node, null);
         }
 
+        public Void visitProvides(ProvidesTree node, Void p) {
+            printString("kind", node.getKind().name());
+            printDocTree("serviceType", node.getServiceType());
+            printList("description", node.getDescription());
+            return visitBlockTag(node, null);
+        }
+
         public Void visitReference(ReferenceTree node, Void p) {
             printString("signature", node.getSignature());
             return visitTree(node, null);
@@ -1152,6 +1159,13 @@
             return visitInlineTag(node, null);
         }
 
+        public Void visitUses(UsesTree node, Void p) {
+            printString("kind", node.getKind().name());
+            printDocTree("serviceType", node.getServiceType());
+            printList("description", node.getDescription());
+            return visitBlockTag(node, null);
+        }
+
         public Void visitValue(ValueTree node, Void p) {
             printDocTree("value", node.getReference());
             return visitInlineTag(node, null);
--- a/langtools/test/tools/javac/modules/AddExportsTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AddExportsTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -31,13 +31,10 @@
  * @run main AddExportsTest
  */
 
-import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.Set;
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class AddExportsTest extends ModuleTestBase {
 
@@ -71,24 +68,24 @@
     @Test
     public void testEmptyItem(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { }",
+                          "module m3x { }",
                           "package p3; class C3 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        testEmptyItem(src, classes, "m1/p1=,m2,m3");
-        testEmptyItem(src, classes, "m1/p1=m2,,m3");
-        testEmptyItem(src, classes, "m1/p1=m2,m3,");
+        testEmptyItem(src, classes, "m1x/p1=,m2x,m3x");
+        testEmptyItem(src, classes, "m1x/p1=m2x,,m3x");
+        testEmptyItem(src, classes, "m1x/p1=m2x,m3x,");
     }
 
     void testEmptyItem(Path src, Path classes, String option) throws Exception {
@@ -104,15 +101,15 @@
     @Test
     public void testEmptyList(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        testEmptyList(src, classes, "m1/p1=");
-        testEmptyList(src, classes, "m1/p1=,");
+        testEmptyList(src, classes, "m1x/p1=");
+        testEmptyList(src, classes, "m1x/p1=,");
     }
 
     void testEmptyList(Path src, Path classes, String option) throws Exception {
@@ -132,22 +129,22 @@
     @Test
     public void testMissingSourceParts(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        testMissingSourcePart(src, classes, "=m2");
-        testMissingSourcePart(src, classes, "/=m2");
-        testMissingSourcePart(src, classes, "m1/=m2");
-        testMissingSourcePart(src, classes, "/p1=m2");
-        testMissingSourcePart(src, classes, "m1p1=m2");
+        testMissingSourcePart(src, classes, "=m2x");
+        testMissingSourcePart(src, classes, "/=m2x");
+        testMissingSourcePart(src, classes, "m1x/=m2x");
+        testMissingSourcePart(src, classes, "/p1=m2x");
+        testMissingSourcePart(src, classes, "m1xp1=m2x");
     }
 
     private void testMissingSourcePart(Path src, Path classes, String option) throws Exception {
@@ -167,19 +164,19 @@
     @Test
     public void testBadSourceParts(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        testBadSourcePart(src, classes, "m!/p1=m2", "m!");
-        testBadSourcePart(src, classes, "m1/p!=m2", "p!");
+        testBadSourcePart(src, classes, "m!/p1=m2x", "m!");
+        testBadSourcePart(src, classes, "m1x/p!=m2x", "p!");
     }
 
     private void testBadSourcePart(Path src, Path classes, String option, String badName)
@@ -201,9 +198,9 @@
     @Test
     public void testBadTarget(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
@@ -211,7 +208,7 @@
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                          "--module-source-path", src.toString(),
-                         "--add-exports", "m1/p1=m!")
+                         "--add-exports", "m1x/p1=m!")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -225,16 +222,16 @@
     @Test
     public void testSourceNotFound(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }");
+                          "module m1x { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                          "--module-source-path", src.toString(),
-                         "--add-exports", "DoesNotExist/p=m1")
+                         "--add-exports", "DoesNotExist/p=m1x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -248,9 +245,9 @@
     @Test
     public void testTargetNotFound(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package p1; class C1 { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
@@ -258,7 +255,7 @@
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                          "--module-source-path", src.toString(),
-                         "--add-exports", "m1/p1=DoesNotExist")
+                         "--add-exports", "m1x/p1=DoesNotExist")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -272,20 +269,20 @@
     @Test
     public void testDuplicate(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-exports", "m1/p1=m2,m2")
+                         "--add-exports", "m1x/p1=m2x,m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -295,21 +292,21 @@
     @Test
     public void testRepeated_SameTarget(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-exports", "m1/p1=m2",
-                         "--add-exports", "m1/p1=m2")
+                         "--add-exports", "m1x/p1=m2x",
+                         "--add-exports", "m1x/p1=m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -319,25 +316,25 @@
     @Test
     public void testRepeated_DifferentTarget(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { }",
+                          "module m3x { }",
                           "package p3; class C3 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-exports", "m1/p1=m2",
-                         "--add-exports", "m1/p1=m3")
+                         "--add-exports", "m1x/p1=m2x",
+                         "--add-exports", "m1x/p1=m3x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
--- a/langtools/test/tools/javac/modules/AddLimitMods.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AddLimitMods.java	Fri Dec 16 11:58:18 2016 -0800
@@ -81,22 +81,22 @@
     @Test
     public void testManual(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "module m1 { requires m2; requires m3; }");
+                          "module m1x { requires m2x; requires m3x; }");
 
-        Path m2 = moduleSrc.resolve("m2");
+        Path m2 = moduleSrc.resolve("m2x");
 
         tb.writeJavaFiles(m2,
-                          "module m2 { requires m3; exports m2; }",
-                          "package m2; public class M2 {}");
+                          "module m2x { requires m3x; exports m2x; }",
+                          "package m2x; public class M2 {}");
 
-        Path m3 = moduleSrc.resolve("m3");
+        Path m3 = moduleSrc.resolve("m3x");
 
         tb.writeJavaFiles(m3,
-                          "module m3 { exports m3; }",
-                          "package m3; public class M3 {}");
+                          "module m3x { exports m3x; }",
+                          "package m3x; public class M3 {}");
 
         Path modulePath = base.resolve("module-path");
 
@@ -130,7 +130,7 @@
                 .options("--module-path", modulePath.toString(),
                          "--should-stop:ifNoError=FLOW",
                          "--limit-modules", "java.base",
-                         "--add-modules", "m2")
+                         "--add-modules", "m2x")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
                 .run(Task.Expect.FAIL)
@@ -140,7 +140,7 @@
                 .options("--module-path", modulePath.toString(),
                          "--should-stop:ifNoError=FLOW",
                          "--limit-modules", "java.base",
-                         "--add-modules", "m2,m3")
+                         "--add-modules", "m2x,m3x")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
                 .run()
@@ -149,7 +149,7 @@
         new JavacTask(tb)
                 .options("--module-path", modulePath.toString(),
                          "--should-stop:ifNoError=FLOW",
-                         "--limit-modules", "m2")
+                         "--limit-modules", "m2x")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
                 .run()
@@ -158,7 +158,7 @@
         new JavacTask(tb)
                 .options("--module-path", modulePath.toString(),
                          "--should-stop:ifNoError=FLOW",
-                         "--limit-modules", "m3")
+                         "--limit-modules", "m3x")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
                 .run(Task.Expect.FAIL)
@@ -167,8 +167,8 @@
         new JavacTask(tb)
                 .options("--module-path", modulePath.toString(),
                          "--should-stop:ifNoError=FLOW",
-                         "--limit-modules", "m3",
-                         "--add-modules", "m2")
+                         "--limit-modules", "m3x",
+                         "--add-modules", "m2x")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
                 .run()
@@ -233,10 +233,10 @@
             tb.cleanDirectory(base);
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "module m1 { exports api; }",
+                          "module m1x { exports api; }",
                           "package api; public class Api { }");
 
         Path modulePath = base.resolve("module-path");
@@ -319,7 +319,7 @@
             throw new IllegalStateException("incorrect errors; actual=" + actual);
         }
 
-        tb.writeJavaFiles(cpSrc, "module m1 {}");
+        tb.writeJavaFiles(cpSrc, "module m1x {}");
 
         actual = new JavacTask(tb)
                    .options("-XDrawDiagnostics",
@@ -382,10 +382,10 @@
           .run();
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "module m1 { exports api; }",
+                          "module m1x { exports api; }",
                           "package api; public class Api { public void test() { } }");
 
         System.err.println("Compiling module-src files:");
@@ -405,8 +405,8 @@
 
                 System.err.println("Running check: " + moduleInfo + "; " + Arrays.asList(options));
 
-                Path m2Runtime = base.resolve(index + "-runtime").resolve("m2");
-                Path out = base.resolve(index + "-runtime").resolve("out").resolve("m2");
+                Path m2Runtime = base.resolve(index + "-runtime").resolve("m2x");
+                Path out = base.resolve(index + "-runtime").resolve("out").resolve("m2x");
 
                 Files.createDirectories(out);
 
@@ -443,14 +443,14 @@
                 String output;
 
                 try {
-                    System.err.println("Running m2/test.Test:");
+                    System.err.println("Running m2x/test.Test:");
                     output = new JavaTask(tb)
                        .vmOptions(augmentOptions(options,
                                                  Collections.emptyList(),
                                                  "--module-path", modulePath.toString() + File.pathSeparator + out.getParent().toString(),
                                                  "--class-path", classpathOut.toString(),
-                                                 "--add-reads", "m2=ALL-UNNAMED,automatic",
-                                                 "-m", "m2/test.Test"))
+                                                 "--add-reads", "m2x=ALL-UNNAMED,automatic",
+                                                 "-m", "m2x/test.Test"))
                        .run()
                        .writeAll()
                        .getOutput(Task.OutputKind.STDERR);
@@ -461,7 +461,7 @@
                     output = "";
                 }
 
-                Path m2 = base.resolve(String.valueOf(index)).resolve("m2");
+                Path m2 = base.resolve(String.valueOf(index)).resolve("m2x");
 
                 tb.writeJavaFiles(m2,
                                   moduleInfo,
@@ -475,7 +475,7 @@
                     "-XDaccessInternalAPI=true"
                 ) : Collections.emptyList();
 
-                System.err.println("Compiling/processing m2 files:");
+                System.err.println("Compiling/processing m2x files:");
                 new JavacTask(tb)
                    .options(augmentOptions(options,
                                            auxOptions,
@@ -515,8 +515,8 @@
     private static final Map<String, String> MODULES_TO_CHECK_TO_SAMPLE_CLASS = new LinkedHashMap<>();
 
     static {
-        MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m1", "api.Api");
-        MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m2", "test.Test");
+        MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m1x", "api.Api");
+        MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m2x", "test.Test");
         MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("java.base", "java.lang.Object");
     };
 
@@ -578,19 +578,19 @@
     }
 
     private static final String[] MODULE_INFO_VARIANTS = {
-        "module m2 { exports test; }",
-        "module m2 { requires m1; exports test; }"
+        "module m2x { exports test; }",
+        "module m2x { requires m1x; exports test; }"
     };
 
     private static final String[][] OPTIONS_VARIANTS = {
         {"--add-modules", "automatic"},
-        {"--add-modules", "m1,automatic"},
+        {"--add-modules", "m1x,automatic"},
         {"--add-modules", "jdk.compiler,automatic"},
-        {"--add-modules", "m1,jdk.compiler,automatic"},
+        {"--add-modules", "m1x,jdk.compiler,automatic"},
         {"--add-modules", "ALL-SYSTEM,automatic"},
         {"--limit-modules", "java.base", "--add-modules", "automatic"},
         {"--limit-modules", "java.base", "--add-modules", "ALL-SYSTEM,automatic"},
-        {"--limit-modules", "m2", "--add-modules", "automatic"},
+        {"--limit-modules", "m2x", "--add-modules", "automatic"},
         {"--limit-modules", "jdk.compiler", "--add-modules", "automatic"},
     };
 }
--- a/langtools/test/tools/javac/modules/AddModulesTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AddModulesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -36,7 +36,6 @@
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class AddModulesTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -70,18 +69,18 @@
     @Test
     public void testEmptyItem(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }");
-        Path src_m2 = src.resolve("m2");
+                          "module m1x { }");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }");
+                          "module m2x { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        testEmptyItem(src, classes, ",m1");
-        testEmptyItem(src, classes, "m1,,m2");
-        testEmptyItem(src, classes, "m1,");
+        testEmptyItem(src, classes, ",m1x");
+        testEmptyItem(src, classes, "m1x,,m2x");
+        testEmptyItem(src, classes, "m1x,");
     }
 
     private void testEmptyItem(Path src, Path classes, String option) throws Exception {
@@ -159,9 +158,9 @@
         Path src = base.resolve("src");
 
         // setup a utility module
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
         Path modules = base.resolve("modules");
         tb.createDirectories(modules);
@@ -182,7 +181,7 @@
 
         new JavacTask(tb)
                 .options("--module-path", modules.toString(),
-                         "--add-modules", "m1,m1")
+                         "--add-modules", "m1x,m1x")
                 .outdir(classes)
                 .files(findJavaFiles(src2))
                 .run()
@@ -194,13 +193,13 @@
         Path src = base.resolve("src");
 
         // setup some utility modules
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { exports p2; }",
+                          "module m2x { exports p2; }",
                           "package p2; public class C2 { }");
         Path modules = base.resolve("modules");
         tb.createDirectories(modules);
@@ -221,8 +220,8 @@
 
         new JavacTask(tb)
                 .options("--module-path", modules.toString(),
-                         "--add-modules", "m1",
-                         "--add-modules", "m2")
+                         "--add-modules", "m1x",
+                         "--add-modules", "m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src2))
                 .run()
--- a/langtools/test/tools/javac/modules/AddReadsTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AddReadsTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -60,13 +60,13 @@
     @Test
     public void testAddReads(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports api; }",
+                          "module m1x { exports api; }",
                           "package api; public class Api { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package test; public class Test extends api.Api { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
@@ -85,7 +85,7 @@
 
         //test add dependencies:
         new JavacTask(tb)
-                .options("--add-reads", "m2=m1",
+                .options("--add-reads", "m2x=m1x",
                          "--module-source-path", src.toString(),
                          "-processor", VerifyRequires.class.getName())
                 .outdir(classes)
@@ -94,18 +94,19 @@
                 .writeAll();
 
         String decompiled = new JavapTask(tb)
-                .options("-verbose", classes.resolve("m2").resolve("module-info.class").toString())
+                .options("-verbose",
+                        classes.resolve("m2x").resolve("module-info.class").toString())
                 .run()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (decompiled.contains("m1")) {
-            throw new Exception("Incorrectly refers to m1 module.");
+        if (decompiled.contains("m1x")) {
+            throw new Exception("Incorrectly refers to m1x module.");
         }
 
         //cyclic dependencies OK when created through addReads:
         new JavacTask(tb)
-                .options("--add-reads", "m2=m1",
-                         "--add-reads", "m1=m2",
+                .options("--add-reads", "m2x=m1x",
+                         "--add-reads", "m1x=m2x",
                          "--module-source-path", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
@@ -113,10 +114,10 @@
                 .writeAll();
 
         tb.writeJavaFiles(src_m2,
-                          "module m2 { requires m1; }");
+                          "module m2x { requires m1x; }");
 
         new JavacTask(tb)
-                .options("--add-reads", "m1=m2",
+                .options("--add-reads", "m1x=m2x",
                          "--module-source-path", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
@@ -129,16 +130,16 @@
 
         @Override
         public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-            ModuleElement m2Module = processingEnv.getElementUtils().getModuleElement("m2");
+            ModuleElement m2Module = processingEnv.getElementUtils().getModuleElement("m2x");
             if (m2Module == null) {
-                throw new AssertionError("Cannot find the m2 module!");
+                throw new AssertionError("Cannot find the m2x module!");
             }
             boolean foundM1 = false;
             for (RequiresDirective rd : ElementFilter.requiresIn(m2Module.getDirectives())) {
-                foundM1 |= rd.getDependency().getSimpleName().contentEquals("m1");
+                foundM1 |= rd.getDependency().getSimpleName().contentEquals("m1x");
             }
             if (!foundM1) {
-                throw new AssertionError("Cannot find the dependency on m1 module!");
+                throw new AssertionError("Cannot find the dependency on m1x module!");
             }
             return false;
         }
@@ -155,19 +156,19 @@
         Path jar = prepareTestJar(base);
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package impl; public class Impl { api.Api api; }");
 
         new JavacTask(tb)
           .options("--class-path", jar.toString(),
-                   "--add-reads", "m1=ALL-UNNAMED",
+                   "--add-reads", "m1x=ALL-UNNAMED",
                    "-XDrawDiagnostics")
           .outdir(classes)
           .files(findJavaFiles(moduleSrc))
@@ -180,21 +181,21 @@
         Path jar = prepareTestJar(base);
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package api; public class Api { public static void test() { } }",
                           "package impl; public class Impl { { api.Api.test(); } }");
 
         new JavacTask(tb)
           .options("--class-path", jar.toString(),
                    "--module-source-path", moduleSrc.toString(),
-                   "--add-reads", "m1=ALL-UNNAMED",
+                   "--add-reads", "m1x=ALL-UNNAMED",
                    "-XDrawDiagnostics")
           .outdir(classes)
           .files(m1.resolve("impl").resolve("Impl.java"))
@@ -279,9 +280,9 @@
     @Test
     public void testX(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { provides java.lang.Runnable with impl.Impl; }",
+                          "module m1x { provides java.lang.Runnable with impl.Impl; }",
                           "package impl; public class Impl implements Runnable { public void run() { } }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
@@ -302,8 +303,8 @@
                           "package impl; public class Impl { }");
 
         new JavacTask(tb)
-          .options("--add-reads", "m1=ALL-UNNAMED",
-                   "-Xmodule:m1",
+          .options("--add-reads", "m1x=ALL-UNNAMED",
+                   "-Xmodule:m1x",
                    "--module-path", classes.toString())
           .outdir(unnamedClasses)
           .files(findJavaFiles(unnamedSrc))
@@ -314,16 +315,16 @@
     @Test
     public void testAddSelf(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-reads", "m1=m1")
+                         "--add-reads", "m1x=m1x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -357,24 +358,24 @@
     @Test
     public void testEmptyItem(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { }",
+                          "module m3x { }",
                           "package p3; class C3 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        testEmptyItem(src, classes, "m3=,m1");
-        testEmptyItem(src, classes, "m3=m1,,m2");
-        testEmptyItem(src, classes, "m3=m1,");
+        testEmptyItem(src, classes, "m3x=,m1x");
+        testEmptyItem(src, classes, "m3x=m1x,,m2x");
+        testEmptyItem(src, classes, "m3x=m1x,");
     }
 
     private void testEmptyItem(Path src, Path classes, String option) throws Exception {
@@ -390,23 +391,23 @@
     @Test
     public void testEmptyList(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { }",
+                          "module m3x { }",
                           "package p3; class C3 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        testEmptyList(src, classes, "m3=");
-        testEmptyList(src, classes, "m3=,");
+        testEmptyList(src, classes, "m3x=");
+        testEmptyList(src, classes, "m3x=,");
     }
 
     private void testEmptyList(Path src, Path classes, String option) throws Exception {
@@ -426,25 +427,25 @@
     @Test
     public void testMultipleAddReads_DifferentModules(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { }",
+                          "module m3x { }",
                           "package p3; class C3 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-reads", "m2=m1",
-                         "--add-reads", "m3=m1")
+                         "--add-reads", "m2x=m1x",
+                         "--add-reads", "m3x=m1x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -454,25 +455,25 @@
     @Test
     public void testMultipleAddReads_SameModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { exports p2; }",
+                          "module m2x { exports p2; }",
                           "package p2; public class C2 { }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { }",
+                          "module m3x { }",
                           "package p3; class C3 { p1.C1 c1; p2.C2 c2; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-reads", "m3=m1",
-                         "--add-reads", "m3=m2")
+                         "--add-reads", "m3x=m1x",
+                         "--add-reads", "m3x=m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -482,20 +483,20 @@
     @Test
     public void testDuplicateAddReads_SameOption(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { exports p2; }",
+                          "module m2x { exports p2; }",
                           "package p2; class C2 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-reads", "m2=m1,m1")
+                         "--add-reads", "m2x=m1x,m1x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -505,21 +506,21 @@
     @Test
     public void testDuplicateAddReads_MultipleOptions(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package p2; class C2 { p1.C1 c1; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-reads", "m2=m1",
-                         "--add-reads", "m2=m1")
+                         "--add-reads", "m2x=m1x",
+                         "--add-reads", "m2x=m1x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -529,25 +530,25 @@
     @Test
     public void testRepeatedAddReads(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { exports p2; }",
+                          "module m2x { exports p2; }",
                           "package p2; public class C2 { }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { }",
+                          "module m3x { }",
                           "package p3; class C3 { p1.C1 c1; p2.C2 c2; }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--add-reads", "m3=m1",
-                         "--add-reads", "m3=m2")
+                         "--add-reads", "m3x=m1x",
+                         "--add-reads", "m3x=m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -563,7 +564,7 @@
 
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
-                         "--add-reads", "m1:m2")
+                         "--add-reads", "m1x:m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run(Task.Expect.FAIL)
@@ -571,7 +572,7 @@
                 .getOutput(Task.OutputKind.DIRECT);
 
         checkOutputContains(log,
-            "javac: bad value for --add-reads option: 'm1:m2'");
+            "javac: bad value for --add-reads option: 'm1x:m2x'");
     }
 
     @Test
@@ -583,7 +584,7 @@
 
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
-                         "--add-reads", "bad*Source=m2")
+                         "--add-reads", "bad*Source=m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -597,16 +598,16 @@
     @Test
     public void testBadTargetName(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package p1; class C1 { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
-                         "--add-reads", "m1=badTarget!")
+                         "--add-reads", "m1x=badTarget!")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -620,16 +621,16 @@
     @Test
     public void testSourceNameNotFound(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
-                         "--add-reads", "missingSource=m1")
+                         "--add-reads", "missingSource=m")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -643,16 +644,16 @@
     @Test
     public void testTargetNameNotFound(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports p1; }",
+                          "module m1x { exports p1; }",
                           "package p1; public class C1 { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
-                         "--add-reads", "m1=missingTarget")
+                         "--add-reads", "m1x=missingTarget")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
--- a/langtools/test/tools/javac/modules/AnnotationProcessing.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AnnotationProcessing.java	Fri Dec 16 11:58:18 2016 -0800
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8133884 8162711
+ * @bug 8133884 8162711 8133896
  * @summary Verify that annotation processing works.
  * @library /tools/lib
  * @modules
@@ -33,23 +33,36 @@
  * @run main AnnotationProcessing
  */
 
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.FilerException;
 import javax.annotation.processing.Messager;
+import javax.annotation.processing.ProcessingEnvironment;
 import javax.annotation.processing.RoundEnvironment;
 import javax.annotation.processing.SupportedAnnotationTypes;
 import javax.annotation.processing.SupportedOptions;
 import javax.lang.model.SourceVersion;
 import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.ModuleElement.ProvidesDirective;
 import javax.lang.model.element.ModuleElement.UsesDirective;
@@ -60,10 +73,20 @@
 import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.ElementScanner9;
 import javax.tools.Diagnostic.Kind;
+import javax.tools.FileObject;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
 
 import toolbox.JavacTask;
 import toolbox.Task;
 import toolbox.Task.Mode;
+import toolbox.Task.OutputKind;
 
 public class AnnotationProcessing extends ModuleTestBase {
 
@@ -74,20 +97,20 @@
     @Test
     public void testAPSingleModule(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package impl; public class Impl { }");
 
         String log = new JavacTask(tb)
                 .options("--module-source-path", moduleSrc.toString(),
                          "-processor", AP.class.getName(),
-                         "-AexpectedEnclosedElements=m1=>impl")
+                         "-AexpectedEnclosedElements=m1x=>impl")
                 .outdir(classes)
                 .files(findJavaFiles(moduleSrc))
                 .run()
@@ -101,25 +124,25 @@
     @Test
     public void testAPMultiModule(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
-        Path m2 = moduleSrc.resolve("m2");
+        Path m1 = moduleSrc.resolve("m1x");
+        Path m2 = moduleSrc.resolve("m2x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package impl1; public class Impl1 { }");
 
         tb.writeJavaFiles(m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package impl2; public class Impl2 { }");
 
         String log = new JavacTask(tb)
                 .options("--module-source-path", moduleSrc.toString(),
                          "-processor", AP.class.getName(),
-                         "-AexpectedEnclosedElements=m1=>impl1,m2=>impl2")
+                         "-AexpectedEnclosedElements=m1x=>impl1,m2x=>impl2")
                 .outdir(classes)
                 .files(findJavaFiles(moduleSrc))
                 .run()
@@ -135,6 +158,7 @@
     public static final class AP extends AbstractProcessor {
 
         private Map<String, List<String>> module2ExpectedEnclosedElements;
+        private Set<String> seenModules = new HashSet<>();
 
         @Override
         public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
@@ -181,12 +205,16 @@
                               .map(p -> p.getQualifiedName().toString())
                               .collect(Collectors.toList());
 
-                assertEquals(module2ExpectedEnclosedElements.remove(module.getQualifiedName().toString()),
+                String moduleName = module.getQualifiedName().toString();
+
+                assertEquals(module2ExpectedEnclosedElements.get(moduleName),
                              actualElements);
+
+                seenModules.add(moduleName);
             }
 
             if (roundEnv.processingOver()) {
-                assertEquals(true, module2ExpectedEnclosedElements.isEmpty());
+                assertEquals(module2ExpectedEnclosedElements.keySet(), seenModules);
             }
 
             return false;
@@ -202,14 +230,14 @@
     @Test
     public void testVerifyUsesProvides(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { exports api; uses api.Api; provides api.Api with impl.Impl; }",
+                          "module m1x { exports api; uses api.Api; provides api.Api with impl.Impl; }",
                           "package api; public class Api { }",
                           "package impl; public class Impl extends api.Api { }");
 
@@ -307,20 +335,20 @@
     @Test
     public void testQualifiedClassForProcessing(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
-        Path m2 = moduleSrc.resolve("m2");
+        Path m1 = moduleSrc.resolve("m1x");
+        Path m2 = moduleSrc.resolve("m2x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
-                          "package impl; public class Impl { int m1; }");
+                          "module m1x { }",
+                          "package impl; public class Impl { int m1x; }");
 
         tb.writeJavaFiles(m2,
-                          "module m2 { }",
-                          "package impl; public class Impl { int m2; }");
+                          "module m2x { }",
+                          "package impl; public class Impl { int m2x; }");
 
         new JavacTask(tb)
             .options("--module-source-path", moduleSrc.toString())
@@ -330,13 +358,13 @@
             .writeAll()
             .getOutput(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("Note: field: m1");
+        List<String> expected = Arrays.asList("Note: field: m1x");
 
         for (Mode mode : new Mode[] {Mode.API, Mode.CMDLINE}) {
             List<String> log = new JavacTask(tb, mode)
                     .options("-processor", QualifiedClassForProcessing.class.getName(),
                              "--module-path", classes.toString())
-                    .classes("m1/impl.Impl")
+                    .classes("m1x/impl.Impl")
                     .outdir(classes)
                     .run()
                     .writeAll()
@@ -352,8 +380,8 @@
 
         @Override
         public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-            if (processingEnv.getElementUtils().getModuleElement("m1") == null) {
-                throw new AssertionError("No m1 module found.");
+            if (processingEnv.getElementUtils().getModuleElement("m1x") == null) {
+                throw new AssertionError("No m1x module found.");
             }
 
             Messager messager = processingEnv.getMessager();
@@ -374,6 +402,779 @@
 
     }
 
+    @Test
+    public void testModuleInRootElements(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1");
+
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        tb.writeJavaFiles(m1,
+                          "module m1x { exports api; }",
+                          "package api; public class Api { }");
+
+        List<String> log = new JavacTask(tb)
+                .options("-processor", ModuleInRootElementsAP.class.getName())
+                .outdir(classes)
+                .files(findJavaFiles(moduleSrc))
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.STDERR);
+
+        assertEquals(Arrays.asList("module: m1x"), log);
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class ModuleInRootElementsAP extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            roundEnv.getRootElements()
+                    .stream()
+                    .filter(el -> el.getKind() == ElementKind.MODULE)
+                    .forEach(mod -> System.err.println("module: " + mod.getSimpleName()));
+
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+    }
+
+    @Test
+    public void testAnnotationsInModuleInfo(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1");
+
+        tb.writeJavaFiles(m1,
+                          "@Deprecated module m1x { }");
+
+        Path m2 = moduleSrc.resolve("m2x");
+
+        tb.writeJavaFiles(m2,
+                          "@SuppressWarnings(\"\") module m2x { }");
+
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-processor", AnnotationsInModuleInfoPrint.class.getName())
+                .outdir(classes)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expectedLog = Arrays.asList("Note: AP Invoked",
+                                                 "Note: AP Invoked");
+
+        assertEquals(expectedLog, log);
+
+        new JavacTask(tb)
+            .options("-processor", AnnotationsInModuleInfoFail.class.getName())
+            .outdir(classes)
+            .files(findJavaFiles(m2))
+            .run()
+            .writeAll();
+    }
+
+    @SupportedAnnotationTypes("java.lang.Deprecated")
+    public static final class AnnotationsInModuleInfoPrint extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            processingEnv.getMessager().printMessage(Kind.NOTE, "AP Invoked");
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+    }
+
+    @SupportedAnnotationTypes("java.lang.Deprecated")
+    public static final class AnnotationsInModuleInfoFail extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            throw new AssertionError();
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+    }
+
+    @Test
+    public void testGenerateInMultiModeAPI(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        Path m1 = moduleSrc.resolve("m1x");
+
+        tb.writeJavaFiles(m1,
+                          "module m1x { exports api1; }",
+                          "package api1; public class Api { GenApi ga; impl.Impl i; }");
+
+        writeFile("1", m1, "api1", "api");
+        writeFile("1", m1, "impl", "impl");
+
+        Path m2 = moduleSrc.resolve("m2x");
+
+        tb.writeJavaFiles(m2,
+                          "module m2x { requires m1x; exports api2; }",
+                          "package api2; public class Api { api1.GenApi ga1; GenApi qa2; impl.Impl i;}");
+
+        writeFile("2", m2, "api2", "api");
+        writeFile("2", m2, "impl", "impl");
+
+        for (FileType fileType : FileType.values()) {
+            if (Files.isDirectory(classes)) {
+                tb.cleanDirectory(classes);
+            } else {
+                Files.createDirectories(classes);
+            }
+
+            new JavacTask(tb)
+              .options("-processor", MultiModeAPITestAP.class.getName(),
+                       "--module-source-path", moduleSrc.toString(),
+                       "-Afiletype=" + fileType.name())
+              .outdir(classes)
+              .files(findJavaFiles(moduleSrc))
+              .run()
+              .writeAll();
+
+            assertFileExists(classes, "m1x", "api1", "GenApi.class");
+            assertFileExists(classes, "m1x", "impl", "Impl.class");
+            assertFileExists(classes, "m1x", "api1", "gen1");
+            assertFileExists(classes, "m2x", "api2", "GenApi.class");
+            assertFileExists(classes, "m2x", "impl", "Impl.class");
+            assertFileExists(classes, "m2x", "api2", "gen1");
+        }
+    }
+
+    enum FileType {
+        SOURCE,
+        CLASS;
+    }
+
+    public static abstract class GeneratingAP extends AbstractProcessor {
+
+        void createSource(CreateFileObject file, String name, String content) {
+            try (Writer out = file.create().openWriter()) {
+                out.write(content);
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        void createClass(CreateFileObject file, String name, String content) {
+            String fileNameStub = name.replace(".", File.separator);
+
+            try (OutputStream out = file.create().openOutputStream()) {
+                Path scratch = Files.createDirectories(Paths.get(""));
+                Path scratchSrc = scratch.resolve(fileNameStub + ".java").toAbsolutePath();
+
+                Files.createDirectories(scratchSrc.getParent());
+
+                try (Writer w = Files.newBufferedWriter(scratchSrc)) {
+                    w.write(content);
+                }
+
+                Path scratchClasses = scratch.resolve("classes");
+
+                Files.createDirectories(scratchClasses);
+
+                JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+                try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
+                    List<String> options = Arrays.asList("-d", scratchClasses.toString());
+                    Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(scratchSrc);
+                    CompilationTask task = comp.getTask(null, fm, null, options, null, files);
+
+                    if (!task.call()) {
+                        throw new AssertionError("compilation failed");
+                    }
+                }
+
+                Path classfile = scratchClasses.resolve(fileNameStub + ".class");
+
+                Files.copy(classfile, out);
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        void doReadResource(CreateFileObject file, String expectedContent) {
+            try {
+                StringBuilder actualContent = new StringBuilder();
+
+                try (Reader r = file.create().openReader(true)) {
+                    int read;
+
+                    while ((read = r.read()) != (-1)) {
+                        actualContent.append((char) read);
+                    }
+
+                }
+
+                assertEquals(expectedContent, actualContent.toString());
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        public interface CreateFileObject {
+            public FileObject create() throws IOException;
+        }
+
+        void expectFilerException(Callable<Object> c) {
+            try {
+                c.call();
+                throw new AssertionError("Expected exception not thrown");
+            } catch (FilerException ex) {
+                //expected
+            } catch (Exception ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+    }
+
+    @SupportedAnnotationTypes("*")
+    @SupportedOptions({"filetype", "modulename"})
+    public static final class MultiModeAPITestAP extends GeneratingAP {
+
+        int round;
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (round++ != 0)
+                return false;
+
+            createClass("m1x", "api1.GenApi", "package api1; public class GenApi {}");
+            createClass("m1x", "impl.Impl", "package impl; public class Impl {}");
+            createClass("m2x", "api2.GenApi", "package api2; public class GenApi {}");
+            createClass("m2x", "impl.Impl", "package impl; public class Impl {}");
+
+            createResource("m1x", "api1", "gen1");
+            createResource("m2x", "api2", "gen1");
+
+            readResource("m1x", "api1", "api", "1");
+            readResource("m1x", "impl", "impl", "1");
+            readResource("m2x", "api2", "api", "2");
+            readResource("m2x", "impl", "impl", "2");
+
+            Filer filer = processingEnv.getFiler();
+
+            expectFilerException(() -> filer.createSourceFile("fail.Fail"));
+            expectFilerException(() -> filer.createClassFile("fail.Fail"));
+            expectFilerException(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "fail", "fail"));
+            expectFilerException(() -> filer.getResource(StandardLocation.MODULE_SOURCE_PATH, "fail", "fail"));
+
+            //must not generate to unnamed package:
+            expectFilerException(() -> filer.createSourceFile("m1/Fail"));
+            expectFilerException(() -> filer.createClassFile("m1/Fail"));
+
+            //cannot generate resources to modules that are not root modules:
+            expectFilerException(() -> filer.createSourceFile("java.base/fail.Fail"));
+            expectFilerException(() -> filer.createClassFile("java.base/fail.Fail"));
+            expectFilerException(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "java.base/fail", "Fail"));
+
+            return false;
+        }
+
+        void createClass(String expectedModule, String name, String content) {
+            Filer filer = processingEnv.getFiler();
+            FileType filetype = FileType.valueOf(processingEnv.getOptions().getOrDefault("filetype", ""));
+
+            switch (filetype) {
+                case SOURCE:
+                    createSource(() -> filer.createSourceFile(expectedModule + "/" + name), name, content);
+                    break;
+                case CLASS:
+                    createClass(() -> filer.createClassFile(expectedModule + "/" + name), name, content);
+                    break;
+                default:
+                    throw new AssertionError("Unexpected filetype: " + filetype);
+            }
+        }
+
+        void createResource(String expectedModule, String pkg, String relName) {
+            try {
+                Filer filer = processingEnv.getFiler();
+
+                filer.createResource(StandardLocation.CLASS_OUTPUT, expectedModule + "/" + pkg, relName)
+                     .openOutputStream()
+                     .close();
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        void readResource(String expectedModule, String pkg, String relName, String expectedContent) {
+            Filer filer = processingEnv.getFiler();
+
+            doReadResource(() -> filer.getResource(StandardLocation.MODULE_SOURCE_PATH, expectedModule + "/" + pkg, relName),
+                           expectedContent);
+        }
+
+    }
+
+    @Test
+    public void testGenerateInSingleNameModeAPI(Path base) throws Exception {
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        Path m1 = base.resolve("module-src");
+
+        tb.writeJavaFiles(m1,
+                          "module m1x { }");
+
+        writeFile("3", m1, "impl", "resource");
+
+        new JavacTask(tb)
+          .options("-processor", SingleNameModeAPITestAP.class.getName(),
+                   "-sourcepath", m1.toString())
+          .outdir(classes)
+          .files(findJavaFiles(m1))
+          .run()
+          .writeAll();
+
+        assertFileExists(classes, "impl", "Impl1.class");
+        assertFileExists(classes, "impl", "Impl2.class");
+        assertFileExists(classes, "impl", "Impl3");
+        assertFileExists(classes, "impl", "Impl4.class");
+        assertFileExists(classes, "impl", "Impl5.class");
+        assertFileExists(classes, "impl", "Impl6");
+        assertFileExists(classes, "impl", "Impl7.class");
+        assertFileExists(classes, "impl", "Impl8.class");
+        assertFileExists(classes, "impl", "Impl9");
+    }
+
+
+    @SupportedAnnotationTypes("*")
+    public static final class SingleNameModeAPITestAP extends GeneratingAP {
+
+        int round;
+
+        @Override
+        public synchronized void init(ProcessingEnvironment processingEnv) {
+            super.init(processingEnv);
+        }
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (round++ != 0)
+                return false;
+
+            Filer filer = processingEnv.getFiler();
+
+            createSource(() -> filer.createSourceFile("impl.Impl1"), "impl.Impl1", "package impl; class Impl1 {}");
+            createClass(() -> filer.createClassFile("impl.Impl2"), "impl.Impl2", "package impl; class Impl2 {}");
+            createSource(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "impl", "Impl3"), "impl.Impl3", "");
+            doReadResource(() -> filer.getResource(StandardLocation.SOURCE_PATH, "impl", "resource"), "3");
+
+            createSource(() -> filer.createSourceFile("m1x/impl.Impl4"), "impl.Impl4", "package impl; class Impl4 {}");
+            createClass(() -> filer.createClassFile("m1x/impl.Impl5"), "impl.Impl5", "package impl; class Impl5 {}");
+            createSource(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "m1x/impl", "Impl6"), "impl.Impl6", "");
+            doReadResource(() -> filer.getResource(StandardLocation.SOURCE_PATH, "m1x/impl", "resource"), "3");
+
+            TypeElement jlObject = processingEnv.getElementUtils().getTypeElement("java.lang.Object");
+
+            //"broken" originating element:
+            createSource(() -> filer.createSourceFile("impl.Impl7", jlObject), "impl.Impl7", "package impl; class Impl7 {}");
+            createClass(() -> filer.createClassFile("impl.Impl8", jlObject), "impl.Impl8", "package impl; class Impl8 {}");
+            createSource(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "impl", "Impl9", jlObject), "impl.Impl9", "");
+
+            //must not generate to unnamed package:
+            expectFilerException(() -> filer.createSourceFile("Fail"));
+            expectFilerException(() -> filer.createClassFile("Fail"));
+            expectFilerException(() -> filer.createSourceFile("m1x/Fail"));
+            expectFilerException(() -> filer.createClassFile("m1x/Fail"));
+
+            //cannot generate resources to modules that are not root modules:
+            expectFilerException(() -> filer.createSourceFile("java.base/fail.Fail"));
+            expectFilerException(() -> filer.createClassFile("java.base/fail.Fail"));
+            expectFilerException(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "java.base/fail", "Fail"));
+
+            return false;
+        }
+
+    }
+
+    @Test
+    public void testGenerateInUnnamedModeAPI(Path base) throws Exception {
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        Path src = base.resolve("src");
+
+        tb.writeJavaFiles(src,
+                          "class T {}");
+
+        new JavacTask(tb)
+          .options("-processor", UnnamedModeAPITestAP.class.getName(),
+                   "-sourcepath", src.toString())
+          .outdir(classes)
+          .files(findJavaFiles(src))
+          .run()
+          .writeAll();
+
+        assertFileExists(classes, "Impl1.class");
+        assertFileExists(classes, "Impl2.class");
+    }
+
+    @Test
+    public void testGenerateInNoModeAPI(Path base) throws Exception {
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        Path src = base.resolve("src");
+
+        tb.writeJavaFiles(src,
+                          "class T {}");
+
+        new JavacTask(tb)
+          .options("-processor", UnnamedModeAPITestAP.class.getName(),
+                   "-source", "8", "-target", "8",
+                   "-sourcepath", src.toString())
+          .outdir(classes)
+          .files(findJavaFiles(src))
+          .run()
+          .writeAll();
+
+        assertFileExists(classes, "Impl1.class");
+        assertFileExists(classes, "Impl2.class");
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class UnnamedModeAPITestAP extends GeneratingAP {
+
+        int round;
+
+        @Override
+        public synchronized void init(ProcessingEnvironment processingEnv) {
+            super.init(processingEnv);
+        }
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (round++ != 0)
+                return false;
+
+            Filer filer = processingEnv.getFiler();
+
+            //must not generate to unnamed package:
+            createSource(() -> filer.createSourceFile("Impl1"), "Impl1", "class Impl1 {}");
+            createClass(() -> filer.createClassFile("Impl2"), "Impl2", "class Impl2 {}");
+
+            return false;
+        }
+
+    }
+
+    @Test
+    public void testDisambiguateAnnotations(Path base) throws Exception {
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1x");
+
+        tb.writeJavaFiles(m1,
+                          "module m1x { exports api; }",
+                          "package api; public @interface A {}",
+                          "package api; public @interface B {}");
+
+        Path m2 = src.resolve("m2x");
+
+        tb.writeJavaFiles(m2,
+                          "module m2x { exports api; }",
+                          "package api; public @interface A {}",
+                          "package api; public @interface B {}");
+
+        Path m3 = src.resolve("m3x");
+
+        tb.writeJavaFiles(m3,
+                          "module m3x { requires m1x; }",
+                          "package impl; import api.*; @A @B public class T {}");
+
+        Path m4 = src.resolve("m4x");
+
+        tb.writeJavaFiles(m4,
+                          "module m4x { requires m2x; }",
+                          "package impl; import api.*; @A @B public class T {}");
+
+        List<String> log;
+        List<String> expected;
+
+        log = new JavacTask(tb)
+            .options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(),
+                     "--module-source-path", src.toString(),
+                     "-m", "m1x,m2x")
+            .outdir(classes)
+            .run()
+            .writeAll()
+            .getOutputLines(OutputKind.STDERR);
+
+        expected = Arrays.asList("");
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Output does not match; output: " + log);
+        }
+
+        log = new JavacTask(tb)
+            .options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(),
+                     "--module-source-path", src.toString(),
+                     "-m", "m3x")
+            .outdir(classes)
+            .run()
+            .writeAll()
+            .getOutputLines(OutputKind.STDERR);
+
+        expected = Arrays.asList("SelectAnnotationBTestAP",
+                                 "SelectAnnotationBTestAP");
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Output does not match; output: " + log);
+        }
+
+        log = new JavacTask(tb)
+            .options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(),
+                     "--module-source-path", src.toString(),
+                     "-m", "m4x")
+            .outdir(classes)
+            .run()
+            .writeAll()
+            .getOutputLines(OutputKind.STDERR);
+
+        expected = Arrays.asList("SelectAnnotationATestAP",
+                                 "SelectAnnotationBTestAP",
+                                 "SelectAnnotationATestAP",
+                                 "SelectAnnotationBTestAP");
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Output does not match; output: " + log);
+        }
+    }
+
+    @SupportedAnnotationTypes("m2x/api.A")
+    public static final class SelectAnnotationATestAP extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            System.err.println("SelectAnnotationATestAP");
+
+            return false;
+        }
+
+    }
+
+    @SupportedAnnotationTypes("api.B")
+    public static final class SelectAnnotationBTestAP extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            System.err.println("SelectAnnotationBTestAP");
+
+            return false;
+        }
+
+    }
+
+    private static void writeFile(String content, Path base, String... pathElements) throws IOException {
+        Path file = resolveFile(base, pathElements);
+
+        Files.createDirectories(file.getParent());
+
+        try (Writer out = Files.newBufferedWriter(file)) {
+            out.append(content);
+        }
+    }
+
+    @Test
+    public void testUnboundLookup(Path base) throws Exception {
+        Path src = base.resolve("src");
+
+        tb.writeJavaFiles(src,
+                          "package impl.conflict.src; public class Impl { }");
+
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1x");
+        Path m2 = moduleSrc.resolve("m2x");
+
+        Path classes = base.resolve("classes");
+        Path cpClasses = base.resolve("cpClasses");
+
+        Files.createDirectories(classes);
+        Files.createDirectories(cpClasses);
+
+        tb.writeJavaFiles(m1,
+                          "module m1x { }",
+                          "package impl1; public class Impl { }",
+                          "package impl.conflict.module; class Impl { }",
+                          "package impl.conflict.clazz; public class pkg { public static class I { } }",
+                          "package impl.conflict.src; public class Impl { }");
+
+        tb.writeJavaFiles(m2,
+                          "module m2x { }",
+                          "package impl2; public class Impl { }",
+                          "package impl.conflict.module; class Impl { }",
+                          "package impl.conflict; public class clazz { public static class pkg { } }");
+
+        //from source:
+        new JavacTask(tb)
+            .options("--module-source-path", moduleSrc.toString(),
+                     "--source-path", src.toString(),
+                     "-processorpath", System.getProperty("test.class.path"),
+                     "-processor", UnboundLookup.class.getName())
+            .outdir(classes)
+            .files(findJavaFiles(moduleSrc))
+            .run()
+            .writeAll();
+
+        new JavacTask(tb)
+            .options("--source-path", src.toString())
+            .outdir(cpClasses)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll();
+
+        //from classfiles:
+        new JavacTask(tb)
+            .options("--module-path", classes.toString(),
+                     "--class-path", cpClasses.toString(),
+                     "--add-modules", "m1x,m2x",
+                     "-processorpath", System.getProperty("test.class.path"),
+                     "-processor", UnboundLookup.class.getName(),
+                     "-proc:only")
+            .classes("java.lang.Object")
+            .run()
+            .writeAll();
+
+        //source 8:
+        new JavacTask(tb)
+            .options("--source-path", src.toString(),
+                     "-source", "8",
+                     "-processorpath", System.getProperty("test.class.path"),
+                     "-processor", UnboundLookup8.class.getName())
+            .outdir(cpClasses)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll();
+
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class UnboundLookup extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            assertTypeElementExists("impl1.Impl", "m1x");
+            assertPackageElementExists("impl1", "m1x");
+            assertTypeElementExists("impl2.Impl", "m2x");
+            assertTypeElementExists("impl.conflict.clazz.pkg.I", "m1x");
+            assertTypeElementExists("impl.conflict.clazz", "m2x");
+            assertPackageElementExists("impl.conflict.clazz", "m1x");
+            assertPackageElementExists("impl2", "m2x");
+            assertTypeElementNotFound("impl.conflict.module.Impl");
+            assertPackageElementNotFound("impl.conflict.module");
+            assertTypeElementNotFound("impl.conflict.src.Impl");
+            assertPackageElementNotFound("impl.conflict.src");
+            assertTypeElementNotFound("impl.conflict.clazz.pkg");
+
+            return false;
+        }
+
+        private void assertTypeElementExists(String name, String expectedModule) {
+            assertElementExists(name, "class", processingEnv.getElementUtils() :: getTypeElement, expectedModule);
+        }
+
+        private void assertPackageElementExists(String name, String expectedModule) {
+            assertElementExists(name, "package", processingEnv.getElementUtils() :: getPackageElement, expectedModule);
+        }
+
+        private void assertElementExists(String name, String type, Function<String, Element> getter, String expectedModule) {
+            Element clazz = getter.apply(name);
+
+            if (clazz == null) {
+                throw new AssertionError("No " + name + " " + type + " found.");
+            }
+
+            ModuleElement mod = processingEnv.getElementUtils().getModuleOf(clazz);
+
+            if (!mod.getQualifiedName().contentEquals(expectedModule)) {
+                throw new AssertionError(name + " found in an unexpected module: " + mod.getQualifiedName());
+            }
+        }
+
+        private void assertTypeElementNotFound(String name) {
+            assertElementNotFound(name, processingEnv.getElementUtils() :: getTypeElement);
+        }
+
+        private void assertPackageElementNotFound(String name) {
+            assertElementNotFound(name, processingEnv.getElementUtils() :: getPackageElement);
+        }
+
+        private void assertElementNotFound(String name, Function<String, Element> getter) {
+            Element found = getter.apply(name);
+
+            if (found != null) {
+                fail("Element found unexpectedly: " + found);
+            }
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class UnboundLookup8 extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (processingEnv.getElementUtils().getTypeElement("impl.conflict.src.Impl") == null) {
+                throw new AssertionError("impl.conflict.src.Impl.");
+            }
+
+            if (processingEnv.getElementUtils().getModuleElement("java.base") != null) {
+                throw new AssertionError("getModuleElement != null for -source 8");
+            }
+
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+    }
+
     private static void assertNonNull(String msg, Object val) {
         if (val == null) {
             throw new AssertionError(msg);
@@ -392,4 +1193,26 @@
         }
     }
 
+    private static void assertFileExists(Path base, String... pathElements) {
+        Path file = resolveFile(base, pathElements);
+
+        if (!Files.exists(file)) {
+            throw new AssertionError("Expected file: " + file + " exist, but it does not.");
+        }
+    }
+
+    static Path resolveFile(Path base, String... pathElements) {
+        Path file = base;
+
+        for (String el : pathElements) {
+            file = file.resolve(el);
+        }
+
+        return file;
+    }
+
+    private static void fail(String msg) {
+        throw new AssertionError(msg);
+    }
+
 }
--- a/langtools/test/tools/javac/modules/AnnotationProcessorsInModulesTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AnnotationProcessorsInModulesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -38,7 +38,6 @@
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class AnnotationProcessorsInModulesTest extends ModuleTestBase {
 
@@ -47,7 +46,7 @@
     }
 
     private static final String annotationProcessorModule1 =
-            "module anno_proc1 {\n" +
+            "module anno_proc1x {\n" +
             "    requires java.compiler;\n" +
             "\n" +
             "    provides javax.annotation.processing.Processor\n" +
@@ -55,7 +54,7 @@
             "}";
 
     private static final String annotationProcessorModule2 =
-            "module anno_proc2 {\n" +
+            "module anno_proc2x {\n" +
             "    requires java.compiler;\n" +
             "\n" +
             "    provides javax.annotation.processing.Processor\n" +
@@ -118,8 +117,8 @@
 
     void initialization(Path base) throws Exception {
         moduleSrc = base.resolve("anno_proc_src");
-        Path anno_proc1 = moduleSrc.resolve("anno_proc1");
-        Path anno_proc2 = moduleSrc.resolve("anno_proc2");
+        Path anno_proc1 = moduleSrc.resolve("anno_proc1x");
+        Path anno_proc2 = moduleSrc.resolve("anno_proc2x");
 
         processorCompiledModules = base.resolve("mods");
 
--- a/langtools/test/tools/javac/modules/AnnotationsOnModules.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AnnotationsOnModules.java	Fri Dec 16 11:58:18 2016 -0800
@@ -21,14 +21,14 @@
  * questions.
  */
 
-/**
+/*
  * @test
- * @summary Test --add-modules and --limit-modules; also test the "enabled" modules.
+ * @summary Test annotations on module declaration.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask toolbox.JavaTask ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main AnnotationsOnModules
  */
 
@@ -55,6 +55,7 @@
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
 import toolbox.JavacTask;
+import toolbox.Task;
 import toolbox.Task.OutputKind;
 
 public class AnnotationsOnModules extends ModuleTestBase {
@@ -67,10 +68,10 @@
     @Test
     public void testSimpleAnnotation(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "@Deprecated module m1 { }");
+                          "@Deprecated module m1x { }");
 
         Path modulePath = base.resolve("module-path");
 
@@ -83,7 +84,7 @@
                 .run()
                 .writeAll();
 
-        ClassFile cf = ClassFile.read(modulePath.resolve("m1").resolve("module-info.class"));
+        ClassFile cf = ClassFile.read(modulePath.resolve("m1x").resolve("module-info.class"));
         RuntimeVisibleAnnotations_attribute annotations = (RuntimeVisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeVisibleAnnotations);
 
         if (annotations == null || annotations.annotations.length != 1) {
@@ -91,14 +92,213 @@
         }
     }
 
+    //Test @ignore JDK-8171255
+    public void testSimpleJavadocDeprecationTag(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("src1/A");
+
+        tb.writeJavaFiles(m1,
+                "/** @deprecated */ module A { }");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        List<String> warning = new JavacTask(tb)
+                .options("--module-source-path", m1.getParent().toString(),
+                        "-XDrawDiagnostics")
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll()
+                .getOutputLines(OutputKind.DIRECT);
+
+        List<String> expected = List.of(
+                "module-info.java:1:20: compiler.warn.missing.deprecated.annotation",
+                "1 warning");
+        if (!warning.containsAll(expected)) {
+            throw new AssertionError("Expected output not found. Expected: " + expected);
+        }
+
+        Path m2 = base.resolve("src2/B");
+
+        tb.writeJavaFiles(m2,
+                "module B { requires A; }");
+        String log = new JavacTask(tb)
+                .options("--module-source-path", m2.getParent().toString(),
+                        "--module-path", modulePath.toString(),
+                        "-XDrawDiagnostics")
+                .outdir(modulePath)
+                .files(findJavaFiles(m2))
+                .run()
+                .writeAll()
+                .getOutput(OutputKind.DIRECT);
+
+        if (!log.isEmpty()) {
+            throw new AssertionError("Output is not empty. Expected no output and no warnings.");
+        }
+
+        ClassFile cf = ClassFile.read(modulePath.resolve("A").resolve("module-info.class"));
+        RuntimeVisibleAnnotations_attribute annotations = (RuntimeVisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeVisibleAnnotations);
+
+        if (annotations != null && annotations.annotations.length > 0) {
+            throw new AssertionError("Found annotation attributes. Expected no annotations for javadoc @deprecated tag.");
+        }
+
+        if (cf.attributes.map.get(Attribute.Deprecated) != null) {
+            throw new AssertionError("Found Deprecated attribute. Expected no Deprecated attribute for javadoc @deprecated tag.");
+        }
+    }
+
+    @Test
+    public void testEnhancedDeprecatedAnnotation(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("src1/A");
+
+        tb.writeJavaFiles(m1,
+                "@Deprecated(since=\"10.X\", forRemoval=true) module A { }");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", m1.getParent().toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll();
+
+        Path m2 = base.resolve("src2/B");
+
+        tb.writeJavaFiles(m2,
+                "module B { requires A; }");
+        List<String> log = new JavacTask(tb)
+                .options("--module-source-path", m2.getParent().toString(),
+                        "--module-path", modulePath.toString(),
+                        "-XDrawDiagnostics")
+                .outdir(modulePath)
+                .files(findJavaFiles(m2))
+                .run()
+                .writeAll()
+                .getOutputLines(OutputKind.DIRECT);
+
+        List<String> expected = List.of("module-info.java:1:21: compiler.warn.has.been.deprecated.for.removal.module: A",
+                "1 warning");
+        if (!log.containsAll(expected)) {
+            throw new AssertionError("Expected output not found. Expected: " + expected);
+        }
+
+        ClassFile cf = ClassFile.read(modulePath.resolve("A").resolve("module-info.class"));
+        RuntimeVisibleAnnotations_attribute annotations = (RuntimeVisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeVisibleAnnotations);
+
+        if (annotations == null ) {
+            throw new AssertionError("Annotations not found!");
+        }
+        int length = annotations.annotations.length;
+        if (length != 1 ) {
+            throw new AssertionError("Incorrect number of annotations: " + length);
+        }
+        int pairsCount = annotations.annotations[0].num_element_value_pairs;
+        if (pairsCount != 2) {
+            throw new AssertionError("Incorrect number of key-value pairs in annotation: " + pairsCount + " Expected two: forRemoval and since.");
+        }
+    }
+
+    @Test
+    public void testDeprecatedModuleRequiresDeprecatedForRemovalModule(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("src1/A");
+
+        tb.writeJavaFiles(m1,
+                "@Deprecated(forRemoval=true) module A { }");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", m1.getParent().toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll();
+
+        Path m2 = base.resolve("src2/B");
+
+        tb.writeJavaFiles(m2,
+                "@Deprecated(forRemoval=false) module B { requires A; }");
+        List<String> log = new JavacTask(tb)
+                .options("--module-source-path", m2.getParent().toString(),
+                        "--module-path", modulePath.toString(),
+                        "-XDrawDiagnostics")
+                .outdir(modulePath)
+                .files(findJavaFiles(m2))
+                .run()
+                .writeAll()
+                .getOutputLines(OutputKind.DIRECT);
+
+        List<String> expected = List.of("module-info.java:1:51: compiler.warn.has.been.deprecated.for.removal.module: A",
+                "1 warning");
+        if (!log.containsAll(expected)) {
+            throw new AssertionError("Expected output not found. Expected: " + expected);
+        }
+    }
+
+    @Test
+    public void testExportsAndOpensToDeprecatedModule(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+
+
+        tb.writeJavaFiles(moduleSrc.resolve("B"),
+                "@Deprecated module B { }");
+        tb.writeJavaFiles(moduleSrc.resolve("C"),
+                "@Deprecated(forRemoval=true) module C { }");
+
+        Path modulePath = base.resolve("module-path");
+        Files.createDirectories(modulePath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", moduleSrc.toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(moduleSrc))
+                .run()
+                .writeAll();
+
+        Path m1 = base.resolve("src1/A");
+
+        tb.writeJavaFiles(m1,
+                "module A { " +
+                        "exports p1 to B; opens p1 to B;" +
+                        "exports p2 to C; opens p2 to C;" +
+                        "exports p3 to B,C; opens p3 to B,C;" +
+                        "}",
+                "package p1; public class A { }",
+                "package p2; public class A { }",
+                "package p3; public class A { }");
+        String log = new JavacTask(tb)
+                .options("--module-source-path", m1.getParent().toString(),
+                        "--module-path", modulePath.toString(),
+                        "-XDrawDiagnostics")
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll()
+                .getOutput(OutputKind.DIRECT);
+
+        if (!log.isEmpty()) {
+            throw new AssertionError("Output is not empty! " + log);
+        }
+    }
+
     @Test
     public void testAnnotationWithImport(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "import m1.A; @A module m1 { }",
-                          "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}");
+                          "import m1x.A; @A module m1x { }",
+                          "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}");
 
         Path modulePath = base.resolve("module-path");
 
@@ -111,7 +311,7 @@
                 .run()
                 .writeAll();
 
-        ClassFile cf = ClassFile.read(modulePath.resolve("m1").resolve("module-info.class"));
+        ClassFile cf = ClassFile.read(modulePath.resolve("m1x").resolve("module-info.class"));
         RuntimeInvisibleAnnotations_attribute annotations = (RuntimeInvisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeInvisibleAnnotations);
 
         if (annotations == null || annotations.annotations.length != 1) {
@@ -120,15 +320,106 @@
     }
 
     @Test
-    public void testModuleInfoAnnotationsInAPI(Path base) throws Exception {
+    public void testAnnotationWithImportFromAnotherModule(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("src1/A");
 
         tb.writeJavaFiles(m1,
-                          "import m1.*; @A @Deprecated @E @E module m1 { }",
-                          "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}",
-                          "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) @Repeatable(C.class) public @interface E {}",
-                          "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface C { public E[] value(); }");
+                "module A { exports p1; exports p2; }",
+                "package p1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A { }",
+                "package p2; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface B { }");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", m1.getParent().toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll();
+
+        Path m2 = base.resolve("src2/B");
+
+        tb.writeJavaFiles(m2,
+                "import p1.A; @A @p2.B module B { requires A; }");
+        new JavacTask(tb)
+                .options("--module-source-path", m2.getParent().toString(),
+                        "--module-path", modulePath.toString()
+                )
+                .outdir(modulePath)
+                .files(findJavaFiles(m2))
+                .run()
+                .writeAll();
+
+        ClassFile cf = ClassFile.read(modulePath.resolve("B").resolve("module-info.class"));
+        RuntimeInvisibleAnnotations_attribute annotations = (RuntimeInvisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeInvisibleAnnotations);
+
+        if (annotations == null ) {
+            throw new AssertionError("Annotations not found!");
+        }
+        int length = annotations.annotations.length;
+        if (length != 2 ) {
+            throw new AssertionError("Incorrect number of annotations: " + length);
+        }
+    }
+
+    @Test
+    public void testAnnotationWithImportAmbiguity(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("src1/A");
+
+        tb.writeJavaFiles(m1,
+                "module A { exports p1; exports p2; }",
+                "package p1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A { }",
+                "package p2; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A { }");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", m1.getParent().toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll();
+
+        Path m2 = base.resolve("src2/B");
+
+        tb.writeJavaFiles(m2,
+                "import p1.*; import p2.*; @A module B { requires A; }");
+        List<String> log = new JavacTask(tb)
+                .options("--module-source-path", m2.getParent().toString(),
+                        "--module-path", modulePath.toString(),
+                        "-XDrawDiagnostics"
+                )
+                .outdir(modulePath)
+                .files(findJavaFiles(m2))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(OutputKind.DIRECT);
+
+        List<String> expected = List.of("module-info.java:1:28: compiler.err.ref.ambiguous: A, kindname.class, p2.A, p2, kindname.class, p1.A, p1",
+                "module-info.java:1:27: compiler.err.annotation.type.not.applicable",
+                "2 errors");
+        if (!log.containsAll(expected)) {
+            throw new AssertionError("Expected output not found. Expected: " + expected);
+        }
+
+    }
+
+    @Test
+    public void testModuleInfoAnnotationsInAPI(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1x");
+
+        tb.writeJavaFiles(m1,
+                          "import m1x.*; @A @Deprecated @E @E module m1x { }",
+                          "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}",
+                          "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) @Repeatable(C.class) public @interface E {}",
+                          "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface C { public E[] value(); }");
 
         Path modulePath = base.resolve("module-path");
 
@@ -153,7 +444,7 @@
 
         new JavacTask(tb)
                 .options("--module-path", modulePath.toString(),
-                         "--add-modules", "m1",
+                         "--add-modules", "m1x",
                          "-processor", AP.class.getName())
                 .outdir(out)
                 .files(findJavaFiles(src))
@@ -162,10 +453,10 @@
 
         new JavacTask(tb)
                 .options("--module-path", modulePath.toString() + File.pathSeparator + out.toString(),
-                         "--add-modules", "m1",
+                         "--add-modules", "m1x",
                          "-processor", AP.class.getName(),
                          "-proc:only")
-                .classes("m1/m1.A")
+                .classes("m1x/m1x.A")
                 .files(findJavaFiles(src))
                 .run()
                 .writeAll();
@@ -176,10 +467,10 @@
 
         @Override
         public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-            ModuleElement m1 = processingEnv.getElementUtils().getModuleElement("m1");
+            ModuleElement m1 = processingEnv.getElementUtils().getModuleElement("m1x");
             Set<String> actualAnnotations = new HashSet<>();
             Set<String> expectedAnnotations =
-                    new HashSet<>(Arrays.asList("@m1.A", "@java.lang.Deprecated", "@m1.C({@m1.E, @m1.E})"));
+                    new HashSet<>(Arrays.asList("@m1x.A", "@java.lang.Deprecated", "@m1x.C({@m1x.E, @m1x.E})"));
 
             for (AnnotationMirror am : m1.getAnnotationMirrors()) {
                 actualAnnotations.add(am.toString());
@@ -197,17 +488,17 @@
     @Test
     public void testModuleDeprecation(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "@Deprecated module m1 { }");
+                          "@Deprecated module m1x { }");
 
-        Path m2 = moduleSrc.resolve("m2");
+        Path m2 = moduleSrc.resolve("m2x");
 
         tb.writeJavaFiles(m2,
-                          "@Deprecated module m2 { }");
+                          "@Deprecated module m2x { }");
 
-        Path m3 = moduleSrc.resolve("m3");
+        Path m3 = moduleSrc.resolve("m3x");
 
         Path modulePath = base.resolve("module-path");
 
@@ -216,14 +507,15 @@
         List<String> actual;
         List<String> expected;
 
-        for (String suppress : new String[] {"", "@Deprecated ", "@SuppressWarnings(\"deprecation\") "}) {
+        String DEPRECATED_JAVADOC = "/** @deprecated */";
+        for (String suppress : new String[] {"", DEPRECATED_JAVADOC, "@Deprecated ", "@SuppressWarnings(\"deprecation\") "}) {
             tb.writeJavaFiles(m3,
-                              suppress + "module m3 {\n" +
-                              "    requires m1;\n" +
-                              "    exports api to m1, m2;\n" +
+                              suppress + "module m3x {\n" +
+                              "    requires m1x;\n" +
+                              "    exports api to m1x, m2x;\n" +
                               "}",
                               "package api; public class Api { }");
-            System.err.println("compile m3");
+            System.err.println("compile m3x");
             actual = new JavacTask(tb)
                     .options("--module-source-path", moduleSrc.toString(),
                              "-XDrawDiagnostics")
@@ -237,6 +529,12 @@
                 expected = Arrays.asList(
                         "- compiler.note.deprecated.filename: module-info.java",
                         "- compiler.note.deprecated.recompile");
+            } else if (suppress.equals(DEPRECATED_JAVADOC)) {
+                expected = Arrays.asList(
+                        "module-info.java:1:19: compiler.warn.missing.deprecated.annotation",
+                        "- compiler.note.deprecated.filename: module-info.java",
+                        "- compiler.note.deprecated.recompile",
+                        "1 warning");
             } else {
                 expected = Arrays.asList("");
             }
@@ -245,7 +543,7 @@
                 throw new AssertionError("Unexpected output: " + actual + "; suppress: " + suppress);
             }
 
-            System.err.println("compile m3 with -Xlint:-deprecation");
+            System.err.println("compile m3x with -Xlint:-deprecation");
             actual = new JavacTask(tb)
                     .options("--module-source-path", moduleSrc.toString(),
                              "-XDrawDiagnostics",
@@ -258,8 +556,13 @@
 
             if (suppress.isEmpty()) {
                 expected = Arrays.asList(
-                        "module-info.java:2:14: compiler.warn.has.been.deprecated.module: m1",
+                        "module-info.java:2:14: compiler.warn.has.been.deprecated.module: m1x",
                         "1 warning");
+            } else if (suppress.equals(DEPRECATED_JAVADOC)) {
+                expected = Arrays.asList(
+                        "module-info.java:1:19: compiler.warn.missing.deprecated.annotation",
+                        "module-info.java:2:14: compiler.warn.has.been.deprecated.module: m1x",
+                        "2 warnings");
             } else {
                 expected = Arrays.asList("");
             }
@@ -269,13 +572,13 @@
             }
 
             //load the deprecated module-infos from classfile:
-            System.err.println("compile m3 with -Xlint:-deprecation, loading deprecated modules from classes");
+            System.err.println("compile m3x with -Xlint:-deprecation, loading deprecated modules from classes");
             actual = new JavacTask(tb)
                     .options("--module-path", modulePath.toString(),
                              "-XDrawDiagnostics",
                              "-Xlint:deprecation")
-                    .outdir(modulePath.resolve("m3"))
-                    .files(findJavaFiles(moduleSrc.resolve("m3")))
+                    .outdir(modulePath.resolve("m3x"))
+                    .files(findJavaFiles(moduleSrc.resolve("m3x")))
                     .run()
                     .writeAll()
                     .getOutputLines(OutputKind.DIRECT);
@@ -335,6 +638,10 @@
                          "public int[] value();",
                          "{1, 2}",
                          "@test.A({1, 2})"),
+            new TestCase("package test; public enum E {A;}",
+                        "int integer(); boolean flag(); double value(); String string(); E enumeration(); ",
+                        "enumeration = test.E.A, integer = 42, flag = true, value = 3.5, string = \"Text\"",
+                        "@test.A(enumeration=test.E.A, integer=42, flag=true, value=3.5, string=\"Text\")"),
         };
 
         Path extraSrc = base.resolve("extra-src");
--- a/langtools/test/tools/javac/modules/AutomaticModules.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/AutomaticModules.java	Fri Dec 16 11:58:18 2016 -0800
@@ -82,14 +82,14 @@
           .run();
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { requires test.api; requires java.desktop; }",
+                          "module m1x { requires test.api; requires java.desktop; }",
                           "package impl; public class Impl { public void e(api.Api api) { api.actionPerformed(null); } }");
 
         new JavacTask(tb)
@@ -140,14 +140,14 @@
           .run();
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { requires test.api; }",
+                          "module m1x { requires test.api; }",
                           "package impl; public class Impl { public void e(api.Api api) { api.run(\"\"); } }");
 
         new JavacTask(tb)
@@ -193,7 +193,7 @@
         Files.createDirectories(depClasses);
 
         tb.writeJavaFiles(depSrc,
-                          "module m1 { requires transitive automatic; }",
+                          "module m1x { requires transitive automatic; }",
                           "package dep; public class Dep { api.Api api; }");
 
         new JavacTask(tb)
@@ -203,7 +203,7 @@
                 .run()
                 .writeAll();
 
-        Path moduleJar = modulePath.resolve("m1.jar");
+        Path moduleJar = modulePath.resolve("m1x.jar");
 
         new JarTask(tb, moduleJar)
           .baseDir(depClasses)
@@ -217,7 +217,7 @@
         Files.createDirectories(testClasses);
 
         tb.writeJavaFiles(testSrc,
-                          "module m2 { requires automatic; }",
+                          "module m2x { requires automatic; }",
                           "package test; public class Test { }");
 
         new JavacTask(tb)
@@ -260,13 +260,13 @@
 
         Path moduleSrc = base.resolve("module-src");
 
-        tb.writeJavaFiles(moduleSrc.resolve("m1"),
-                          "module m1 { requires static automaticA; }",
-                          "package impl; public class Impl { apiA.Api a; apiB.Api b; m2.M2 m;}");
+        tb.writeJavaFiles(moduleSrc.resolve("m1x"),
+                          "module m1x { requires static automaticA; }",
+                          "package impl; public class Impl { apiA.Api a; apiB.Api b; m2x.M2 m;}");
 
-        tb.writeJavaFiles(moduleSrc.resolve("m2"),
-                          "module m2 { exports m2; }",
-                          "package m2; public class M2 { }");
+        tb.writeJavaFiles(moduleSrc.resolve("m2x"),
+                          "module m2x { exports m2x; }",
+                          "package m2x; public class M2 { }");
 
         Path classes = base.resolve("classes");
 
@@ -283,7 +283,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("Impl.java:1:61: compiler.err.not.def.access.package.cant.access: m2.M2, m2",
+        List<String> expected = Arrays.asList("Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
                                               "1 error");
 
         if (!expected.equals(log)) {
@@ -301,7 +301,7 @@
                 .getOutputLines(Task.OutputKind.DIRECT);
 
         expected = Arrays.asList("Impl.java:1:51: compiler.err.doesnt.exist: apiB",
-                                 "Impl.java:1:61: compiler.err.not.def.access.package.cant.access: m2.M2, m2",
+                                 "Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
                                  "2 errors");
 
         if (!expected.equals(log)) {
--- a/langtools/test/tools/javac/modules/DoclintOtherModules.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/DoclintOtherModules.java	Fri Dec 16 11:58:18 2016 -0800
@@ -49,14 +49,14 @@
     @Test
     public void testSimple(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
-        Path m2 = src.resolve("m2");
+        Path m1 = src.resolve("m1x");
+        Path m2 = src.resolve("m2x");
         tb.writeJavaFiles(m1,
-                          "module m1 {}",
-                          "package m1; /** @see m2.B */ @Deprecated public class A {}");
+                          "module m1x {}",
+                          "package m1x; /** @see m2x.B */ @Deprecated public class A {}");
         tb.writeJavaFiles(m2,
-                          "module m2 { requires m1; exports m2; }",
-                          "package m2; public class B extends Foo {} @Deprecated class Foo {}");
+                          "module m2x { requires m1x; exports m2x; }",
+                          "package m2x; public class B extends Foo {} @Deprecated class Foo {}");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
--- a/langtools/test/tools/javac/modules/DuplicateClassTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/DuplicateClassTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -37,7 +37,6 @@
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class DuplicateClassTest extends ModuleTestBase {
 
@@ -48,13 +47,13 @@
 
     @Test
     public void testSimple(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
-        Path m2 = base.resolve("m2");
+        Path m1 = base.resolve("m1x");
+        Path m2 = base.resolve("m2x");
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package impl; public class Impl { }");
         tb.writeJavaFiles(m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package impl; public class Impl { }");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
--- a/langtools/test/tools/javac/modules/EdgeCases.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/EdgeCases.java	Fri Dec 16 11:58:18 2016 -0800
@@ -97,9 +97,9 @@
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
             Path moduleSrc = base.resolve("module-src");
-            Path m1 = moduleSrc.resolve("m1");
+            Path m1 = moduleSrc.resolve("m1x");
 
-            tb.writeJavaFiles(m1, "module m1 { }");
+            tb.writeJavaFiles(m1, "module m1x { }");
 
             Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(moduleSrc));
             com.sun.source.util.JavacTask task =
@@ -107,7 +107,7 @@
 
             task.analyze();
 
-            ModuleSymbol msym = (ModuleSymbol) task.getElements().getModuleElement("m1");
+            ModuleSymbol msym = (ModuleSymbol) task.getElements().getModuleElement("m1x");
 
             msym.outermostClass();
         }
@@ -118,9 +118,9 @@
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
             Path moduleSrc = base.resolve("module-src");
-            Path m1 = moduleSrc.resolve("m1");
+            Path m1 = moduleSrc.resolve("m1x");
 
-            tb.writeJavaFiles(m1, "module m1 { }",
+            tb.writeJavaFiles(m1, "module m1x { }",
                                   "package p;",
                                   "package p; class T { }");
 
@@ -154,17 +154,17 @@
     @Test
     public void testModuleImplicitModuleBoundaries(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports api1; }",
+                          "module m1x { exports api1; }",
                           "package api1; public class Api1 { public void call() { } }");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { requires m1; exports api2; }",
+                          "module m2x { requires m1x; exports api2; }",
                           "package api2; public class Api2 { public static api1.Api1 get() { return null; } }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { requires m2; }",
+                          "module m3x { requires m2x; }",
                           "package test; public class Test { { api2.Api2.get().call(); api2.Api2.get().toString(); } }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
@@ -214,13 +214,13 @@
           .run();
 
         Path src = base.resolve("src");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { requires a; exports api2; }",
+                          "module m2x { requires a; exports api2; }",
                           "package api2; public class Api2 { public static api1.Api1 get() { return null; } }");
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { requires a; requires m2; }",
+                          "module m3x { requires a; requires m2x; }",
                           "package test; public class Test { { api2.Api2.get(); api1.Api1 a1; } }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
@@ -245,7 +245,7 @@
     @Test
     public void testEmptyImplicitModuleInfo(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         Files.createDirectories(src_m1);
         try (Writer w = Files.newBufferedWriter(src_m1.resolve("module-info.java"))) {}
         tb.writeJavaFiles(src_m1,
@@ -262,7 +262,7 @@
                 .writeAll();
 
         tb.writeJavaFiles(src_m1,
-                          "module m1 {}");
+                          "module m1x {}");
 
         new JavacTask(tb)
                 .options("--source-path", src_m1.toString())
@@ -276,16 +276,16 @@
     @Test
     public void testClassPackageClash(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { exports test.m1; }",
-                          "package test.m1;\n" +
+                          "module m1x { exports test.m1x; }",
+                          "package test.m1x;\n" +
                           "public class Test {}\n");
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { requires m1; }",
+                          "module m2x { requires m1x; }",
                           "package test;\n" +
-                          "public class m1 {}\n");
+                          "public class m1x {}\n");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
@@ -299,7 +299,7 @@
                 .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
-            "m1.java:2:8: compiler.err.clash.with.pkg.of.same.name: kindname.class, test.m1",
+            "m1x.java:2:8: compiler.err.clash.with.pkg.of.same.name: kindname.class, test.m1x",
             "1 error"
         );
 
@@ -383,7 +383,7 @@
     @Test
     public void testModuleInfoNameMismatchSource(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
+        Path m1 = src.resolve("m1x");
         Files.createDirectories(m1);
         tb.writeJavaFiles(m1, "module other { }",
                               "package test; public class Test {}");
@@ -400,8 +400,8 @@
             .getOutputLines(OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
-                "module-info.java:1:1: compiler.err.module.name.mismatch: other, m1",
-                "- compiler.err.cant.access: m1.module-info, (compiler.misc.cant.resolve.modules)",
+                "module-info.java:1:1: compiler.err.module.name.mismatch: other, m1x",
+                "- compiler.err.cant.access: m1x.module-info, (compiler.misc.cant.resolve.modules)",
                 "2 errors");
 
         if (!expected.equals(log)) {
@@ -416,7 +416,7 @@
         tb.writeJavaFiles(src, "module other { }",
                                "package test; public class Test {}");
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         tb.createDirectories(m1Classes);
 
         new JavacTask(tb)
@@ -428,7 +428,7 @@
 
         Path src2 = base.resolve("src2");
         Files.createDirectories(src2);
-        tb.writeJavaFiles(src2, "module use { requires m1; }");
+        tb.writeJavaFiles(src2, "module use { requires m1x; }");
 
         Path classes2 = base.resolve("classes2");
         tb.createDirectories(classes2);
@@ -443,7 +443,7 @@
             .getOutputLines(OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
-                "- compiler.err.cant.access: m1.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.name.mismatch: other, m1))",
+                "- compiler.err.cant.access: m1x.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.name.mismatch: other, m1x))",
                 "1 error");
 
         if (!expected.equals(log)) {
--- a/langtools/test/tools/javac/modules/ExportsUnexported.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ExportsUnexported.java	Fri Dec 16 11:58:18 2016 -0800
@@ -75,7 +75,7 @@
                 System.err.println("testing: " + test);
 
                 Path src = base.resolve("src");
-                Path src_m1 = src.resolve("m1");
+                Path src_m1 = src.resolve("m1x");
                 StringBuilder testCode = new StringBuilder();
                 List<String> expectedLog = new ArrayList<>();
                 int line = 1;
@@ -99,7 +99,9 @@
                             default:
                                 throw new AssertionError(typeName.toString());
                         }
-                        expectedLog.add("Api.java:" + line + ":" + col + ": compiler.warn.leaks.not.accessible.unexported: " + kindName + ", impl.impl." + typeName + ", m1");
+                        expectedLog.add("Api.java:" + line + ":" + col
+                                + ": compiler.warn.leaks.not.accessible.unexported: "
+                                + kindName + ", impl.impl." + typeName + ", m1x");
                         continue;
                     }
 
@@ -121,7 +123,7 @@
                 Collections.sort(expectedLog);
 
                 tb.writeJavaFiles(src_m1,
-                                  "module m1 { exports api; }",
+                                  "module m1x { exports api; }",
                                   testCode.toString(),
                                   "package impl.impl; public class Cls { }",
                                   "package impl.impl; public class Exc extends Exception { }",
@@ -155,22 +157,22 @@
     @Test
     public void testAccessibleToSpecificOrAll(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_lib1 = src.resolve("lib1");
+        Path src_lib1 = src.resolve("lib1x");
         tb.writeJavaFiles(src_lib1,
-                          "module lib1 { exports lib1; }",
+                          "module lib1x { exports lib1; }",
                           "package lib1; public class Lib1 {}");
-        Path src_lib2 = src.resolve("lib2");
+        Path src_lib2 = src.resolve("lib2x");
         tb.writeJavaFiles(src_lib2,
-                          "module lib2 { exports lib2; }",
+                          "module lib2x { exports lib2; }",
                           "package lib2; public class Lib2 {}");
         Path src_api = src.resolve("api");
         tb.writeJavaFiles(src_api,
                           "module api {\n" +
                           "    exports api;\n" +
-                          "    exports qapi1 to qual1;\n" +
-                          "    exports qapi2 to qual1, qual2;\n" +
-                          "    requires transitive lib1;\n" +
-                          "    requires lib2;\n" +
+                          "    exports qapi1 to qual1x;\n" +
+                          "    exports qapi2 to qual1x, qual2x;\n" +
+                          "    requires transitive lib1x;\n" +
+                          "    requires lib2x;\n" +
                           "}\n",
                           "package api;\n" +
                           "public class Api {\n" +
@@ -190,10 +192,10 @@
                           "package impl;\n" +
                           "public class Impl {\n" +
                           "}");
-        Path src_qual1 = src.resolve("qual1");
-        tb.writeJavaFiles(src_qual1, "module qual1 { }");
-        Path src_qual2 = src.resolve("qual2");
-        tb.writeJavaFiles(src_qual2, "module qual2 { }");
+        Path src_qual1 = src.resolve("qual1x");
+        tb.writeJavaFiles(src_qual1, "module qual1x { }");
+        Path src_qual2 = src.resolve("qual2x");
+        tb.writeJavaFiles(src_qual2, "module qual2x { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
@@ -209,7 +211,7 @@
                 .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
-            "Api.java:4:16: compiler.warn.leaks.not.accessible.not.required.transitive: kindname.class, lib2.Lib2, lib2",
+            "Api.java:4:16: compiler.warn.leaks.not.accessible.not.required.transitive: kindname.class, lib2.Lib2, lib2x",
             "Api.java:5:17: compiler.warn.leaks.not.accessible.unexported.qualified: kindname.class, qapi1.QApi1, api",
             "Api.java:6:16: compiler.warn.leaks.not.accessible.unexported: kindname.class, impl.Impl, api",
             "- compiler.err.warnings.and.werror",
--- a/langtools/test/tools/javac/modules/GetLocationForModuleTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/GetLocationForModuleTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -48,10 +48,10 @@
     public void run(Path base) throws Exception {
         // Set up some trivial modules
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
-        tb.writeJavaFiles(m1, "module m1 { }");
-        Path m2 = moduleSrc.resolve("m2");
-        tb.writeJavaFiles(m2, "module m2 { }");
+        Path m1 = moduleSrc.resolve("m1x");
+        tb.writeJavaFiles(m1, "module m1x { }");
+        Path m2 = moduleSrc.resolve("m2x");
+        tb.writeJavaFiles(m2, "module m2x { }");
 
         Path modulePath = base.resolve("module-path");
         Files.createDirectories(modulePath);
@@ -69,7 +69,7 @@
 
         // Test
         test(fm, StandardLocation.SYSTEM_MODULES, "java.base", "java.compiler");
-        test(fm, StandardLocation.MODULE_PATH, "m1", "m2");
+        test(fm, StandardLocation.MODULE_PATH, "m1x", "m2x");
     }
 
     void test(JavaFileManager fm, JavaFileManager.Location locn, String... mods) throws IOException {
--- a/langtools/test/tools/javac/modules/HelloWorldTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/HelloWorldTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -123,9 +123,9 @@
     @Test
     public void testModuleSourcePath(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }");
-        tb.writeJavaFiles(src_m1, PKG_HELLO_WORLD);
+        Path src_m = src.resolve("m");
+        tb.writeFile(src_m.resolve("module-info.java"), "module m { }");
+        tb.writeJavaFiles(src_m, PKG_HELLO_WORLD);
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -133,13 +133,13 @@
         new JavacTask(tb)
             .options("--module-source-path", src.toString())
             .outdir(classes)
-            .files(src_m1.resolve("p/HelloWorld.java"))
+            .files(src_m.resolve("p/HelloWorld.java"))
             .run()
             .writeAll();
 
         checkFiles(
-            classes.resolve("m1/module-info.class"),
-            classes.resolve("m1/p/HelloWorld.class"));
+            classes.resolve("m/module-info.class"),
+            classes.resolve("m/p/HelloWorld.class"));
     }
 
     void checkFiles(Path... files) throws Exception {
--- a/langtools/test/tools/javac/modules/LimitModulesTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/LimitModulesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -36,7 +36,6 @@
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class LimitModulesTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -78,18 +77,18 @@
     @Test
     public void testEmptyItem(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                          "module m1 { }");
-        Path src_m2 = src.resolve("m2");
+                          "module m1x { }");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { }");
+                          "module m2x { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--limit-modules", ",m1")
+                         "--limit-modules", ",m1x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -97,7 +96,7 @@
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--limit-modules", "m1,,m2")
+                         "--limit-modules", "m1x,,m2x")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
@@ -105,7 +104,7 @@
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString(),
-                         "--limit-modules", "m1,")
+                         "--limit-modules", "m1x,")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
--- a/langtools/test/tools/javac/modules/MOptionTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/MOptionTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -49,21 +49,21 @@
     @Test
     public void testOneModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
+        Path m1 = src.resolve("m1x");
         Path build = base.resolve("build");
         Files.createDirectories(build);
 
         tb.writeJavaFiles(m1,
-                "module m1 {}",
+                "module m1x {}",
                 "package test; public class Test {}");
 
         new JavacTask(tb)
-                .options("-m", "m1", "--module-source-path", src.toString(), "-d", build.toString())
+                .options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString())
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
 
-        Path moduleInfoClass = build.resolve("m1/module-info.class");
-        Path testTestClass = build.resolve("m1/test/Test.class");
+        Path moduleInfoClass = build.resolve("m1x/module-info.class");
+        Path testTestClass = build.resolve("m1x/test/Test.class");
 
         FileTime moduleInfoTimeStamp = Files.getLastModifiedTime(moduleInfoClass);
         FileTime testTestTimeStamp = Files.getLastModifiedTime(testTestClass);
@@ -81,7 +81,7 @@
         Thread.sleep(2000); //timestamps
 
         new JavacTask(tb)
-                .options("-m", "m1", "--module-source-path", src.toString(), "-d", build.toString())
+                .options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString())
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
 
@@ -98,7 +98,7 @@
         Files.setLastModifiedTime(testTest, FileTime.fromMillis(System.currentTimeMillis()));
 
         new JavacTask(tb)
-                .options("-m", "m1", "--module-source-path", src.toString(), "-d", build.toString())
+                .options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString())
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
 
@@ -114,17 +114,17 @@
     @Test
     public void testNoOutputDir(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
+        Path m1 = src.resolve("m1x");
         Path build = base.resolve("build");
         Files.createDirectories(build);
 
         tb.writeJavaFiles(m1,
-                "module m1 {}",
+                "module m1x {}",
                 "package test; public class Test {}");
 
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
-                    "-m", "m1",
+                    "-m", "m1x",
                     "--module-source-path", src.toString())
                 .run(Task.Expect.FAIL)
                 .writeAll()
@@ -137,17 +137,17 @@
     @Test
     public void testNoModuleSourcePath(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
+        Path m1 = src.resolve("m1x");
         Path build = base.resolve("build");
         Files.createDirectories(build);
 
         tb.writeJavaFiles(m1,
-                "module m1 {}",
+                "module m1x {}",
                 "package test; public class Test {}");
 
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
-                        "-m", "m1",
+                        "-m", "m1x",
                         "-d", build.toString())
                 .run(Task.Expect.FAIL)
                 .writeAll()
@@ -160,29 +160,29 @@
     @Test
     public void testMultiModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
-        Path m2 = src.resolve("m2");
+        Path m1 = src.resolve("m1x");
+        Path m2 = src.resolve("m2x");
         Path build = base.resolve("build");
         Files.createDirectories(build);
 
         tb.writeJavaFiles(m1,
-                "module m1 {}",
+                "module m1x {}",
                 "package p1; public class C1 {}");
 
         tb.writeJavaFiles(m2,
-                "module m2 {}",
+                "module m2x {}",
                 "package p2; public class C2 {}");
 
         new JavacTask(tb)
-                .options("-m", "m1,m2", "--module-source-path", src.toString(), "-d", build.toString())
+                .options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString())
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
 
-        Path m1ModuleInfoClass = build.resolve("m1/module-info.class");
-        Path classC1 = build.resolve("m1/p1/C1.class");
+        Path m1ModuleInfoClass = build.resolve("m1x/module-info.class");
+        Path classC1 = build.resolve("m1x/p1/C1.class");
 
-        Path m2ModuleInfoClass = build.resolve("m2/module-info.class");
-        Path classC2 = build.resolve("m2/p2/C2.class");
+        Path m2ModuleInfoClass = build.resolve("m2x/module-info.class");
+        Path classC2 = build.resolve("m2x/p2/C2.class");
 
         FileTime m1ModuleInfoTimeStamp = Files.getLastModifiedTime(m1ModuleInfoClass);
         FileTime C1TimeStamp = Files.getLastModifiedTime(classC1);
@@ -215,7 +215,7 @@
         Thread.sleep(2000); //timestamps
 
         new JavacTask(tb)
-                .options("-m", "m1,m2", "--module-source-path", src.toString(), "-d", build.toString())
+                .options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString())
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
 
@@ -241,7 +241,7 @@
         Files.setLastModifiedTime(C2Source, FileTime.fromMillis(System.currentTimeMillis()));
 
         new JavacTask(tb)
-                .options("-m", "m1,m2", "--module-source-path", src.toString(), "-d", build.toString())
+                .options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString())
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
 
--- a/langtools/test/tools/javac/modules/ModuleFinderTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ModuleFinderTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -38,7 +38,6 @@
 import toolbox.JarTask;
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class ModuleFinderTest extends ModuleTestBase {
 
@@ -50,7 +49,7 @@
     @Test
     public void testDuplicateModulesOnPath(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m1 { }");
+        tb.writeJavaFiles(src, "module m1x { }");
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -63,18 +62,18 @@
                 .run()
                 .writeAll();
 
-        new JarTask(tb, modules.resolve("m1-1.jar"))
+        new JarTask(tb, modules.resolve("m1x-1.jar"))
                 .baseDir(classes)
                 .files(".")
                 .run();
 
-        new JarTask(tb, modules.resolve("m1-2.jar"))
+        new JarTask(tb, modules.resolve("m1x-2.jar"))
                 .baseDir(classes)
                 .files(".")
                 .run();
 
         Path src2 = base.resolve("src2");
-        tb.writeJavaFiles(src2, "module m2 { requires m1; }");
+        tb.writeJavaFiles(src2, "module m2x { requires m1x; }");
 
 
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
@@ -85,7 +84,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("- compiler.err.duplicate.module.on.path: (compiler.misc.locn.module_path), m1"))
+        if (!log.contains("- compiler.err.duplicate.module.on.path: (compiler.misc.locn.module_path), m1x"))
             throw new Exception("expected output not found");
     }
 }
--- a/langtools/test/tools/javac/modules/ModuleInfoTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ModuleInfoTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -34,14 +34,12 @@
  * @run main ModuleInfoTest
  */
 
-import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Arrays;
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class ModuleInfoTest extends ModuleTestBase {
 
@@ -137,21 +135,129 @@
     }
 
     /**
-     * Verify that missing exports are reported.
+     * Verify that missing exports targets are reported.
      */
     @Test
     public void testExportsNotFound(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module M1 { exports p to M2; }");
+        tb.writeJavaFiles(src,
+                          "module M { exports p to N; }",
+                          "package p; public class C {}");
         String log = new JavacTask(tb)
-                .options("-XDrawDiagnostics")
+                .options("-XDrawDiagnostics",
+                         "-Xlint:module")
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:25: compiler.warn.module.not.found: N"))
+            throw new Exception("expected output not found, actual output: " + log);
+    }
+
+    /**
+     * Verify that duplicated qualified missing exports targets are reported.
+     */
+    @Test
+    public void testExportsNotFoundDuplicated(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "module M { exports p to N, N; }",
+                          "package p; public class C {}");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-Xlint:module")
                 .files(findJavaFiles(src))
                 .run(Task.Expect.FAIL)
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:26: compiler.err.module.not.found: M2"))
-            throw new Exception("expected output not found");
+        if (!log.contains("module-info.java:1:28: compiler.err.conflicting.exports.to.module: N"))
+            throw new Exception("expected output not found, actual output: " + log);
+    }
+
+    /**
+     * Verify that missing exports target warning can be suppressed.
+     */
+    @Test
+    public void testExportsNotFoundSuppress(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "@SuppressWarnings(\"module\") module M { exports p to N; }",
+                          "package p; public class C {}");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-Xlint:module")
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found, actual output: " + log);
+    }
+
+    /**
+     * Verify that missing opens targets are reported.
+     */
+    @Test
+    public void testOpensNotFound(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "module M { opens p to N; }",
+                          "package p; public class C {}");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-Xlint:module")
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:23: compiler.warn.module.not.found: N"))
+            throw new Exception("expected output not found, actual output: " + log);
+    }
+
+    /**
+     * Verify that duplicated qualified missing opens targets are reported.
+     */
+    @Test
+    public void testOpensNotFoundDuplicated(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "module M { opens p to N, N; }",
+                          "package p; public class C {}");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-Xlint:module")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:26: compiler.err.conflicting.opens.to.module: N"))
+            throw new Exception("expected output not found, actual output: " + log);
+    }
+
+    /**
+     * Verify that missing opens target warning can be suppressed.
+     */
+    @Test
+    public void testOpensNotFoundSuppress(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "@SuppressWarnings(\"module\") module M { opens p to N; }",
+                          "package p; public class C {}");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-Xlint:module")
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found, actual output: " + log);
     }
 
     /**
@@ -178,12 +284,12 @@
     @Test
     public void testRequiresLoop(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { requires m2; }");
-        Path src_m2 = src.resolve("m2");
-        tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires m3; }");
-        Path src_m3 = src.resolve("m3");
-        tb.writeFile(src_m3.resolve("module-info.java"), "module m3 { requires m1; }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { requires m2x; }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires m3x; }");
+        Path src_m3 = src.resolve("m3x");
+        tb.writeFile(src_m3.resolve("module-info.java"), "module m3x { requires m1x; }");
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -196,7 +302,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:22: compiler.err.cyclic.requires: m3"))
+        if (!log.contains("module-info.java:1:23: compiler.err.cyclic.requires: m3x"))
             throw new Exception("expected output not found");
     }
 
@@ -206,12 +312,12 @@
     @Test
     public void testRequiresTransitiveLoop(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { requires m2; }");
-        Path src_m2 = src.resolve("m2");
-        tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires transitive m3; }");
-        Path src_m3 = src.resolve("m3");
-        tb.writeFile(src_m3.resolve("module-info.java"), "module m3 { requires m1; }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { requires m2x; }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires transitive m3x; }");
+        Path src_m3 = src.resolve("m3x");
+        tb.writeFile(src_m3.resolve("module-info.java"), "module m3x { requires m1x; }");
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -224,7 +330,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:33: compiler.err.cyclic.requires: m3"))
+        if (!log.contains("module-info.java:1:34: compiler.err.cyclic.requires: m3x"))
             throw new Exception("expected output not found");
     }
 
@@ -234,10 +340,10 @@
     @Test
     public void testDuplicateRequires(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }");
-        Path src_m2 = src.resolve("m2");
-        tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires m1; requires m1; }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires m1x; requires m1x; }");
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -250,7 +356,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:35: compiler.err.duplicate.requires: m1"))
+        if (!log.contains("module-info.java:1:37: compiler.err.duplicate.requires: m1x"))
             throw new Exception("expected output not found");
     }
 
@@ -260,10 +366,10 @@
     @Test
     public void testDuplicateRequiresTransitiveStatic(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }");
-        Path src_m2 = src.resolve("m2");
-        tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires transitive m1; requires static m1; }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires transitive m1x; requires static m1x; }");
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -276,7 +382,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:53: compiler.err.duplicate.requires: m1"))
+        if (!log.contains("module-info.java:1:55: compiler.err.duplicate.requires: m1x"))
             throw new Exception("expected output not found");
     }
 
@@ -290,64 +396,64 @@
                                           null);
         verifyConflictingExports_packages(base,
                                           "exports p; exports p;",
-                                          "module-info.java:1:32: compiler.err.conflicting.exports: p");
+                                          "module-info.java:1:33: compiler.err.conflicting.exports: p");
         verifyConflictingExports_packages(base,
                                           "exports p; opens p;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "exports p; exports p to m2;",
-                                          "module-info.java:1:32: compiler.err.conflicting.exports: p");
+                                          "exports p; exports p to m2x;",
+                                          "module-info.java:1:33: compiler.err.conflicting.exports: p");
         verifyConflictingExports_packages(base,
-                                          "exports p; opens p to m2;",
+                                          "exports p; opens p to m2x;",
                                           null);
         verifyConflictingExports_packages(base,
                                           "opens p; exports p;",
                                           null);
         verifyConflictingExports_packages(base,
                                           "opens p; opens p;",
-                                          "module-info.java:1:28: compiler.err.conflicting.opens: p");
+                                          "module-info.java:1:29: compiler.err.conflicting.opens: p");
         verifyConflictingExports_packages(base,
-                                          "opens p; exports p to m2;",
+                                          "opens p; exports p to m2x;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "opens p; opens p to m2;",
-                                          "module-info.java:1:28: compiler.err.conflicting.opens: p");
+                                          "opens p; opens p to m2x;",
+                                          "module-info.java:1:29: compiler.err.conflicting.opens: p");
         verifyConflictingExports_packages(base,
-                                          "exports p to m2; exports p;",
-                                          "module-info.java:1:38: compiler.err.conflicting.exports: p");
+                                          "exports p to m2x; exports p;",
+                                          "module-info.java:1:40: compiler.err.conflicting.exports: p");
         verifyConflictingExports_packages(base,
-                                          "exports p to m2; opens p;",
+                                          "exports p to m2x; opens p;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "exports p to m2; exports p to m2;",
-                                          "module-info.java:1:43: compiler.err.conflicting.exports.to.module: m2");
+                                          "exports p to m2x; exports p to m2x;",
+                                          "module-info.java:1:45: compiler.err.conflicting.exports.to.module: m2x");
         verifyConflictingExports_packages(base,
-                                          "exports p to m2; opens p to m2;",
+                                          "exports p to m2x; opens p to m2x;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "opens p to m2; exports p;",
+                                          "opens p to m2x; exports p;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "opens p to m2; opens p;",
-                                          "module-info.java:1:34: compiler.err.conflicting.opens: p");
+                                          "opens p to m2x; opens p;",
+                                          "module-info.java:1:36: compiler.err.conflicting.opens: p");
         verifyConflictingExports_packages(base,
-                                          "opens p to m2; exports p to m2;",
+                                          "opens p to m2x; exports p to m2x;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "opens p to m2; opens p to m2;",
-                                          "module-info.java:1:34: compiler.err.conflicting.opens: p");
+                                          "opens p to m2x; opens p to m2x;",
+                                          "module-info.java:1:36: compiler.err.conflicting.opens: p");
         verifyConflictingExports_packages(base,
-                                          "exports p to m2; exports p to m3;",
-                                          "module-info.java:1:38: compiler.err.conflicting.exports: p");
+                                          "exports p to m2x; exports p to m3x;",
+                                          "module-info.java:1:40: compiler.err.conflicting.exports: p");
         verifyConflictingExports_packages(base,
-                                          "exports p to m2; opens p to m3;",
+                                          "exports p to m2x; opens p to m3x;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "opens p to m2; exports p to m3;",
+                                          "opens p to m2x; exports p to m3x;",
                                           null);
         verifyConflictingExports_packages(base,
-                                          "opens p to m2; opens p to m3;",
-                                          "module-info.java:1:34: compiler.err.conflicting.opens: p");
+                                          "opens p to m2x; opens p to m3x;",
+                                          "module-info.java:1:36: compiler.err.conflicting.opens: p");
     }
 
     private void verifyConflictingExports_packages(Path base, String code, String expected) throws Exception {
@@ -355,14 +461,14 @@
         tb.cleanDirectory(base);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                          "module m1 { " + code + " }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                          "module m1x { " + code + " }",
                           "package p; public class P {}",
                           "package q; public class Q {}");
-        tb.writeJavaFiles(src.resolve("m2"),
-                          "module m2 { requires m1; }");
-        tb.writeJavaFiles(src.resolve("m3"),
-                          "module m3 { requires m1; }");
+        tb.writeJavaFiles(src.resolve("m2x"),
+                          "module m2x { requires m1x; }");
+        tb.writeJavaFiles(src.resolve("m3x"),
+                          "module m3x { requires m1x; }");
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -386,10 +492,10 @@
     @Test
     public void testConflictingExports_modules(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }");
-        Path src_m2 = src.resolve("m2");
-        tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { exports p to m1, m1; }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { exports p to m1x, m1x; }");
 
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -402,7 +508,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:30: compiler.err.conflicting.exports.to.module: m1"))
+        if (!log.contains("module-info.java:1:32: compiler.err.conflicting.exports.to.module: m1x"))
             throw new Exception("expected output not found");
     }
 
@@ -413,7 +519,7 @@
     @Test
     public void testAnnotations(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1.sub");
+        Path src_m1 = src.resolve("m1x.sub");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
--- a/langtools/test/tools/javac/modules/ModuleInfoTreeAccess.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ModuleInfoTreeAccess.java	Fri Dec 16 11:58:18 2016 -0800
@@ -46,7 +46,6 @@
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.api.JavacTrees;
 
-import toolbox.ToolBox;
 
 public class ModuleInfoTreeAccess extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -66,14 +65,14 @@
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
             Path src = base.resolve("src");
-            tb.writeJavaFiles(src, "/** Test module */ module m1 {}");
+            tb.writeJavaFiles(src, "/** Test module */ module m1x {}");
 
             Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src));
             JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files);
 
             task.analyze();
             JavacTrees trees = JavacTrees.instance(task);
-            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1");
+            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1x");
 
             TreePath path = trees.getPath(mdle);
             assertNotNull("path", path);
@@ -91,14 +90,14 @@
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
             Path src = base.resolve("src");
-            tb.writeJavaFiles(src, "import java.lang.Deprecated; /** Test module */ @Deprecated module m1 {}");
+            tb.writeJavaFiles(src, "import java.lang.Deprecated; /** Test module */ @Deprecated module m1x {}");
 
             Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src));
             JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files);
 
             task.analyze();
             JavacTrees trees = JavacTrees.instance(task);
-            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1");
+            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1x");
 
             TreePath path = trees.getPath(mdle);
             assertNotNull("path", path);
--- a/langtools/test/tools/javac/modules/ModulePathTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ModulePathTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -113,7 +113,7 @@
     public void testExplodedModuleOnPath(Path base) throws Exception {
         Path modSrc = base.resolve("modSrc");
         tb.writeJavaFiles(modSrc,
-                "module m1 { exports p; }",
+                "module m1x { exports p; }",
                 "package p; public class CC { }");
         Path modClasses = base.resolve("modClasses");
         Files.createDirectories(modClasses);
@@ -126,7 +126,7 @@
 
         Path src = base.resolve("src");
         tb.writeJavaFiles(src,
-                "module m { requires m1 ; }",
+                "module m { requires m1x ; }",
                 "class C { }");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -142,11 +142,11 @@
     @Test
     public void testBadExplodedModuleOnPath(Path base) throws Exception {
         Path modClasses = base.resolve("modClasses");
-        tb.writeFile(modClasses.resolve("module-info.class"), "module m1 { }");
+        tb.writeFile(modClasses.resolve("module-info.class"), "module m1x { }");
 
         Path src = base.resolve("src");
         tb.writeJavaFiles(src,
-                "module m { requires m1 ; }",
+                "module m { requires m1x ; }",
                 "class C { }");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -201,7 +201,7 @@
     public void testModJarOnPath(Path base) throws Exception {
         Path jarSrc = base.resolve("jarSrc");
         tb.writeJavaFiles(jarSrc,
-                "module m1 { exports p; }",
+                "module m1x { exports p; }",
                 "package p; public class CC { }");
         Path jarClasses = base.resolve("jarClasses");
         Files.createDirectories(jarClasses);
@@ -220,7 +220,7 @@
 
         Path src = base.resolve("src");
         tb.writeJavaFiles(src,
-                "module m { requires m1 ; }",
+                "module m { requires m1x ; }",
                 "class C { }");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -255,7 +255,7 @@
     public void testJModOnPath(Path base) throws Exception {
         Path jmodSrc = base.resolve("jmodSrc");
         tb.writeJavaFiles(jmodSrc,
-                "module m1 { exports p; }",
+                "module m1x { exports p; }",
                 "package p; public class CC { }");
         Path jmodClasses = base.resolve("jmodClasses");
         Files.createDirectories(jmodClasses);
@@ -271,7 +271,7 @@
 
         Path src = base.resolve("src");
         tb.writeJavaFiles(src,
-                "module m { requires m1 ; }",
+                "module m { requires m1x ; }",
                 "class C { }");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -305,10 +305,10 @@
     @Test
     public void relativePath(Path base) throws Exception {
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1").build(modules);
+        new ModuleBuilder(tb, "m1x").build(modules);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }");
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }", "class A { }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
@@ -321,10 +321,10 @@
     @Test
     public void duplicatePaths_1(Path base) throws Exception {
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1").build(modules);
+        new ModuleBuilder(tb, "m1x").build(modules);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }");
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }", "class A { }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
@@ -337,10 +337,10 @@
     @Test
     public void duplicatePaths_2(Path base) throws Exception {
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1").build(modules);
+        new ModuleBuilder(tb, "m1x").build(modules);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }");
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }", "class A { }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
@@ -354,20 +354,20 @@
     @Test
     public void oneModuleHidesAnother(Path base) throws Exception {
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class E { }")
                 .build(modules);
 
         Path deepModuleDirSrc = base.resolve("deepModuleDirSrc");
         Path deepModuleDir = modules.resolve("deepModuleDir");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg2")
                 .classes("package pkg2; public class E { }")
                 .build(deepModuleDirSrc, deepModuleDir);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }", " package p; class A { void main() { pkg2.E.class.getName(); } }");
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }", " package p; class A { void main() { pkg2.E.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
@@ -380,23 +380,23 @@
     @Test
     public void modulesInDifferentContainers(Path base) throws Exception {
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("one")
                 .classes("package one; public class A { }")
                 .build(modules);
 
-        new ModuleBuilder(tb, "m2")
-                .requires("m1", modules)
+        new ModuleBuilder(tb, "m2x")
+                .requires("m1x", modules)
                 .build(base.resolve("tmp"));
-        jar(base.resolve("tmp/m2"), modules.resolve("m2.jar"));
+        jar(base.resolve("tmp/m2x"), modules.resolve("m2x.jar"));
 
-        new ModuleBuilder(tb, "m3")
-                .requires("m2", modules)
+        new ModuleBuilder(tb, "m3x")
+                .requires("m2x", modules)
                 .build(base.resolve("tmp"));
-        jmod(base.resolve("tmp/m3"), modules.resolve("m3.jmod"));
+        jmod(base.resolve("tmp/m3x"), modules.resolve("m3x.jmod"));
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m { requires m3; requires m2; requires m1; }",
+        tb.writeJavaFiles(src, "module m { requires m3x; requires m2x; requires m1x; }",
                 "package p; class A { void main() { one.A.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
--- a/langtools/test/tools/javac/modules/ModuleSourcePathTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ModuleSourcePathTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -76,8 +76,8 @@
     @Test
     public void testUnnormalizedPath1(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeJavaFiles(src_m1, "module m1 { }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1, "module m1x { }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
@@ -93,8 +93,8 @@
     @Test
     public void testUnnormalizedPath2(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeJavaFiles(src_m1, "module m1 { }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1, "module m1x { }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
@@ -124,15 +124,15 @@
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "--module-source-path", base + "/{src1,src2/inner_dir}")
-                .files(base.resolve("src1/m0/pkg0/A.java"), base.resolve("src2/inner_dir/m1/pkg1/A.java"))
+                .files(base.resolve("src1/m0x/pkg0/A.java"), base.resolve("src2/inner_dir/m1x/pkg1/A.java"))
                 .outdir(modules)
                 .run()
                 .writeAll();
 
-        checkFiles(modules.resolve("m0/pkg0/A.class"),
-                modules.resolve("m1/pkg1/A.class"),
-                modules.resolve("m0/module-info.class"),
-                modules.resolve("m1/module-info.class"));
+        checkFiles(modules.resolve("m0x/pkg0/A.class"),
+                modules.resolve("m1x/pkg1/A.class"),
+                modules.resolve("m0x/module-info.class"),
+                modules.resolve("m1x/module-info.class"));
     }
 
     @Test
@@ -191,9 +191,9 @@
                 .writeAll();
 
         for (int i = 0; i < modulePaths.length; i++) {
-            checkFiles(modules.resolve("m" + i + "/module-info.class"));
+            checkFiles(modules.resolve("m" + i + "x/module-info.class"));
         }
-        checkFiles(modules.resolve("m8/pkg8/A.class"));
+        checkFiles(modules.resolve("m8x/pkg8/A.class"));
     }
 
     @Test
@@ -298,7 +298,7 @@
     @Test
     public void duplicatePaths(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"), "module m1 { }", "package a; class A { }");
+        tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }", "package a; class A { }");
 
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
@@ -306,17 +306,17 @@
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "--module-source-path", base + "/{src,src,src}")
-                .files(src.resolve("m1/a/A.java"))
+                .files(src.resolve("m1x/a/A.java"))
                 .outdir(modules)
                 .run()
                 .writeAll();
 
-        checkFiles(modules.resolve("m1/module-info.class"));
+        checkFiles(modules.resolve("m1x/module-info.class"));
     }
 
     @Test
     public void notExistentPaths(Path base) throws Exception {
-        tb.writeJavaFiles(base.resolve("m1"), "module m1 { requires m0; }", "package a; class A { }");
+        tb.writeJavaFiles(base.resolve("m1x"), "module m1x { requires m0x; }", "package a; class A { }");
 
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
@@ -324,18 +324,18 @@
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "--module-source-path", base + "/not_exist" + PATH_SEP + base + "/{not_exist,}")
-                .files(base.resolve("m1/a/A.java"))
+                .files(base.resolve("m1x/a/A.java"))
                 .outdir(modules)
                 .run(Task.Expect.FAIL)
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
-        if (!log.contains("compiler.err.module.not.found: m0"))
+        if (!log.contains("compiler.err.module.not.found: m0x"))
             throw new Exception("expected output for not existent module source path not found");
     }
 
     @Test
     public void notExistentPathShouldBeSkipped(Path base) throws Exception {
-        tb.writeJavaFiles(base.resolve("m1"), "module m1 { }", "package a; class A { }");
+        tb.writeJavaFiles(base.resolve("m1x"), "module m1x { }", "package a; class A { }");
 
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
@@ -343,18 +343,18 @@
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "--module-source-path", base + "{/not_exist,/}")
-                .files(base.resolve("m1/a/A.java"))
+                .files(base.resolve("m1x/a/A.java"))
                 .outdir(modules)
                 .run()
                 .writeAll();
 
-        checkFiles(modules.resolve("m1/module-info.class"));
+        checkFiles(modules.resolve("m1x/module-info.class"));
     }
 
     @Test
     public void commas(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"), "module m1 { }", "package a; class A { }");
+        tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }", "package a; class A { }");
 
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
@@ -362,12 +362,12 @@
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "--module-source-path", base + "/{,{,,,,src,,,}}")
-                .files(src.resolve("m1/a/A.java"))
+                .files(src.resolve("m1x/a/A.java"))
                 .outdir(modules)
                 .run()
                 .writeAll();
 
-        checkFiles(modules.resolve("m1/module-info.class"));
+        checkFiles(modules.resolve("m1x/module-info.class"));
     }
 
     @Test
@@ -444,8 +444,8 @@
 
     private void generateModules(Path base, String... paths) throws IOException {
         for (int i = 0; i < paths.length; i++) {
-            String moduleName = "m" + i;
-            String dependency = i > 0 ? "requires m" + (i - 1) + ";" : "";
+            String moduleName = "m" + i + "x";
+            String dependency = i > 0 ? "requires m" + (i - 1) + "x;" : "";
             tb.writeJavaFiles(base.resolve(paths[i]).resolve(moduleName),
                     "module " + moduleName + " { " + dependency + " }",
                     "package pkg" + i + "; class A { }");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/ModuleVersion.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+ * @summary simple tests of module uses
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
+ * @run main ModuleVersion
+ */
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Module_attribute;
+import toolbox.JavacTask;
+import toolbox.Task.Expect;
+import toolbox.Task.OutputKind;
+
+public class ModuleVersion extends ModuleTestBase {
+    public static void main(String... args) throws Exception {
+        ModuleVersion t = new ModuleVersion();
+        t.runTests();
+    }
+
+    @Test
+    public void testSetSingleModuleVersion(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { }");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String version = "1.2.3.4";
+
+        new JavacTask(tb)
+            .options("--module-version", version)
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll();
+
+        checkModuleVersion(classes.resolve("module-info.class"), version);
+    }
+
+    @Test
+    public void testMultipleModuleVersions(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1");
+        tb.writeJavaFiles(m1,
+                "module m1 { }");
+        Path m2 = src.resolve("m2");
+        tb.writeJavaFiles(m2,
+                "module m2 { }");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String version = "1.2.3.4";
+
+        new JavacTask(tb)
+            .options("--module-source-path", src.toString(),
+                     "--module-version", version)
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll();
+
+        checkModuleVersion(classes.resolve("m1").resolve("module-info.class"), version);
+        checkModuleVersion(classes.resolve("m2").resolve("module-info.class"), version);
+
+        String log = new JavacTask(tb, JavacTask.Mode.CMDLINE)
+            .options("--module-source-path", src.toString(),
+                     "--module-version", "b",
+                     "-XDrawDiagnostics")
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run(Expect.FAIL)
+            .writeAll()
+            .getOutput(OutputKind.DIRECT);
+
+        String expectedLog = "bad value for --module-version option: 'b'";
+
+        if (!log.contains(expectedLog)) {
+            throw new AssertionError("Incorrect log: " + log);
+        }
+    }
+
+    private void checkModuleVersion(Path classfile, String version) throws IOException, ConstantPoolException {
+        ClassFile cf = ClassFile.read(classfile);
+
+        Module_attribute moduleAttribute = (Module_attribute) cf.attributes.get(Attribute.Module);
+
+        if (moduleAttribute == null) {
+            throw new AssertionError("Version attribute missing!");
+        }
+
+        String actualVersion = cf.constant_pool.getUTF8Value(moduleAttribute.module_version_index);
+
+        if (!version.equals(actualVersion)) {
+            throw new AssertionError("Incorrect version in the classfile: " + actualVersion);
+        }
+    }
+
+}
--- a/langtools/test/tools/javac/modules/ModulesAndClassPathTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ModulesAndClassPathTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -58,14 +58,14 @@
         Path jar = prepareTestJar(base);
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m { }",
                           "package impl; public class Impl { api.Api api; }");
 
         List<String> modLog = new JavacTask(tb)
@@ -86,7 +86,7 @@
 
         new JavacTask(tb)
           .options("--class-path", jar.toString(),
-                   "--add-reads", "m1=ALL-UNNAMED")
+                   "--add-reads", "m=ALL-UNNAMED")
           .outdir(classes)
           .files(findJavaFiles(moduleSrc))
           .run()
@@ -95,7 +95,7 @@
 
         new JavacTask(tb)
           .options("--class-path", jar.toString() + File.pathSeparator + System.getProperty("test.classes"),
-                   "--add-reads", "m1=ALL-UNNAMED",
+                   "--add-reads", "m=ALL-UNNAMED",
                    "-processor", ProcessorImpl.class.getName())
           .outdir(classes)
           .files(findJavaFiles(moduleSrc))
@@ -109,14 +109,14 @@
         Path jar = prepareTestJar(base);
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m { }",
                           "package impl; public class Impl { api.Api api; }");
 
         List<String> modLog = new JavacTask(tb)
@@ -142,14 +142,14 @@
         Path jar = prepareTestJar(base);
 
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m { }",
                           "package impl; public class Impl { api.Api api; }");
 
         new JavacTask(tb)
@@ -222,14 +222,14 @@
     @Test
     public void testClassOutputVisibleForIncrementalCompilation(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m");
 
         Path classes = base.resolve("classes");
 
         Files.createDirectories(classes);
 
         tb.writeJavaFiles(m1,
-                          "module m1 { exports impl; }",
+                          "module m { exports impl; }",
                           "package impl; public class Impl { }",
                           "package src; public class Src { }",
                           "package test; public class TestCP extends impl.Impl { }",
--- a/langtools/test/tools/javac/modules/MultiModuleModeTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/MultiModuleModeTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -51,10 +51,10 @@
     @Test
     public void testDuplicateModules(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeJavaFiles(src_m1, "module m1 { }");
-        Path src_m2 = src.resolve("m2");
-        tb.writeJavaFiles(src_m2, "module m1 { }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1, "module m1x { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2, "module m1x { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
@@ -67,15 +67,15 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:1: compiler.err.duplicate.module: m1"))
+        if (!log.contains("module-info.java:1:1: compiler.err.duplicate.module: m1x"))
             throw new Exception("expected output not found");
     }
 
     @Test
     public void testCantFindModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeJavaFiles(src_m1, "module m1 { }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1, "module m1x { }");
         Path misc = base.resolve("misc");
         tb.writeJavaFiles(misc, "package p; class C { }");
         Path classes = base.resolve("classes");
@@ -97,8 +97,8 @@
     @Test
     public void testModuleNameMismatch(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path src_m1 = src.resolve("m1");
-        tb.writeJavaFiles(src_m1, "module m2 { }");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1, "module m2x { }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
@@ -111,22 +111,22 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:8: compiler.err.module.name.mismatch: m2, m1"))
+        if (!log.contains("module-info.java:1:8: compiler.err.module.name.mismatch: m2x, m1x"))
             throw new Exception("expected output not found");
     }
 
     @Test
     public void testImplicitModuleSource(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"), "module m1 { }");
-        tb.writeJavaFiles(src.resolve("m2"), "module m2 { requires m1; }");
+        tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }");
+        tb.writeJavaFiles(src.resolve("m2x"), "module m2x { requires m1x; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
         new JavacTask(tb)
                 .options("--module-source-path", src.toString())
                 .outdir(modules)
-                .files(src.resolve("m2/module-info.java"))
+                .files(src.resolve("m2x/module-info.java"))
                 .run()
                 .writeAll();
     }
@@ -134,19 +134,19 @@
     @Test
     public void testImplicitModuleClass(Path base) throws Exception {
         Path src1 = base.resolve("src1");
-        tb.writeJavaFiles(src1.resolve("m1"), "module m1 { }");
+        tb.writeJavaFiles(src1.resolve("m1x"), "module m1x { }");
         Path modules1 = base.resolve("modules1");
         Files.createDirectories(modules1);
 
         new JavacTask(tb)
                 .options("--module-source-path", src1.toString())
                 .outdir(modules1)
-                .files(src1.resolve("m1/module-info.java"))
+                .files(src1.resolve("m1x/module-info.java"))
                 .run()
                 .writeAll();
 
         Path src2= base.resolve("src2");
-        tb.writeJavaFiles(src2.resolve("m2"), "module m2 { requires m1; }");
+        tb.writeJavaFiles(src2.resolve("m2x"), "module m2x { requires m1x; }");
         Path modules2 = base.resolve("modules2");
         Files.createDirectories(modules2);
 
@@ -154,7 +154,7 @@
                 .options("--module-path", modules1.toString(),
                         "--module-source-path", src2.toString())
                 .outdir(modules2)
-                .files(src2.resolve("m2/module-info.java"))
+                .files(src2.resolve("m2x/module-info.java"))
                 .run()
                 .writeAll();
     }
--- a/langtools/test/tools/javac/modules/OpenModulesTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/OpenModulesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -61,14 +61,14 @@
 
     @Test
     public void testStrongModule(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
+        Path m1 = base.resolve("m1x");
         tb.writeJavaFiles(m1,
-                          "module m1 { exports api1; opens api2; }",
+                          "module m1x { exports api1; opens api2; }",
                           "package api1; public class Api1 {}",
                           "package api2; public class Api2 {}",
                           "package impl; public class Impl {}");
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         tb.createDirectories(m1Classes);
 
         String log = new JavacTask(tb)
@@ -87,9 +87,10 @@
                 .run()
                 .writeAll()
                 .getOutput(OutputKind.DIRECT)
-                .replace(System.getProperty("line.separator"), "\n");
+                .replace(System.getProperty("line.separator"), "\n")
+                .replaceAll("@[^;]*;", ";");
 
-        String expected = "module m1 {\n" +
+        String expected = "module m1x {\n" +
                           "  requires java.base;\n" +
                           "  exports api1;\n" +
                           "  opens api2;\n" +
@@ -100,11 +101,11 @@
         }
 
         //compiling against a strong module read from binary:
-        Path m2 = base.resolve("m2");
+        Path m2 = base.resolve("m2x");
         tb.writeJavaFiles(m2,
-                          "module m2 { requires m1; }",
+                          "module m2x { requires m1x; }",
                           "package test; public class Test { api1.Api1 a1; api2.Api2 a2; }");
-        Path m2Classes = classes.resolve("m2");
+        Path m2Classes = classes.resolve("m2x");
         tb.createDirectories(m2Classes);
 
         List<String> log2 = new JavacTask(tb)
@@ -124,14 +125,14 @@
 
     @Test
     public void testOpenModule(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
+        Path m1 = base.resolve("m1x");
         tb.writeJavaFiles(m1,
-                          "open module m1 { exports api1; }",
+                          "open module m1x { exports api1; }",
                           "package api1; public class Api1 {}",
                           "package api2; public class Api2 {}",
                           "package impl; public class Impl {}");
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         tb.createDirectories(m1Classes);
 
         String log = new JavacTask(tb)
@@ -150,9 +151,10 @@
                 .run()
                 .writeAll()
                 .getOutput(OutputKind.DIRECT)
-                .replace(System.getProperty("line.separator"), "\n");
+                .replace(System.getProperty("line.separator"), "\n")
+                .replaceAll("@[^;]*;", ";");
 
-        String expected = "open module m1 {\n" +
+        String expected = "open module m1x {\n" +
                           "  requires java.base;\n" +
                           "  exports api1;\n" +
                           "}";
@@ -162,11 +164,11 @@
         }
 
         //compiling against a ordinary module read from binary:
-        Path m2 = base.resolve("m2");
+        Path m2 = base.resolve("m2x");
         tb.writeJavaFiles(m2,
-                          "module m2 { requires m1; }",
+                          "module m2x { requires m1x; }",
                           "package test; public class Test { api1.Api1 a1; api2.Api2 a2; }");
-        Path m2Classes = classes.resolve("m2");
+        Path m2Classes = classes.resolve("m2x");
         tb.createDirectories(m2Classes);
 
         List<String> log2 = new JavacTask(tb)
@@ -186,14 +188,14 @@
 
     @Test
     public void testOpenModuleNoOpens(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
+        Path m1 = base.resolve("m1x");
         tb.writeJavaFiles(m1,
-                          "open module m1 { exports api1; opens api2; }",
+                          "open module m1x { exports api1; opens api2; }",
                           "package api1; public class Api1 {}",
                           "package api2; public class Api2 {}",
                           "package impl; public class Impl {}");
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         tb.createDirectories(m1Classes);
 
         List<String> log = new JavacTask(tb)
@@ -204,7 +206,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.no.opens.unless.strong",
+        List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.no.opens.unless.strong",
                                               "1 error");
 
         if (!expected.equals(log))
@@ -214,12 +216,12 @@
 
     @Test
     public void testNonZeroOpensInOpen(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
+        Path m1 = base.resolve("m1x");
         tb.writeJavaFiles(m1,
-                          "module m1 { opens api; }",
+                          "module m1x { opens api; }",
                           "package api; public class Api {}");
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         tb.createDirectories(m1Classes);
 
         new JavacTask(tb)
@@ -235,6 +237,7 @@
         Module_attribute newModule = new Module_attribute(module.attribute_name_index,
                                                           module.module_name,
                                                           module.module_flags | Module_attribute.ACC_OPEN,
+                                                          module.module_version_index,
                                                           module.requires,
                                                           module.exports,
                                                           module.opens,
@@ -270,14 +273,17 @@
         List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                          "--module-path", classes.toString(),
-                         "--add-modules", "m1")
+                         "--add-modules", "m1x")
                 .outdir(testClasses)
                 .files(findJavaFiles(test))
                 .run(Expect.FAIL)
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("- compiler.err.cant.access: m1.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.non.zero.opens: m1))",
+        List<String> expected = Arrays.asList(
+                "- compiler.err.cant.access: m1x.module-info, "
+                        + "(compiler.misc.bad.class.file.header: module-info.class, "
+                        + "(compiler.misc.module.non.zero.opens: m1x))",
                                               "1 error");
 
         if (!expected.equals(log))
--- a/langtools/test/tools/javac/modules/OutputDirTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/OutputDirTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -100,7 +100,7 @@
     public void testExplodedOutDir(Path base) throws Exception {
         Path modSrc = base.resolve("modSrc");
         tb.writeJavaFiles(modSrc,
-                "module m1 { exports p; }",
+                "module m1x { exports p; }",
                 "package p; public class CC { }");
         Path modClasses = base.resolve("modClasses");
         Files.createDirectories(modClasses);
@@ -114,7 +114,7 @@
         Path src = base.resolve("src");
         Path src_m = src.resolve("m");
         tb.writeJavaFiles(src_m,
-                "module m { requires m1 ; }",
+                "module m { requires m1x ; }",
                 "class C { }");
 
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
@@ -134,7 +134,7 @@
     public void testInExplodedOutDir(Path base) throws Exception {
         Path modSrc = base.resolve("modSrc");
         tb.writeJavaFiles(modSrc,
-                "module m1 { exports p; }",
+                "module m1x { exports p; }",
                 "package p; public class CC { }");
         Path modClasses = base.resolve("modClasses");
         Files.createDirectories(modClasses);
@@ -147,7 +147,7 @@
 
         Path src = base.resolve("src");
         tb.writeJavaFiles(src,
-                "module m { requires m1 ; }",
+                "module m { requires m1x ; }",
                 "class C { }");
 
         Path classes = modClasses.resolve("m");
--- a/langtools/test/tools/javac/modules/PackageConflictTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/PackageConflictTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -40,7 +40,6 @@
 import toolbox.JavacTask;
 import toolbox.ModuleBuilder;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class PackageConflictTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -70,13 +69,13 @@
 
     @Test
     public void testDisjoint(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
-        Path m2 = base.resolve("m2");
+        Path m1 = base.resolve("m1x");
+        Path m2 = base.resolve("m2x");
         tb.writeJavaFiles(m1,
-                          "module m1 { }",
+                          "module m1x { }",
                           "package test; public class A { }");
         tb.writeJavaFiles(m2,
-                          "module m2 { }",
+                          "module m2x { }",
                           "package test; public class B { }");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -91,17 +90,17 @@
 
     @Test
     public void testConflictInDependencies(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
-        Path m2 = base.resolve("m2");
-        Path m3 = base.resolve("m3");
+        Path m1 = base.resolve("m1x");
+        Path m2 = base.resolve("m2x");
+        Path m3 = base.resolve("m3x");
         tb.writeJavaFiles(m1,
-                          "module m1 { exports test; }",
+                          "module m1x { exports test; }",
                           "package test; public class A { }");
         tb.writeJavaFiles(m2,
-                          "module m2 { exports test; }",
+                          "module m2x { exports test; }",
                           "package test; public class B { }");
         tb.writeJavaFiles(m3,
-                          "module m3 { requires m1; requires m2; }",
+                          "module m3x { requires m1x; requires m2x; }",
                           "package impl; public class Impl { }");
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -115,7 +114,7 @@
                        .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected =
-                Arrays.asList("module-info.java:1:1: compiler.err.package.clash.from.requires: m3, test, m1, m2",
+                Arrays.asList("module-info.java:1:1: compiler.err.package.clash.from.requires: m3x, test, m1x, m2x",
                               "1 error");
 
         if (!expected.equals(log)) {
--- a/langtools/test/tools/javac/modules/PackageMultipleModules.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/PackageMultipleModules.java	Fri Dec 16 11:58:18 2016 -0800
@@ -49,14 +49,14 @@
 
     @Test
     public void testSimple(Path base) throws Exception {
-        Path m1 = base.resolve("m1");
-        Path m2 = base.resolve("m2");
+        Path m1 = base.resolve("m1x");
+        Path m2 = base.resolve("m2x");
         tb.writeJavaFiles(m1,
-                          "module m1 {}",
+                          "module m1x {}",
                           "package test; import test.B; public class A {}",
                           "package test; public class A1 extends A {}");
         tb.writeJavaFiles(m2,
-                          "module m2 {}",
+                          "module m2x {}",
                           "package test; import test.A; public class B {}",
                           "package test; public class B1 extends B {}");
         Path classes = base.resolve("classes");
--- a/langtools/test/tools/javac/modules/PluginsInModulesTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/PluginsInModulesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -39,7 +39,6 @@
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class PluginsInModulesTest extends ModuleTestBase {
 
@@ -48,7 +47,7 @@
     }
 
     private static final String pluginModule1 =
-            "module pluginMod1 {\n" +
+            "module pluginMod1x {\n" +
             "    requires jdk.compiler;\n" +
             "\n" +
             "    provides com.sun.source.util.Plugin\n" +
@@ -95,7 +94,7 @@
 
     void initialization(Path base) throws Exception {
         moduleSrc = base.resolve("plugin_mods_src");
-        Path pluginMod1 = moduleSrc.resolve("pluginMod1");
+        Path pluginMod1 = moduleSrc.resolve("pluginMod1x");
 
         processorCompiledModules = base.resolve("mods");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,87 @@
+/*
+ * 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 8160181
+ * @summary Add lint warning for digits in module names
+ * @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
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
+ * @run main PoorChoiceForModuleNameTest
+ */
+
+
+import java.nio.file.Path;
+
+import toolbox.JavacTask;
+import toolbox.Task;
+
+public class PoorChoiceForModuleNameTest extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        new PoorChoiceForModuleNameTest().runTests();
+    }
+
+    @Test
+    public void testDigitsInModuleNames(Path base) throws Exception {
+
+        Path src = base.resolve("src");
+
+        // Nitpickable module name
+        Path src_m1 = src.resolve("mango19");
+        tb.writeJavaFiles(src_m1, "module mango19 { }");
+
+        // Acceptable module name.
+        Path src_m2 = src.resolve("mango20kg");
+        tb.writeJavaFiles(src_m2, "module mango20kg { }");
+
+        // Nitpickable, but should not due to annotation.
+        Path src_m3 = src.resolve("mango100");
+        tb.writeJavaFiles(src_m3, "@SuppressWarnings(\"module\") module mango100 { }");
+
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-Xlint:module",
+                         "-Werror",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango19") ||
+            !log.contains("- compiler.err.warnings.and.werror") ||
+            !log.contains("1 error") ||
+            !log.contains("1 warning"))
+            throw new Exception("expected output not found: " + log);
+    }
+}
+
--- a/langtools/test/tools/javac/modules/ProvidesTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ProvidesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -68,11 +68,11 @@
     @Test
     public void testMulti(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { exports p1; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { exports p1; }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; provides p1.C1 with p2.C2; }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; provides p1.C1 with p2.C2; }",
                 "package p2; public class C2 extends p1.C1 { }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
--- a/langtools/test/tools/javac/modules/QueryBeforeEnter.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/QueryBeforeEnter.java	Fri Dec 16 11:58:18 2016 -0800
@@ -77,17 +77,17 @@
     @Test
     public void testUnnamed(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "module m1 { exports m1; }",
-                          "package m1; public class M1 {}");
+                          "module m1x { exports m1x; }",
+                          "package m1x; public class M1 {}");
 
-        Path m2 = moduleSrc.resolve("m2");
+        Path m2 = moduleSrc.resolve("m2x");
 
         tb.writeJavaFiles(m2,
-                          "module m2 { exports m2; }",
-                          "package m2; public class M2 {}");
+                          "module m2x { exports m2x; }",
+                          "package m2x; public class M2 {}");
 
         Path modulePath = base.resolve("module-path");
 
@@ -138,32 +138,32 @@
                                                               fm.getJavaFileObjects(src.resolve("test").resolve("Test2.java")));
             assertNotNull(task.getElements().getTypeElement("java.lang.String"));
             assertNotNull(task.getElements().getTypeElement("javax.tools.ToolProvider"));
-            assertNull(task.getElements().getTypeElement("m1.M1"));
-            assertNull(task.getElements().getTypeElement("m2.M2"));
+            assertNull(task.getElements().getTypeElement("m1x.M1"));
+            assertNull(task.getElements().getTypeElement("m2x.M2"));
             assertNotNull(task.getElements().getTypeElement("cp.CP"));
             assertNotNull(task.getElements().getTypeElement("test.Test1"));
             assertNotNull(task.getElements().getTypeElement("test.Test2"));
             assertNotNull(task.getElements().getModuleElement("java.base"));
             assertNotNull(task.getElements().getModuleElement("java.compiler"));
-            assertNull(task.getElements().getModuleElement("m1"));
-            assertNull(task.getElements().getModuleElement("m2"));
+            assertNull(task.getElements().getModuleElement("m1x"));
+            assertNull(task.getElements().getModuleElement("m2x"));
         }
     }
 
     @Test
     public void testSingleNamed(Path base) throws Exception {
         Path moduleSrc = base.resolve("module-src");
-        Path m1 = moduleSrc.resolve("m1");
+        Path m1 = moduleSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "module m1 { exports m1; }",
-                          "package m1; public class M1 {}");
+                          "module m1x { exports m1x; }",
+                          "package m1x; public class M1 {}");
 
-        Path m2 = moduleSrc.resolve("m2");
+        Path m2 = moduleSrc.resolve("m2x");
 
         tb.writeJavaFiles(m2,
-                          "module m2 { exports m2; }",
-                          "package m2; public class M2 {}");
+                          "module m2x { exports m2x; }",
+                          "package m2x; public class M2 {}");
 
         Path modulePath = base.resolve("module-path");
 
@@ -194,7 +194,7 @@
         Path src = base.resolve("src");
 
         tb.writeJavaFiles(src,
-                          "module test { requires java.base; requires m1; } ",
+                          "module test { requires java.base; requires m1x; } ",
                           "package test; public class Test {}");
 
         Path out = base.resolve("out");
@@ -214,13 +214,13 @@
                                                               fm.getJavaFileObjects(findJavaFiles(src)));
             assertNotNull(task.getElements().getTypeElement("java.lang.String"));
             assertNull(task.getElements().getTypeElement("javax.tools.ToolProvider"));
-            assertNotNull(task.getElements().getTypeElement("m1.M1"));
-            assertNull(task.getElements().getTypeElement("m2.M2"));
+            assertNotNull(task.getElements().getTypeElement("m1x.M1"));
+            assertNull(task.getElements().getTypeElement("m2x.M2"));
             assertNotNull(task.getElements().getTypeElement("test.Test"));
             assertNotNull(task.getElements().getModuleElement("java.base"));
             assertNull(task.getElements().getModuleElement("java.compiler"));
-            assertNotNull(task.getElements().getModuleElement("m1"));
-            assertNull(task.getElements().getModuleElement("m2"));
+            assertNotNull(task.getElements().getModuleElement("m1x"));
+            assertNull(task.getElements().getModuleElement("m2x"));
             assertNotNull(task.getElements().getModuleElement("test"));
         }
     }
@@ -228,17 +228,17 @@
     @Test
     public void testMultiModule(Path base) throws Exception {
         Path modulePathSrc = base.resolve("module-path-src");
-        Path m1 = modulePathSrc.resolve("m1");
+        Path m1 = modulePathSrc.resolve("m1x");
 
         tb.writeJavaFiles(m1,
-                          "module m1 { exports m1; }",
-                          "package m1; public class M1 {}");
+                          "module m1x { exports m1x; }",
+                          "package m1x; public class M1 {}");
 
-        Path m2 = modulePathSrc.resolve("m2");
+        Path m2 = modulePathSrc.resolve("m2x");
 
         tb.writeJavaFiles(m2,
-                          "module m2 { exports m2; }",
-                          "package m2; public class M2 {}");
+                          "module m2x { exports m2x; }",
+                          "package m2x; public class M2 {}");
 
         Path modulePath = base.resolve("module-path");
 
@@ -267,17 +267,17 @@
                 .writeAll();
 
         Path moduleSrc = base.resolve("module-src");
-        Path m3 = moduleSrc.resolve("m3");
+        Path m3 = moduleSrc.resolve("m3x");
 
         tb.writeJavaFiles(m3,
-                          "module m3 { requires m1; exports m3; }",
-                          "package m3; public class M3 {  }");
+                          "module m3x { requires m1x; exports m3x; }",
+                          "package m3x; public class M3 {  }");
 
-        Path m4 = moduleSrc.resolve("m4");
+        Path m4 = moduleSrc.resolve("m4x");
 
         tb.writeJavaFiles(m4,
-                          "module m4 { exports m4; }",
-                          "package m4; public class M4 {}");
+                          "module m4x { exports m4x; }",
+                          "package m4x; public class M4 {}");
 
         Path out = base.resolve("out");
 
@@ -297,16 +297,16 @@
                                                               fm.getJavaFileObjects(findJavaFiles(moduleSrc)));
             assertNotNull(task.getElements().getTypeElement("java.lang.String"));
             assertNull(task.getElements().getTypeElement("javax.tools.ToolProvider"));
-            assertNotNull(task.getElements().getTypeElement("m1.M1"));
-            assertNull(task.getElements().getTypeElement("m2.M2"));
-            assertNotNull(task.getElements().getTypeElement("m3.M3"));
-            assertNotNull(task.getElements().getTypeElement("m4.M4"));
+            assertNotNull(task.getElements().getTypeElement("m1x.M1"));
+            assertNull(task.getElements().getTypeElement("m2x.M2"));
+            assertNotNull(task.getElements().getTypeElement("m3x.M3"));
+            assertNotNull(task.getElements().getTypeElement("m4x.M4"));
             assertNotNull(task.getElements().getModuleElement("java.base"));
             assertNull(task.getElements().getModuleElement("java.compiler"));
-            assertNotNull(task.getElements().getModuleElement("m1"));
-            assertNull(task.getElements().getModuleElement("m2"));
-            assertNotNull(task.getElements().getModuleElement("m3"));
-            assertNotNull(task.getElements().getModuleElement("m4"));
+            assertNotNull(task.getElements().getModuleElement("m1x"));
+            assertNull(task.getElements().getModuleElement("m2x"));
+            assertNotNull(task.getElements().getModuleElement("m3x"));
+            assertNotNull(task.getElements().getModuleElement("m4x"));
         }
     }
 
--- a/langtools/test/tools/javac/modules/RequiresStaticTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/RequiresStaticTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -146,19 +146,19 @@
 
     /*
      * Set up the following module graph
-     *     m1 -> m2 => m3 -=-> m4 --> m5
+     *     m1x -> m2x => m3x -=-> m4x --> m5
      *            \           /
      *              \       /
      *                v   v
-     *                  m6 => m7 --> m8
+     *                  m6x => m7x --> m8
      * where -> is requires, => is requires transitive, --> is requires static, -=-> is requires transitive static
      */
     Path getComplexSrc(Path base, String m1_extraImports, String m1_extraUses) throws Exception {
         Path src = base.resolve("src");
 
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                "module m1 { requires m2; }",
+                "module m1x { requires m2x; }",
                 "package p1;\n"
                 + "import p2.C2;\n"
                 + "import p3.C3;\n"
@@ -169,49 +169,49 @@
                 + m1_extraUses
                 + "}\n");
 
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                "module m2 {\n"
-                + "  requires transitive m3;\n"
-                + "  requires static m6;\n"
+                "module m2x {\n"
+                + "  requires transitive m3x;\n"
+                + "  requires static m6x;\n"
                 + "  exports p2;\n"
                 + "}",
                 "package p2;\n"
                 + "public class C2 {p7.C7 c7; p6.C6 c6; p4.C4 c4;}\n");
 
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                "module m3 { requires transitive static m4; exports p3; }",
+                "module m3x { requires transitive static m4x; exports p3; }",
                 "package p3;\n"
                 + "public class C3 { }\n");
 
-        Path src_m4 = src.resolve("m4");
+        Path src_m4 = src.resolve("m4x");
         tb.writeJavaFiles(src_m4,
-                "module m4 { requires m5; requires static m6; exports p4; }",
+                "module m4x { requires m5x; requires static m6x; exports p4; }",
                 "package p4;\n"
                 + "public class C4 { p6.C6 c6; p7.C7 c7;}\n");
 
-        Path src_m5 = src.resolve("m5");
+        Path src_m5 = src.resolve("m5x");
         tb.writeJavaFiles(src_m5,
-                "module m5 { exports p5; }",
+                "module m5x { exports p5; }",
                 "package p5;\n"
                 + "public class C5 { }\n");
 
-        Path src_m6 = src.resolve("m6");
+        Path src_m6 = src.resolve("m6x");
         tb.writeJavaFiles(src_m6,
-                "module m6 { requires transitive m7; exports p6; }",
+                "module m6x { requires transitive m7x; exports p6; }",
                 "package p6;\n"
                 + "public class C6 { p7.C7 c7; }\n");
 
-        Path src_m7 = src.resolve("m7");
+        Path src_m7 = src.resolve("m7x");
         tb.writeJavaFiles(src_m7,
-                "module m7 { requires static m8; exports p7; }",
+                "module m7x { requires static m8x; exports p7; }",
                 "package p7;\n"
                 + "public class C7 { p8.C8 c8; }\n");
 
-        Path src_m8 = src.resolve("m8");
+        Path src_m8 = src.resolve("m8x");
         tb.writeJavaFiles(src_m8,
-                "module m8 { exports p8; }",
+                "module m8x { exports p8; }",
                 "package p8;\n"
                         + "public class C8 { }\n");
 
@@ -221,14 +221,14 @@
     @Test
     public void testRequiresStatic(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
+        Path m1 = src.resolve("m1x");
         tb.writeJavaFiles(m1,
-                "module m1 { exports m1; }",
-                "package m1;" +
+                "module m1x { exports m1x; }",
+                "package m1x;" +
                 "public class Api { }\n");
 
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         Files.createDirectories(m1Classes);
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -237,25 +237,25 @@
                 .run()
                 .writeAll();
 
-        Path m3 = src.resolve("m3");
+        Path m3 = src.resolve("m3x");
         tb.writeJavaFiles(m3,
-                "module m3 { requires static m1; }",
-                "package m3;\n" +
+                "module m3x { requires static m1x; }",
+                "package m3x;\n" +
                 "public class Test {\n" +
                 "    public static void main(String... args) {\n" +
                 "        try {\n" +
-                "           Class.forName(\"m1.Api\");\n" +
+                "           Class.forName(\"m1x.Api\");\n" +
                 "        } catch (ClassNotFoundException e) {\n" +
                 "            System.err.println(\"ok\");\n" +
                 "        }\n" +
                 "    }\n" +
                 "}",
-                "package m3;\n" +
+                "package m3x;\n" +
                 "public class ApiUse{\n" +
-                "    m1.Api api;\n" +
+                "    m1x.Api api;\n" +
                 "}");
 
-        Path m3Classes = classes.resolve("m3");
+        Path m3Classes = classes.resolve("m3x");
         Files.createDirectories(m3Classes);
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -266,8 +266,8 @@
                 .writeAll();
 
         String log = new JavaTask(tb)
-                .vmOptions("--module-path", m3Classes.toString(), "--add-modules", "m3")
-                .className("m3.Test")
+                .vmOptions("--module-path", m3Classes.toString(), "--add-modules", "m3x")
+                .className("m3x.Test")
                 .run()
                 .writeAll()
                 .getOutput(OutputKind.STDERR);
@@ -282,14 +282,14 @@
     @Test
     public void testRequiresTransitiveStatic(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
+        Path m1 = src.resolve("m1x");
         tb.writeJavaFiles(m1,
-                "module m1 { exports m1; }",
-                "package m1;" +
+                "module m1x { exports m1x; }",
+                "package m1x;" +
                 "public class Api { }\n");
 
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         Files.createDirectories(m1Classes);
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -298,11 +298,11 @@
                 .run()
                 .writeAll();
 
-        Path m2 = src.resolve("m2");
+        Path m2 = src.resolve("m2x");
         tb.writeJavaFiles(m2,
-                "module m2 { requires transitive static m1; }");
+                "module m2x { requires transitive static m1x; }");
 
-        Path m2Classes = classes.resolve("m2");
+        Path m2Classes = classes.resolve("m2x");
         Files.createDirectories(m2Classes);
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -312,25 +312,25 @@
                 .run()
                 .writeAll();
 
-        Path m3 = src.resolve("m3");
+        Path m3 = src.resolve("m3x");
         tb.writeJavaFiles(m3,
-                "module m3 { requires m2; }",
-                "package m3;\n" +
+                "module m3x { requires m2x; }",
+                "package m3x;\n" +
                 "public class Test {\n" +
                 "    public static void main(String... args) {\n" +
                 "        try {\n" +
-                "           Class.forName(\"m1.Api\");\n" +
+                "           Class.forName(\"m1x.Api\");\n" +
                 "        } catch (ClassNotFoundException e) {\n" +
                 "            System.err.println(\"ok\");\n" +
                 "        }\n" +
                 "    }\n" +
                 "}",
-                "package m3;\n" +
+                "package m3x;\n" +
                 "public class ApiUse{\n" +
-                "    m1.Api api;\n" +
+                "    m1x.Api api;\n" +
                 "}");
 
-        Path m3Classes = classes.resolve("m3");
+        Path m3Classes = classes.resolve("m3x");
         Files.createDirectories(m3Classes);
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -342,8 +342,8 @@
 
         String log = new JavaTask(tb)
                 .vmOptions("--module-path", m2Classes.toString() + File.pathSeparator + m3Classes.toString(),
-                           "--add-modules", "m3")
-                .className("m3.Test")
+                           "--add-modules", "m3x")
+                .className("m3x.Test")
                 .run()
                 .writeAll()
                 .getOutput(OutputKind.STDERR);
@@ -358,14 +358,14 @@
     @Test
     public void testRequiresStaticTransitive(Path base) throws Exception {
         Path src = base.resolve("src");
-        Path m1 = src.resolve("m1");
+        Path m1 = src.resolve("m1x");
         tb.writeJavaFiles(m1,
-                "module m1 { exports m1; }",
-                "package m1;" +
+                "module m1x { exports m1x; }",
+                "package m1x;" +
                 "public class Api { }\n");
 
         Path classes = base.resolve("classes");
-        Path m1Classes = classes.resolve("m1");
+        Path m1Classes = classes.resolve("m1x");
         Files.createDirectories(m1Classes);
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -374,11 +374,11 @@
                 .run()
                 .writeAll();
 
-        Path m2 = src.resolve("m2");
+        Path m2 = src.resolve("m2x");
         tb.writeJavaFiles(m2,
-                "module m2 { requires transitive static m1; }");
+                "module m2x { requires transitive static m1x; }");
 
-        Path m2Classes = classes.resolve("m2");
+        Path m2Classes = classes.resolve("m2x");
         Files.createDirectories(m2Classes);
 
         new JavacTask(tb, Task.Mode.CMDLINE)
--- a/langtools/test/tools/javac/modules/RequiresTransitiveTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/RequiresTransitiveTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -140,16 +140,16 @@
 
     /*
      * Set up the following module graph
-     *     m1 -> m2 => m3 => m4 -> m5
-     *              -> m6 => m7
+     *     m1x -> m2x => m3x => m4x -> m5x
+     *              -> m6x => m7x
      * where -> is requires, => is requires transitive
      */
     Path getComplexSrc(Path base, String m1_extraImports, String m1_extraUses) throws Exception {
         Path src = base.resolve("src");
 
-        Path src_m1 = src.resolve("m1");
+        Path src_m1 = src.resolve("m1x");
         tb.writeJavaFiles(src_m1,
-                "module m1 { requires m2; }",
+                "module m1x { requires m2x; }",
                 "package p1;\n"
                 + "import p2.C2;\n"
                 + "import p3.C3;\n"
@@ -160,43 +160,43 @@
                 + m1_extraUses
                 + "}\n");
 
-        Path src_m2 = src.resolve("m2");
+        Path src_m2 = src.resolve("m2x");
         tb.writeJavaFiles(src_m2,
-                "module m2 {\n"
-                + "  requires transitive m3;\n"
-                + "  requires        m6;\n"
+                "module m2x {\n"
+                + "  requires transitive m3x;\n"
+                + "  requires        m6x;\n"
                 + "  exports p2;\n"
                 + "}",
                 "package p2;\n"
                 + "public class C2 { }\n");
 
-        Path src_m3 = src.resolve("m3");
+        Path src_m3 = src.resolve("m3x");
         tb.writeJavaFiles(src_m3,
-                "module m3 { requires transitive m4; exports p3; }",
+                "module m3x { requires transitive m4x; exports p3; }",
                 "package p3;\n"
                 + "public class C3 { }\n");
 
-        Path src_m4 = src.resolve("m4");
+        Path src_m4 = src.resolve("m4x");
         tb.writeJavaFiles(src_m4,
-                "module m4 { requires m5; exports p4; }",
+                "module m4x { requires m5x; exports p4; }",
                 "package p4;\n"
                 + "public class C4 { }\n");
 
-        Path src_m5 = src.resolve("m5");
+        Path src_m5 = src.resolve("m5x");
         tb.writeJavaFiles(src_m5,
-                "module m5 { exports p5; }",
+                "module m5x { exports p5; }",
                 "package p5;\n"
                 + "public class C5 { }\n");
 
-        Path src_m6 = src.resolve("m6");
+        Path src_m6 = src.resolve("m6x");
         tb.writeJavaFiles(src_m6,
-                "module m6 { requires transitive m7; exports p6; }",
+                "module m6x { requires transitive m7x; exports p6; }",
                 "package p6;\n"
                 + "public class C6 { }\n");
 
-        Path src_m7 = src.resolve("m7");
+        Path src_m7 = src.resolve("m7x");
         tb.writeJavaFiles(src_m7,
-                "module m7 { exports p7; }",
+                "module m7x { exports p7; }",
                 "package p7;\n"
                 + "public class C7 { }\n");
 
--- a/langtools/test/tools/javac/modules/ResolveTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ResolveTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -36,7 +36,6 @@
 
 import toolbox.JavacTask;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class ResolveTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -83,11 +82,11 @@
     @Test
     public void testUnexportedTypeUnreadableModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { }",
                 "package p2; public class C2 { p1.C1 c; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
@@ -107,11 +106,11 @@
     @Test
     public void testUnexportedTypeReadableModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; }",
                 "package p2; public class C2 { p1.C1 c; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
@@ -131,14 +130,14 @@
     @Test
     public void testQualifiedExportedTypeReadableModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { exports p1 to m3; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { exports p1 to m3x; }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; }",
                 "package p2; public class C2 { p1.C1 c; }");
-        tb.writeJavaFiles(src.resolve("m3"),
-                "module m3 { requires m1; }");
+        tb.writeJavaFiles(src.resolve("m3x"),
+                "module m3x { requires m1x; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
@@ -157,11 +156,11 @@
     @Test
     public void testExportedTypeUnreadableModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { exports p1; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { exports p1; }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { }",
                 "package p2; public class C2 { p1.C1 c; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
@@ -181,11 +180,11 @@
     @Test
     public void testExportedTypeReadableModule(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { exports p1; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { exports p1; }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; }",
                 "package p2; public class C2 { p1.C1 c; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
@@ -201,11 +200,11 @@
     @Test
     public void testExportedTypeReadableModule2(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { exports p1 to m2; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { exports p1 to m2x; }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; }",
                 "package p2; public class C2 { p1.C1 c; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
--- a/langtools/test/tools/javac/modules/ServiceProvidedButNotExportedOrUsedTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/ServiceProvidedButNotExportedOrUsedTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -78,13 +78,13 @@
     @Test
     public void testImplementationMustBeInSameModuleAsProvidesDirective(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { exports p1; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { exports p1; }",
                 "package p1; public class C1 { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; requires m3; provides p1.C1 with p2.C2; }");
-        tb.writeJavaFiles(src.resolve("m3"),
-                "module m3 { requires m1; exports p2; }",
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; requires m3x; provides p1.C1 with p2.C2; }");
+        tb.writeJavaFiles(src.resolve("m3x"),
+                "module m3x { requires m1x; exports p2; }",
                 "package p2; public class C2 extends p1.C1 { }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
@@ -97,7 +97,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
         List<String> expected = Arrays.asList(
-                "module-info.java:1:39: compiler.err.service.implementation.not.in.right.module: m3",
+                "module-info.java:1:42: compiler.err.service.implementation.not.in.right.module: m3x",
                 "1 error");
         if (!output.containsAll(expected)) {
             throw new Exception("Expected output not found");
--- a/langtools/test/tools/javac/modules/SingleModuleModeTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/SingleModuleModeTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -61,8 +61,8 @@
     @Test
     public void testTooManyModules(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"), "module m1 { }");
-        tb.writeJavaFiles(src.resolve("m2"), "module m2 { }");
+        tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }");
+        tb.writeJavaFiles(src.resolve("m2x"), "module m2x { }");
 
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
--- a/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -38,7 +38,6 @@
 import toolbox.JavacTask;
 import toolbox.ModuleBuilder;
 import toolbox.Task;
-import toolbox.ToolBox;
 
 public class UpgradeModulePathTest extends ModuleTestBase {
 
@@ -50,19 +49,19 @@
     @Test
     public void simpleUsage(Path base) throws Exception {
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class E { }")
                 .build(modules);
 
         final Path upgradeModules = base.resolve("upgradeModules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg2")
                 .classes("package pkg2; public class E { }")
                 .build(upgradeModules);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }",
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -76,19 +75,19 @@
     @Test
     public void onlyUpgradeModulePath(Path base) throws Exception {
         final Path module = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class E { }")
                 .build(module);
 
         final Path upgradeModule = base.resolve("upgradeModule");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg2")
                 .classes("package pkg2; public class E { }")
                 .build(upgradeModule);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }",
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -101,28 +100,28 @@
     @Test
     public void withModuleSourcePath(Path base) throws Exception {
         final Path module = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class E { }")
                 .build(module);
 
         final Path upgradeModule = base.resolve("upgradeModule");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg2")
                 .classes("package pkg2; public class E { }")
                 .build(upgradeModule);
 
         final Path s = base.resolve("source");
-        tb.writeJavaFiles(s.resolve("m3"), "module m3 { }");
+        tb.writeJavaFiles(s.resolve("m3x"), "module m3x { }");
 
         final Path upgradeModule3 = base.resolve("upgradeModule");
-        new ModuleBuilder(tb, "m3")
+        new ModuleBuilder(tb, "m3x")
                 .exports("pkg3")
                 .classes("package pkg3; public class E { }")
                 .build(upgradeModule);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m2"), "module m2 { requires m1; requires m3; }",
+        tb.writeJavaFiles(src.resolve("m2x"), "module m2x { requires m1x; requires m3x; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -138,19 +137,19 @@
     @Test
     public void sameUpgradeAndModulePath(Path base) throws Exception {
         final Path module = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class E { }")
                 .build(module);
 
         final Path upgradeModule = base.resolve("upgradeModule");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg2")
                 .classes("package pkg2; public class E { }")
                 .build(upgradeModule);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }",
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -164,7 +163,7 @@
     @Test
     public void dummyFileInUpgradeModulePath(Path base) throws Exception {
         final Path module = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class E { }")
                 .build(module);
@@ -173,7 +172,7 @@
         tb.writeFile(dummy, "");
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }",
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
         String output = new JavacTask(tb, Task.Mode.CMDLINE)
@@ -192,28 +191,28 @@
     @Test
     public void severalUpgradeModules(Path base) throws Exception {
         final Path module = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class A { }")
                 .build(module);
 
-        new ModuleBuilder(tb, "m2")
+        new ModuleBuilder(tb, "m2x")
                 .exports("pkg2")
                 .classes("package pkg2; public class B { }")
                 .build(module);
 
         Path upgradeModule = base.resolve("upgradeModule");
-        new ModuleBuilder(tb, "m2")
+        new ModuleBuilder(tb, "m2x")
                 .exports("pkg2")
                 .classes("package pkg2; public class BC { }")
                 .build(upgradeModule);
-        new ModuleBuilder(tb, "m3")
+        new ModuleBuilder(tb, "m3x")
                 .exports("pkg3")
                 .classes("package pkg3; public class DC { }")
                 .build(upgradeModule);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m4 { requires m1; requires m2; requires m3; }",
+        tb.writeJavaFiles(src, "module m4x { requires m1x; requires m2x; requires m3x; }",
                 "package p; class A { void main() { pkg1.A.class.getName(); pkg2.BC.class.getName(); pkg3.DC.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -224,7 +223,7 @@
                 .writeAll();
 
         Path src2 = base.resolve("src2");
-        tb.writeJavaFiles(src2, "module m4 { requires m1; }",
+        tb.writeJavaFiles(src2, "module m4x { requires m1x; }",
                 "package p; class A { void main() { pkg2.B.class.getName(); } }");
 
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
@@ -243,25 +242,25 @@
     @Test
     public void severalUpgradeModulePathsLastWin(Path base) throws Exception {
         final Path module = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg1")
                 .classes("package pkg1; public class E { }")
                 .build(module);
 
         final Path upgradeModule1 = base.resolve("upgradeModule1");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg2")
                 .classes("package pkg2; public class EC1 { }")
                 .build(upgradeModule1);
 
         final Path upgradeModule2 = base.resolve("upgradeModule2");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("pkg2")
                 .classes("package pkg2; public class EC2 { }")
                 .build(upgradeModule2);
 
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m2 { requires m1; }",
+        tb.writeJavaFiles(src, "module m2x { requires m1x; }",
                 "package p; class A { void main() { pkg2.EC2.class.getName(); } }");
 
         new JavacTask(tb, Task.Mode.CMDLINE)
@@ -273,7 +272,7 @@
                 .writeAll();
 
         Path src2 = base.resolve("src2");
-        tb.writeJavaFiles(src2, "module m2 { requires m1; }",
+        tb.writeJavaFiles(src2, "module m2x { requires m1x; }",
                 "package p; class A { void main() { pkg2.EC1.class.getName(); } }");
 
         final String log = new JavacTask(tb, Task.Mode.CMDLINE)
--- a/langtools/test/tools/javac/modules/UsesTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/modules/UsesTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -145,11 +145,11 @@
     @Test
     public void testMulti(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { exports p; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { exports p; }",
                 "package p; public class C { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; uses p.C; }");
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; uses p.C; }");
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
@@ -165,19 +165,19 @@
     public void testMultiOnModulePath(Path base) throws Exception {
         Path modSrc = base.resolve("modSrc");
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("p")
                 .classes("package p; public class C { }")
                 .build(modules);
-        new ModuleBuilder(tb, "m2")
-                .requires("m1")
+        new ModuleBuilder(tb, "m2x")
+                .requires("m1x")
                 .uses("p.C")
                 .write(modSrc);
 
         new JavacTask(tb)
                 .options("-p", modules.toString())
                 .outdir(modules)
-                .files(findJavaFiles(modSrc.resolve("m2")))
+                .files(findJavaFiles(modSrc.resolve("m2x")))
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
@@ -186,19 +186,19 @@
     public void testMultiOnModulePathInner(Path base) throws Exception {
         Path modSrc = base.resolve("modSrc");
         Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
+        new ModuleBuilder(tb, "m1x")
                 .exports("p")
                 .classes("package p; public class C { public class Inner { } }")
                 .build(modules);
-        new ModuleBuilder(tb, "m2")
-                .requires("m1")
+        new ModuleBuilder(tb, "m2x")
+                .requires("m1x")
                 .uses("p.C.Inner")
                 .write(modSrc);
 
         new JavacTask(tb)
                 .options("-p", modules.toString())
                 .outdir(modules)
-                .files(findJavaFiles(modSrc.resolve("m2")))
+                .files(findJavaFiles(modSrc.resolve("m2x")))
                 .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
@@ -248,11 +248,11 @@
     @Test
     public void testUsesUnexportedService(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { }",
                 "package p; public class C { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; uses p.C; }");
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; uses p.C; }");
 
         List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "--module-source-path", src.toString())
@@ -262,7 +262,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.not.def.access.package.cant.access: p.C, p",
+        List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
                 "1 error");
         if (!output.containsAll(expected)) {
             throw new Exception("Expected output not found");
@@ -272,11 +272,11 @@
     @Test
     public void testUsesUnexportedButProvidedService(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"),
-                "module m1 { provides p.C with p.C; }",
+        tb.writeJavaFiles(src.resolve("m1x"),
+                "module m1x { provides p.C with p.C; }",
                 "package p; public class C { }");
-        tb.writeJavaFiles(src.resolve("m2"),
-                "module m2 { requires m1; uses p.C; }");
+        tb.writeJavaFiles(src.resolve("m2x"),
+                "module m2x { requires m1x; uses p.C; }");
 
         List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "--module-source-path", src.toString())
@@ -286,7 +286,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.not.def.access.package.cant.access: p.C, p",
+        List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
                 "1 error");
         if (!output.containsAll(expected)) {
             throw new Exception("Expected output not found");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/TestOrigin.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,411 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8171355
+ * @summary Test behavior of javax.lang.model.util.Elements.getOrigin.
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.TestRunner
+ * @build TestOrigin
+ * @run main TestOrigin
+ */
+
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.*;
+import javax.lang.model.element.ModuleElement.Directive;
+import javax.lang.model.element.ModuleElement.ExportsDirective;
+import javax.lang.model.element.ModuleElement.OpensDirective;
+import javax.lang.model.element.ModuleElement.RequiresDirective;
+import javax.lang.model.util.Elements;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Attributes;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ClassWriter;
+import com.sun.tools.classfile.Module_attribute;
+import com.sun.tools.classfile.Module_attribute.ExportsEntry;
+import com.sun.tools.classfile.Module_attribute.OpensEntry;
+import com.sun.tools.classfile.Module_attribute.RequiresEntry;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class TestOrigin extends TestRunner {
+
+    private final ToolBox tb;
+
+    TestOrigin() {
+        super(System.err);
+        tb = new ToolBox();
+    }
+
+    public static void main(String... args) throws Exception {
+        new TestOrigin().runTests(m -> new Object[] { Paths.get(m.getName()) });
+    }
+
+    @Test
+    public void testGeneratedConstr(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package test; public class Test { private void test() { } }",
+                          "class Dummy {}");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log;
+        List<String> expected;
+
+        //from source:
+        log = new JavacTask(tb)
+            .options("-processor", ListMembersAP.class.getName())
+            .outdir(classes)
+            .files(tb.findJavaFiles(src))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.STDOUT);
+
+        expected = Arrays.asList(
+                "<init>:MANDATED",
+                "test:EXPLICIT");
+
+        if (!expected.equals(log))
+            throw new AssertionError("expected output not found: " + log);
+
+        //from class:
+        log = new JavacTask(tb)
+            .options("-classpath", classes.toString(),
+                     "-processorpath", System.getProperty("test.classes"),
+                     "-processor", ListMembersAP.class.getName())
+            .outdir(classes)
+            .files(src.resolve("Dummy.java"))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.STDOUT);
+
+        expected = Arrays.asList(
+                "<init>:EXPLICIT",
+                "test:EXPLICIT");
+
+        if (!expected.equals(log))
+            throw new AssertionError("expected output not found: " + log);
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class ListMembersAP extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (!roundEnv.processingOver())
+                return false;
+
+            Elements elements = processingEnv.getElementUtils();
+            TypeElement test = elements.getTypeElement("test.Test");
+            List<? extends Element> members = new ArrayList<>(test.getEnclosedElements());
+
+            Collections.sort(members,
+                             (e1, e2) -> e1.getSimpleName().toString().compareTo(e2.getSimpleName().toString()));
+
+            for (Element el : members) {
+                System.out.println(el.getSimpleName() + ":" + elements.getOrigin(el));
+            }
+
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latestSupported();
+        }
+
+    }
+
+    @Test
+    public void testRepeatableAnnotations(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package test; @A @A public class Test { }",
+                          "package test;" +
+                          "import java.lang.annotation.*;" +
+                          "@Repeatable(Container.class)" +
+                          "@Retention(RetentionPolicy.CLASS)" +
+                          "@interface A {}",
+                          "package test; @interface Container { A[] value(); }",
+                          "class Dummy {}");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log;
+        List<String> expected;
+
+        //from source:
+        log = new JavacTask(tb)
+            .options("-processor", ListAnnotationsAP.class.getName())
+            .outdir(classes)
+            .files(tb.findJavaFiles(src))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.STDOUT);
+
+        expected = Arrays.asList("test.Container:MANDATED");
+
+        if (!expected.equals(log))
+            throw new AssertionError("expected output not found: " + log);
+
+        //from class:
+        log = new JavacTask(tb)
+            .options("-classpath", classes.toString(),
+                     "-processorpath", System.getProperty("test.classes"),
+                     "-processor", ListAnnotationsAP.class.getName())
+            .outdir(classes)
+            .files(src.resolve("Dummy.java"))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.STDOUT);
+
+        expected = Arrays.asList("test.Container:EXPLICIT");
+
+        if (!expected.equals(log))
+            throw new AssertionError("expected output not found: " + log);
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class ListAnnotationsAP extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (!roundEnv.processingOver())
+                return false;
+
+            Elements elements = processingEnv.getElementUtils();
+            TypeElement test = elements.getTypeElement("test.Test");
+
+            for (AnnotationMirror am : test.getAnnotationMirrors()) {
+                System.out.println(am.getAnnotationType() + ":" + elements.getOrigin(test, am));
+            }
+
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latestSupported();
+        }
+
+    }
+
+    @Test
+    public void testModuleDirectives(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "module m {}",
+                          "package p1; class Test {}",
+                          "package p2; class Test {}",
+                          "package p3; class Test {}",
+                          "package test; class Dummy {}");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log;
+        List<String> expected;
+
+        //from source:
+        log = new JavacTask(tb)
+            .options("-processor", ListModuleAP.class.getName())
+            .outdir(classes)
+            .files(tb.findJavaFiles(src))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.STDOUT);
+
+        expected = Arrays.asList("REQUIRES:java.base:MANDATED");
+
+        if (!expected.equals(log))
+            throw new AssertionError("expected output not found: " + log);
+
+        tb.writeJavaFiles(src,
+                          "module m {" +
+                          "    requires java.base;" +
+                          "    requires java.compiler;" +
+                          "    requires jdk.compiler;" +
+                          "    exports p1;" +
+                          "    exports p2;" +
+                          "    exports p3;" +
+                          "    opens p1;" +
+                          "    opens p2;" +
+                          "    opens p3;" +
+                          "}");
+
+        new JavacTask(tb)
+            .outdir(classes)
+            .files(src.resolve("module-info.java"))
+            .run()
+            .writeAll();
+
+        Path moduleInfo = classes.resolve("module-info.class");
+        ClassFile cf = ClassFile.read(moduleInfo);
+        Module_attribute module = (Module_attribute) cf.getAttribute(Attribute.Module);
+
+        RequiresEntry[] newRequires = new RequiresEntry[3];
+        newRequires[0] = new RequiresEntry(module.requires[0].requires_index,
+                                           Module_attribute.ACC_MANDATED,
+                                           module.requires[0].requires_version_index);
+        newRequires[1] = new RequiresEntry(module.requires[1].requires_index,
+                                           Module_attribute.ACC_SYNTHETIC,
+                                           module.requires[1].requires_version_index);
+        newRequires[2] = module.requires[2];
+
+        ExportsEntry[] newExports = new ExportsEntry[3];
+        newExports[0] = new ExportsEntry(module.exports[0].exports_index,
+                                         Module_attribute.ACC_MANDATED,
+                                         module.exports[0].exports_to_index);
+        newExports[1] = new ExportsEntry(module.exports[1].exports_index,
+                                         Module_attribute.ACC_SYNTHETIC,
+                                         module.exports[1].exports_to_index);
+        newExports[2] = module.exports[2];
+
+        OpensEntry[] newOpens = new OpensEntry[3];
+        newOpens[0] = new OpensEntry(module.opens[0].opens_index,
+                                     Module_attribute.ACC_MANDATED,
+                                     module.opens[0].opens_to_index);
+        newOpens[1] = new OpensEntry(module.opens[1].opens_index,
+                                     Module_attribute.ACC_SYNTHETIC,
+                                     module.opens[1].opens_to_index);
+        newOpens[2] = module.opens[2];
+
+        Module_attribute newModule = new Module_attribute(module.attribute_name_index,
+                                                          module.module_name,
+                                                          module.module_flags,
+                                                          module.module_version_index,
+                                                          newRequires,
+                                                          newExports,
+                                                          newOpens,
+                                                          module.uses_index,
+                                                          module.provides);
+        Map<String, Attribute> newAttributesMap = new HashMap<>(cf.attributes.map);
+
+        newAttributesMap.put(Attribute.Module, newModule);
+
+        Attributes newAttributes = new Attributes(newAttributesMap);
+        ClassFile newClassFile = new ClassFile(cf.magic,
+                                               cf.minor_version,
+                                               cf.major_version,
+                                               cf.constant_pool,
+                                               cf.access_flags,
+                                               cf.this_class,
+                                               cf.super_class,
+                                               cf.interfaces,
+                                               cf.fields,
+                                               cf.methods,
+                                               newAttributes);
+
+        try (OutputStream out = Files.newOutputStream(moduleInfo)) {
+            new ClassWriter().write(newClassFile, out);
+        }
+
+        //from class:
+        log = new JavacTask(tb)
+            .options("-processor", ListModuleAP.class.getName())
+            .outdir(classes)
+            .files(src.resolve("test").resolve("Dummy.java"))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.STDOUT);
+
+        expected = Arrays.asList(
+                "REQUIRES:java.base:MANDATED",
+                "REQUIRES:java.compiler:SYNTHETIC",
+                "REQUIRES:jdk.compiler:EXPLICIT",
+                "EXPORTS:p1:MANDATED",
+                "EXPORTS:p2:SYNTHETIC",
+                "EXPORTS:p3:EXPLICIT",
+                "OPENS:p1:MANDATED",
+                "OPENS:p2:SYNTHETIC",
+                "OPENS:p3:EXPLICIT");
+
+        if (!expected.equals(log))
+            throw new AssertionError("expected output not found: " + log);
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class ListModuleAP extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (!roundEnv.processingOver())
+                return false;
+
+            Elements elements = processingEnv.getElementUtils();
+            ModuleElement m = elements.getModuleElement("m");
+
+            for (Directive d : m.getDirectives()) {
+                switch (d.getKind()) {
+                    case REQUIRES:
+                        RequiresDirective rd = (RequiresDirective) d;
+                        System.out.println(rd.getKind() + ":" +
+                                           rd.getDependency().getQualifiedName() + ":" +
+                                           elements.getOrigin(m, rd));
+                        break;
+                    case EXPORTS:
+                        ExportsDirective ed = (ExportsDirective) d;
+                        System.out.println(ed.getKind() + ":" +
+                                           ed.getPackage() + ":" +
+                                           elements.getOrigin(m, ed));
+                        break;
+                    case OPENS:
+                        OpensDirective od = (OpensDirective) d;
+                        System.out.println(od.getKind() + ":" +
+                                           od.getPackage() + ":" +
+                                           elements.getOrigin(m, od));
+                        break;
+                }
+            }
+
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latestSupported();
+        }
+
+    }
+
+}
--- a/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/Test.out	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/Test.out	Fri Dec 16 11:58:18 2016 -0800
@@ -1,4 +1,4 @@
-Processor Test matches [java.lang.Override] and returns true.
+Processor Test matches [java.base/java.lang.Override] and returns true.
 - compiler.note.proc.messager: round 1
 Processor Test matches [] and returns true.
 - compiler.note.proc.messager: round 2
--- a/langtools/test/tools/javac/profiles/ProfileOptionTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/javac/profiles/ProfileOptionTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -75,7 +75,7 @@
     void testInvalidProfile_API() throws Exception {
         JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
         String badName = "foo";
-        List<String> opts = Arrays.asList("-profile", badName);
+        List<String> opts = Arrays.asList("--release", "8", "-profile", badName);
         StringWriter sw = new StringWriter();
         try {
             JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
@@ -89,7 +89,7 @@
     @Test
     void testInvalidProfile_CommandLine() throws Exception {
         String badName = "foo";
-        String[] opts = { "-profile", badName };
+        String[] opts = { "--release", "8", "-profile", badName };
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
         int rc = com.sun.tools.javac.Main.compile(opts, pw);
@@ -144,10 +144,19 @@
 
                 switch (t) {
                     case JDK1_8:
-                    case JDK1_9:
                         if (ise != null)
                             error("unexpected exception from compiler: " + ise);
                         break;
+                    case JDK1_9:
+                        if (p == Profile.DEFAULT)
+                            break;
+                        if (ise == null)
+                            error("IllegalStateException not thrown as expected");
+                        else if (!ise.getMessage().contains("option -profile " +
+                                "not allowed with target " + t.name)) {
+                            error("exception not thrown as expected: " + ise);
+                        }
+                        break;
                     default:
                         if (p == Profile.DEFAULT)
                             break;
@@ -157,6 +166,7 @@
                                     + " is not valid for target release " + t.name)) {
                             error("exception not thrown as expected: " + ise);
                         }
+                        break;
                 }
             }
         }
@@ -171,7 +181,7 @@
                             new DiagnosticCollector<JavaFileObject>();
                     List<String> opts = (p == Profile.DEFAULT)
                             ? Collections.<String>emptyList()
-                            : Arrays.asList("-profile", p.name);
+                            : Arrays.asList("--release", "8", "-profile", p.name);
                     JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null,
                             Arrays.asList(fo));
                     task.analyze();
@@ -203,9 +213,12 @@
         init(Profile.COMPACT2,
                 javax.xml.XMLConstants.class);
 
+        //init(Profile.COMPACT3,
+        //        javax.sql.rowset.Predicate.class,
+        //        com.sun.security.auth.PolicyFile.class); // specifically included in 3
+
         init(Profile.COMPACT3,
-                javax.sql.rowset.Predicate.class,
-                com.sun.security.auth.PolicyFile.class); // specifically included in 3
+                javax.sql.rowset.Predicate.class);
 
         init(Profile.DEFAULT,
                 java.beans.BeanInfo.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javap/TestClassNameWarning.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,241 @@
+/*
+ * 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 8170708
+ * @summary javap -m <module> cannot read a module-info.class
+ * @library /tools/lib
+ * @modules
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ *      jdk.jdeps/com.sun.tools.classfile
+ *      jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.JavacTask toolbox.JavapTask toolbox.ToolBox toolbox.TestRunner
+ * @run main TestClassNameWarning
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ClassWriter;
+
+import toolbox.JavacTask;
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class TestClassNameWarning extends TestRunner {
+    public static void main(String... args) throws Exception {
+        new TestClassNameWarning().runTests(m -> new Object[] { Paths.get(m.getName()) });
+    }
+
+    private ToolBox tb = new ToolBox();
+
+    TestClassNameWarning() {
+        super(System.err);
+    }
+
+    /**
+     * Baseline test for normal classes.
+     */
+    @Test
+    public void testStandardClass(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        tb.writeJavaFiles(src, "class A { }");
+
+        new JavacTask(tb)
+                .outdir(classes.toString())
+                .files(tb.findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        List<String> log = new JavapTask(tb)
+                .classpath(classes.toString())
+                .classes("A")
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        checkOutput(log, false, "^(Warning|Error)");
+        checkOutput(log, true, "class A");
+    }
+
+    /**
+     * Test that module-info can be used to name the .class file
+     * for a module declaration (i.e. ACC_MODULE, this_class == 0)
+     * This is the primary test case for the bug as reported.
+     */
+    @Test
+    public void testStandardModuleInfo(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        tb.writeJavaFiles(src, "module m { }");
+
+        new JavacTask(tb)
+                .outdir(classes.toString())
+                .files(tb.findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        List<String> log = new JavapTask(tb)
+                .options("--module-path", classes.toString(),
+                        "--module", "m")
+                .classes("module-info")
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        checkOutput(log, false, "^(Warning|Error)");
+        checkOutput(log, true, "module m");
+    }
+
+    /**
+     * Test module-info can still be used to find a weirdly named
+     * class equivalent to "class module-info { }" if that were legal in JLS.
+     * Such a class file would arguably be legal in certain selected contexts.
+     */
+    @Test
+    public void testLegacyModuleInfo(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        tb.writeJavaFiles(src, "class module_info { }");
+
+        new JavacTask(tb)
+                .outdir(classes.toString())
+                .files(tb.findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        byte[] bytes = Files.readAllBytes(classes.resolve("module_info.class"));
+        byte[] searchBytes = "module_info".getBytes("UTF-8");
+        byte[] replaceBytes = "module-info".getBytes("UTF-8");
+        for (int i = 0; i < bytes.length - searchBytes.length; i++) {
+            if (Arrays.equals(bytes, i, i + searchBytes.length,
+                                searchBytes, 0, searchBytes.length)) {
+                System.arraycopy(replaceBytes, 0, bytes, i, replaceBytes.length);
+            }
+        }
+        Files.write(classes.resolve("module-info.class"), bytes);
+
+        List<String> log = new JavapTask(tb)
+                .classpath(classes.toString())
+                .options("-bootclasspath", "") // hide all system classes
+                .classes("module-info")
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        checkOutput(log, false, "^(Warning|Error)");
+        checkOutput(log, true, "class module-info");
+    }
+
+    /**
+     * Test an invalid class, with this_class == 0.
+     */
+    @Test
+    public void testNoNameClass(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        tb.writeJavaFiles(src, "class A { }");
+
+        new JavacTask(tb)
+                .outdir(classes.toString())
+                .files(tb.findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        ClassFile cf = ClassFile.read(classes.resolve("A.class"));
+        ClassFile cf2 = new ClassFile(
+                cf.magic, cf.minor_version, cf.major_version, cf.constant_pool,
+                cf.access_flags,
+                0, // this_class,
+                cf.super_class, cf.interfaces, cf.fields, cf.methods, cf.attributes);
+        new ClassWriter().write(cf2, Files.newOutputStream(classes.resolve("Z.class")));
+
+        List<String> log = new JavapTask(tb)
+                .classpath(classes.toString())
+                .classes("Z")
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        checkOutput(log, true, "Warning:.*Z.class does not contain class Z");
+    }
+
+    /**
+     * Test a class with unexpected contents.
+     * This is the arguably the most common negative case.
+     */
+    @Test
+    public void testWrongNameClass(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        tb.writeJavaFiles(src, "class A { }");
+
+        new JavacTask(tb)
+                .outdir(classes.toString())
+                .files(tb.findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        Files.move(classes.resolve("A.class"), classes.resolve("B.class"));
+
+        List<String> log = new JavapTask(tb)
+                .classpath(classes.toString())
+                .classes("B")
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        checkOutput(log, true, "Warning:.*B.class does not contain class B");
+    }
+
+    /**
+     * Check that the output does, or does not, contain lines matching a regex.
+     */
+    private void checkOutput(List<String> log, boolean expect, String regex) {
+        Pattern p = Pattern.compile(regex);
+        List<String> matches = log.stream()
+                .filter(line -> p.matcher(line).find())
+                .collect(Collectors.toList());
+        if (expect) {
+            if (matches.isEmpty()) {
+                error("expected output not found: " + regex);
+            }
+        } else {
+            if (!matches.isEmpty()) {
+                error("unexpected output found: " + matches);
+            }
+        }
+    }
+}
+
--- a/langtools/test/tools/jdeps/modules/CheckModuleTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/jdeps/modules/CheckModuleTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -52,9 +52,9 @@
     private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
     private static final Path MODS_DIR = Paths.get("mods");
 
-    // m4 and m5 are analyzed.  Others are compiled to make sure they are present
+    // mIV and mV are analyzed.  Others are compiled to make sure they are present
     // on the module path for analysis
-    private static final Set<String> modules = Set.of("unsafe", "m4", "m5", "mVI", "mVII", "m8");
+    private static final Set<String> modules = Set.of("unsafe", "mIV", "mV", "mVI", "mVII", "mVIII");
 
     private static final String JAVA_BASE = "java.base";
 
@@ -97,39 +97,39 @@
     @DataProvider(name = "modules")
     public Object[][] unnamed() {
         return new Object[][]{
-            { "m4", new ModuleMetaData[] {
+            { "mIV", new ModuleMetaData[] {
                         // original
-                        new ModuleMetaData("m4")
+                        new ModuleMetaData("mIV")
                             .requiresTransitive("java.compiler")
                             .requires("java.logging")
                             // unnused exports
                             .exports("p4.internal", Set.of("mVI", "mVII")),
                         // suggested version
-                        new ModuleMetaData("m4")
+                        new ModuleMetaData("mIV")
                             .requires("java.compiler"),
                         // reduced version
-                        new ModuleMetaData("m4")
+                        new ModuleMetaData("mIV")
                             .requires("java.compiler")
                     }
             },
-            { "m5", new ModuleMetaData[] {
+            { "mV", new ModuleMetaData[] {
                         // original
-                        new ModuleMetaData("m5")
+                        new ModuleMetaData("mV")
                             .requiresTransitive("java.compiler")
                             .requiresTransitive("java.logging")
                             .requires("java.sql")
-                            .requiresTransitive("m4"),
+                            .requiresTransitive("mIV"),
                         // suggested version
-                        new ModuleMetaData("m5")
+                        new ModuleMetaData("mV")
                             .requiresTransitive("java.compiler")
                             .requires("java.logging")
                             .requiresTransitive("java.sql")
-                            .requiresTransitive("m4"),
+                            .requiresTransitive("mIV"),
                         // reduced version
-                        new ModuleMetaData("m5")
+                        new ModuleMetaData("mV")
                             .requiresTransitive("java.compiler")
                             .requiresTransitive("java.sql")
-                            .requiresTransitive("m4"),
+                            .requiresTransitive("mIV"),
                     }
             },
         };
--- a/langtools/test/tools/jdeps/modules/InverseDeps.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/jdeps/modules/InverseDeps.java	Fri Dec 16 11:58:18 2016 -0800
@@ -61,7 +61,7 @@
     private static final Path LIBS_DIR = Paths.get("libs");
 
     private static final Set<String> modules = new LinkedHashSet(
-        List.of("unsafe", "m4", "m5", "mVI", "mVII")
+        List.of("unsafe", "mIV", "mV", "mVI", "mVII")
     );
 
     /**
@@ -93,18 +93,18 @@
         return new Object[][] {
             // --require and result
             { "java.sql", new String[][] {
-                    new String[] { "java.sql", "m5" },
+                    new String[] { "java.sql", "mV" },
                 }
             },
             { "java.compiler", new String[][] {
-                    new String[] { "java.compiler", "m5" },
-                    new String[] { "java.compiler", "m4", "m5" },
+                    new String[] { "java.compiler", "mV" },
+                    new String[] { "java.compiler", "mIV", "mV" },
                 }
             },
             { "java.logging", new String[][]{
-                    new String[] {"java.logging", "m5"},
-                    new String[] {"java.logging", "m4", "m5"},
-                    new String[] {"java.logging", "java.sql", "m5"},
+                    new String[] {"java.logging", "mV"},
+                    new String[] {"java.logging", "mIV", "mV"},
+                    new String[] {"java.logging", "java.sql", "mV"},
                 }
             },
             { "jdk.unsupported", new String[][] {
@@ -146,12 +146,12 @@
         return new Object[][] {
             // -package and result
             { "p4", new String[][] {
-                        new String[] { "m4", "m5"},
+                        new String[] { "mIV", "mV"},
                     }
             },
             { "javax.tools", new String[][] {
-                        new String[] {"java.compiler", "m5"},
-                        new String[] {"java.compiler", "m4", "m5"},
+                        new String[] {"java.compiler", "mV"},
+                        new String[] {"java.compiler", "mIV", "mV"},
                     }
             },
             { "sun.misc", new String[][] {
@@ -187,7 +187,7 @@
             { "java.util.logging.*|org.safe.Lib", new String[][] {
                     new String[] { "unsafe", "mVII"},
                     new String[] { "unsafe", "mVI", "mVII"},
-                    new String[] { "java.logging", "m5"},
+                    new String[] { "java.logging", "mV"},
                 }
             }
         };
@@ -224,7 +224,7 @@
             { "java.util.logging.*|org.safe.Lib", new String[][] {
                     new String[] { "unsafe.jar", "mVII.jar"},
                     new String[] { "unsafe.jar", "mVI.jar", "mVII.jar"},
-                    new String[] { "java.logging", "m5.jar"},
+                    new String[] { "java.logging", "mV.jar"},
                 }
             }
         };
--- a/langtools/test/tools/jdeps/modules/ModuleTest.java	Mon Dec 12 20:54:41 2016 -0800
+++ b/langtools/test/tools/jdeps/modules/ModuleTest.java	Fri Dec 16 11:58:18 2016 -0800
@@ -58,7 +58,7 @@
 
     // the names of the modules in this test
     private static final String UNSUPPORTED = "unsupported";
-    private static String[] modules = new String[] {"mI", "mII", "mIII", "m4", UNSUPPORTED};
+    private static String[] modules = new String[] {"mI", "mII", "mIII", "mIV", UNSUPPORTED};
     /**
      * Compiles all modules used by the test
      */
@@ -70,7 +70,7 @@
         assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, UNSUPPORTED,
                                                "--add-exports", "java.base/jdk.internal.perf=" + UNSUPPORTED));
         // m4 is not referenced
-        Arrays.asList("mI", "mII", "mIII", "m4")
+        Arrays.asList("mI", "mII", "mIII", "mIV")
               .forEach(mn -> assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn)));
 
         assertTrue(CompilerUtils.compile(SRC_DIR.resolve("mIII"), UNNAMED_DIR, "-p", MODS_DIR.toString()));
--- a/langtools/test/tools/jdeps/modules/src/m4/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-module m4 {
-    // not used in signature
-    requires transitive java.compiler;
-
-    // unused dependence
-    requires java.logging;
-
-    exports p4;
-
-    // unuused qualified exports
-    exports p4.internal to mVI,mVII;
-}
--- a/langtools/test/tools/jdeps/modules/src/m4/p4/Lib.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-package p4;
-
-public class Lib {
-    public static boolean isPresent() {
-        return true;
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m4/p4/internal/Impl.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package p4.internal;
-
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
-
-public class Impl {
-    private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-
-    public String name() {
-        return Impl.class.getName();
-    }
-
-}
--- a/langtools/test/tools/jdeps/modules/src/m5/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-module m5 {
-    // m4 requires transitive java.compiler
-    requires transitive m4;
-    requires transitive java.compiler;
-
-    // java.sql should be requires transitive
-    requires java.sql;
-
-    // java.logging is used for implementation only
-    requires transitive java.logging;
-
-    exports p5;
-
-    // m8 is not in the resolved graph but used by m8
-    exports p5.internal to m8;
-}
--- a/langtools/test/tools/jdeps/modules/src/m5/p5/Main.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-
-package p5;
-
-import java.sql.Driver;
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
-
-public class Main {
-    public void run(Driver driver) throws Exception {
-        driver.getParentLogger().config("test");
-
-    }
-
-    public p4.Lib getLib() {
-        return new p4.Lib();
-    }
-
-    public JavaCompiler getCompiler() {
-        return ToolProvider.getSystemJavaCompiler();
-    }
-
-}
--- a/langtools/test/tools/jdeps/modules/src/m5/p5/internal/T.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package p5.internal;
-
-public class T {
-}
--- a/langtools/test/tools/jdeps/modules/src/m8/module-info.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-module m8 {
-    requires m5;
-
-    // use p5.internal
-}
--- a/langtools/test/tools/jdeps/modules/src/m8/p8/Main.java	Mon Dec 12 20:54:41 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-package p8;
-
-import p5.internal.T;
-
-public class Main {
-    public static void main() {
-        T t = new T();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mIV/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+module mIV {
+    // not used in signature
+    requires transitive java.compiler;
+
+    // unused dependence
+    requires java.logging;
+
+    exports p4;
+
+    // unuused qualified exports
+    exports p4.internal to mVI,mVII;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mIV/p4/Lib.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+package p4;
+
+public class Lib {
+    public static boolean isPresent() {
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mIV/p4/internal/Impl.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package p4.internal;
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+public class Impl {
+    private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+
+    public String name() {
+        return Impl.class.getName();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mV/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+module mV {
+    // mIV requires transitive java.compiler
+    requires transitive mIV;
+    requires transitive java.compiler;
+
+    // java.sql should be requires transitive
+    requires java.sql;
+
+    // java.logging is used for implementation only
+    requires transitive java.logging;
+
+    exports p5;
+
+    // m8 is not in the resolved graph but used by mVIII
+    exports p5.internal to mVIII;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mV/p5/Main.java	Fri Dec 16 11:58:18 2016 -0800
@@ -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.
+ */
+
+package p5;
+
+import java.sql.Driver;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+public class Main {
+    public void run(Driver driver) throws Exception {
+        driver.getParentLogger().config("test");
+
+    }
+
+    public p4.Lib getLib() {
+        return new p4.Lib();
+    }
+
+    public JavaCompiler getCompiler() {
+        return ToolProvider.getSystemJavaCompiler();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mV/p5/internal/T.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package p5.internal;
+
+public class T {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mVIII/module-info.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+module mVIII {
+    requires mV;
+
+    // use p5.internal
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mVIII/p8/Main.java	Fri Dec 16 11:58:18 2016 -0800
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package p8;
+
+import p5.internal.T;
+
+public class Main {
+    public static void main() {
+        T t = new T();
+    }
+}