8169069: Module system implementation refresh (11/2016)
authoralanb
Thu, 01 Dec 2016 09:02:42 +0000
changeset 42407 f3702cff2933
parent 42257 43104fb390fd
child 42408 d6f09ae68eab
8169069: Module system implementation refresh (11/2016) Reviewed-by: mcimadamore, jjg, mchung, anazarov Contributed-by: jonathan.gibbons@oracle.com, jan.lahoda@oracle.com, alan.bateman@oracle.com, mandy.chung@oracle.com, bhavesh.x.patel@oracle.com, andrey.x.nazarov@oracle.com
langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java
langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ExportsTree.java
langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ModuleTree.java
langtools/src/jdk.compiler/share/classes/com/sun/source/tree/OpensTree.java
langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ProvidesTree.java
langtools/src/jdk.compiler/share/classes/com/sun/source/tree/RequiresTree.java
langtools/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java
langtools/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java
langtools/src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java
langtools/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ModuleNameReader.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeScanner.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java
langtools/src/jdk.compiler/share/classes/module-info.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties
langtools/src/jdk.javadoc/share/classes/module-info.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConcealedPackages_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Hashes_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/MainClass_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleHashes_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleMainClass_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModulePackages_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleVersion_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TargetPlatform_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Version_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleGraphBuilder.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties
langtools/src/jdk.jdeps/share/classes/module-info.java
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties
langtools/src/jdk.jshell/share/classes/module-info.java
langtools/test/TEST.ROOT
langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
langtools/test/jdk/javadoc/doclet/testModules/module1/module-info.java
langtools/test/jdk/javadoc/doclet/testModules/module2/module-info.java
langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationType.java
langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationTypeUndocumented.java
langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java
langtools/test/jdk/javadoc/tool/modules/Modules.java
langtools/test/jdk/jshell/CompletionSuggestionTest.java
langtools/test/jdk/jshell/ComputeFQNsTest.java
langtools/test/jdk/jshell/HistoryTest.java
langtools/test/jdk/jshell/JavadocTest.java
langtools/test/jdk/jshell/PipeInputStreamTest.java
langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java
langtools/test/tools/javac/6304921/TestLog.java
langtools/test/tools/javac/6410653/T6410653.java
langtools/test/tools/javac/MethodParameters/AnnotationTest.java
langtools/test/tools/javac/MethodParameters/AnonymousClass.java
langtools/test/tools/javac/MethodParameters/AttributeVisitor.java
langtools/test/tools/javac/MethodParameters/Constructors.java
langtools/test/tools/javac/MethodParameters/EnumTest.java
langtools/test/tools/javac/MethodParameters/InstanceMethods.java
langtools/test/tools/javac/MethodParameters/LambdaTest.java
langtools/test/tools/javac/MethodParameters/LocalClassTest.java
langtools/test/tools/javac/MethodParameters/MemberClassTest.java
langtools/test/tools/javac/MethodParameters/StaticMethods.java
langtools/test/tools/javac/MethodParameters/UncommonParamNames.java
langtools/test/tools/javac/T6435291/T6435291.java
langtools/test/tools/javac/api/6400303/T6400303.java
langtools/test/tools/javac/api/TestResolveIdent.java
langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java
langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java
langtools/test/tools/javac/defaultMethods/BadClassfile.java
langtools/test/tools/javac/diags/examples.not-yet.txt
langtools/test/tools/javac/diags/examples/AddOpensIgnored.java
langtools/test/tools/javac/diags/examples/ConflictingExports/exported/Class.java
langtools/test/tools/javac/diags/examples/ConflictingExports/module-info.java
langtools/test/tools/javac/diags/examples/ConflictingExportsToModule/exported/Class.java
langtools/test/tools/javac/diags/examples/ConflictingExportsToModule/module-info.java
langtools/test/tools/javac/diags/examples/ConflictingOpens/exported/Class.java
langtools/test/tools/javac/diags/examples/ConflictingOpens/module-info.java
langtools/test/tools/javac/diags/examples/ConflictingOpensToModule/module-info.java
langtools/test/tools/javac/diags/examples/ConflictingOpensToModule/opened/Class.java
langtools/test/tools/javac/diags/examples/DuplicateExports/exported/Class.java
langtools/test/tools/javac/diags/examples/DuplicateExports/module-info.java
langtools/test/tools/javac/diags/examples/ExpectedModule.java
langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/HasBeenDeprecatedModule.java
langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m1/module-info.java
langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m2/module-info.java
langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/HasBeenDeprecatedRemovalModule.java
langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m1/module-info.java
langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m2/module-info.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/LeaksNotAccessibleNotRequiredPublic.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m1/api1/Api1.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m1/module-info.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m2/api2/Api2.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m2/module-info.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/LeaksNotAccessibleNotRequiredTransitive.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/api1/Api1.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/module-info.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/api2/Api2.java
langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/module-info.java
langtools/test/tools/javac/diags/examples/NoOpensUnlessStrong/exported/Class.java
langtools/test/tools/javac/diags/examples/NoOpensUnlessStrong/module-info.java
langtools/test/tools/javac/diags/examples/NoPkgInModuleInfoJava/module-info.java
langtools/test/tools/javac/diags/examples/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf.java
langtools/test/tools/javac/diags/examples/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf/modulesourcepath/m/impl/Impl.java
langtools/test/tools/javac/diags/examples/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf/modulesourcepath/m/module-info.java
langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java
langtools/test/tools/javac/modules/AnnotationProcessing.java
langtools/test/tools/javac/modules/AnnotationsOnModules.java
langtools/test/tools/javac/modules/AutomaticModules.java
langtools/test/tools/javac/modules/EdgeCases.java
langtools/test/tools/javac/modules/ExportsUnexported.java
langtools/test/tools/javac/modules/GraphsTest.java
langtools/test/tools/javac/modules/InvalidModuleDirective/module-info.java
langtools/test/tools/javac/modules/ModuleInfoTest.java
langtools/test/tools/javac/modules/ModuleInfoTreeAccess.java
langtools/test/tools/javac/modules/ModulePathTest.java
langtools/test/tools/javac/modules/OpenModulesTest.java
langtools/test/tools/javac/modules/PatchModulesTest.java
langtools/test/tools/javac/modules/ProvidesTest.java
langtools/test/tools/javac/modules/RepeatedUsesAndProvidesTest.java
langtools/test/tools/javac/modules/ReportNonExistentPackageTest.java
langtools/test/tools/javac/modules/RequiresPublicTest.java
langtools/test/tools/javac/modules/RequiresStaticTest.java
langtools/test/tools/javac/modules/RequiresTransitiveTest.java
langtools/test/tools/javac/modules/T8158224/Processor.java
langtools/test/tools/javac/modules/T8168854/pack1/Outer.java
langtools/test/tools/javac/modules/T8168854/pack1/Outer1.java
langtools/test/tools/javac/options/release/ReleaseOptionClashes.java
langtools/test/tools/javac/parser/JavacParserTest.java
langtools/test/tools/javac/platform/PlatformProviderTest.java
langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java
langtools/test/tools/javac/processing/model/TestSymtabItems.java
langtools/test/tools/javac/scope/DupUnsharedTest.java
langtools/test/tools/javac/scope/HashCollisionTest.java
langtools/test/tools/javac/scope/IterateAndRemove.java
langtools/test/tools/javac/tree/SourceTreeScannerTest.java
langtools/test/tools/javac/tree/TreeKindTest.java
langtools/test/tools/javac/types/ScopeListenerTest.java
langtools/test/tools/javap/4870651/T4870651.java
langtools/test/tools/javap/MethodParameters.java
langtools/test/tools/javap/T4975569.java
langtools/test/tools/jdeps/lib/ModuleMetaData.java
langtools/test/tools/jdeps/modules/CheckModuleTest.java
langtools/test/tools/jdeps/modules/GenModuleInfo.java
langtools/test/tools/jdeps/modules/GenOpenModule.java
langtools/test/tools/jdeps/modules/InverseDeps.java
langtools/test/tools/jdeps/modules/ModuleTest.java
langtools/test/tools/jdeps/modules/TransitiveDeps.java
langtools/test/tools/jdeps/modules/src/m1/module-info.java
langtools/test/tools/jdeps/modules/src/m1/p1/Goo.java
langtools/test/tools/jdeps/modules/src/m1/p1/Lib.java
langtools/test/tools/jdeps/modules/src/m1/p1/S.java
langtools/test/tools/jdeps/modules/src/m1/p1/internal/Impl.java
langtools/test/tools/jdeps/modules/src/m2/module-info.java
langtools/test/tools/jdeps/modules/src/m2/p2/Bar.java
langtools/test/tools/jdeps/modules/src/m2/p2/internal/T2.java
langtools/test/tools/jdeps/modules/src/m3/module-info.java
langtools/test/tools/jdeps/modules/src/m3/p3/Foo.java
langtools/test/tools/jdeps/modules/src/m3/p3/Main.java
langtools/test/tools/jdeps/modules/src/m4/module-info.java
langtools/test/tools/jdeps/modules/src/m5/module-info.java
langtools/test/tools/jdeps/modules/src/m6/module-info.java
langtools/test/tools/jdeps/modules/src/m6/p6/indirect/UnsafeRef.java
langtools/test/tools/jdeps/modules/src/m6/p6/safe/Lib.java
langtools/test/tools/jdeps/modules/src/m7/module-info.java
langtools/test/tools/jdeps/modules/src/m7/p7/Main.java
langtools/test/tools/jdeps/modules/src/mI/module-info.java
langtools/test/tools/jdeps/modules/src/mI/p1/Goo.java
langtools/test/tools/jdeps/modules/src/mI/p1/Lib.java
langtools/test/tools/jdeps/modules/src/mI/p1/S.java
langtools/test/tools/jdeps/modules/src/mI/p1/internal/Impl.java
langtools/test/tools/jdeps/modules/src/mII/module-info.java
langtools/test/tools/jdeps/modules/src/mII/p2/Bar.java
langtools/test/tools/jdeps/modules/src/mII/p2/internal/T2.java
langtools/test/tools/jdeps/modules/src/mIII/module-info.java
langtools/test/tools/jdeps/modules/src/mIII/p3/Foo.java
langtools/test/tools/jdeps/modules/src/mIII/p3/Main.java
langtools/test/tools/jdeps/modules/src/mVI/module-info.java
langtools/test/tools/jdeps/modules/src/mVI/p6/indirect/UnsafeRef.java
langtools/test/tools/jdeps/modules/src/mVI/p6/safe/Lib.java
langtools/test/tools/jdeps/modules/src/mVII/module-info.java
langtools/test/tools/jdeps/modules/src/mVII/p7/Main.java
langtools/test/tools/jdeps/modules/src/provider/META-INF/services/java.util.spi.ToolProvider
langtools/test/tools/jdeps/modules/src/provider/META-INF/services/p.Service$I$J
langtools/test/tools/jdeps/modules/src/provider/module-info.java
langtools/test/tools/jdeps/modules/src/provider/p/Provider.java
langtools/test/tools/jdeps/modules/src/provider/p/Service.java
langtools/test/tools/jdeps/modules/src/provider/q/ProviderImpl1.java
langtools/test/tools/jdeps/modules/src/provider/q/ProviderImpl2.java
langtools/test/tools/jdeps/modules/src/provider/q/ProviderImpl3.java
langtools/test/tools/lib/toolbox/ModuleBuilder.java
langtools/test/tools/sjavac/Serialization.java
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java	Thu Dec 01 09:02:42 2016 +0000
@@ -96,10 +96,12 @@
      * @since 9
      */
     enum DirectiveKind {
-        /** A "requires [public] module-name" directive. */
+        /** A "requires (static|transitive)* module-name" directive. */
         REQUIRES,
         /** An "exports package-name [to module-name-list]" directive. */
         EXPORTS,
+        /** An "opens package-name [to module-name-list]" directive. */
+        OPENS,
         /** A "uses service-name" directive. */
         USES,
         /** A "provides service-name with implementation-name" directive. */
@@ -127,10 +129,16 @@
      */
     interface RequiresDirective extends Directive {
         /**
-         * Returns whether or not this is a public dependency.
-         * @return whether or not this is a public dependency
+         * Returns whether or not this is a static dependency.
+         * @return whether or not this is a static dependency
          */
-        boolean isPublic();
+        boolean isStatic();
+
+        /**
+         * Returns whether or not this is a transitive dependency.
+         * @return whether or not this is a transitive dependency
+         */
+        boolean isTransitive();
 
         /**
          * Returns the module that is required
@@ -144,6 +152,7 @@
      * @since 9
      */
     interface ExportsDirective extends Directive {
+
         /**
          * Returns the package being exported.
          * @return the package being exported
@@ -160,6 +169,27 @@
     }
 
     /**
+     * An opened package of a module.
+     * @since 9
+     */
+    interface OpensDirective extends Directive {
+
+        /**
+         * Returns the package being opened.
+         * @return the package being opened
+         */
+        PackageElement getPackage();
+
+        /**
+         * Returns the specific modules to which the package is being open
+         * or null, if the package is open all modules which
+         * have readability to this module.
+         * @return the specific modules to which the package is being opened
+         */
+        List<? extends ModuleElement> getTargetModules();
+    }
+
+    /**
      * An implementation of a service provided by a module.
      * @since 9
      */
@@ -171,10 +201,10 @@
         TypeElement getService();
 
         /**
-         * Returns the implementation of the service being provided.
-         * @return the implementation of the service being provided
+         * Returns the implementations of the service being provided.
+         * @return the implementations of the service being provided
          */
-        TypeElement getImplementation();
+        List<? extends TypeElement> getImplementations();
     }
 
     /**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ExportsTree.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ExportsTree.java	Thu Dec 01 09:02:42 2016 +0000
@@ -39,11 +39,12 @@
  * @since 9
  */
 public interface ExportsTree extends DirectiveTree {
+
     /**
      * Returns the name of the package to be exported.
      * @return  the name of the package to be exported
      */
-    ExpressionTree getExportName();
+    ExpressionTree getPackageName();
 
     /**
      * Returns the names of the modules to which the package is exported,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ModuleTree.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ModuleTree.java	Thu Dec 01 09:02:42 2016 +0000
@@ -33,7 +33,8 @@
  *
  * For example:
  * <pre>
- *    module <em>module-name</em> {
+ *    <em>annotations</em>
+ *    [open] module <em>module-name</em> {
  *        <em>directives</em>
  *    }
  * </pre>
@@ -42,6 +43,18 @@
  */
 public interface ModuleTree extends Tree {
     /**
+     * Returns the annotations associated with this module declaration.
+     * @return the annotations
+     */
+    List<? extends AnnotationTree> getAnnotations();
+
+    /**
+     * Returns the type of this module.
+     * @return the type of this module
+     */
+    ModuleKind getModuleType();
+
+    /**
      * Returns the name of the module.
      * @return the name of the module
      */
@@ -52,4 +65,19 @@
      * @return the directives in the module declaration
      */
     List<? extends DirectiveTree> getDirectives();
+
+    /**
+     * The kind of the module.
+     */
+    enum ModuleKind {
+        /**
+         * Open module.
+         */
+        OPEN,
+        /**
+         * Strong module.
+         */
+        STRONG;
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/OpensTree.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2009, 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.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for an 'opens' directive in a module declaration.
+ *
+ * For example:
+ * <pre>
+ *    opens   <em>package-name</em>;
+ *    opens   <em>package-name</em> to <em>module-name</em>;
+ * </pre>
+ *
+ * @since 9
+ */
+public interface OpensTree extends DirectiveTree {
+
+    /**
+     * Returns the name of the package to be opened.
+     * @return  the name of the package to be opened
+     */
+    ExpressionTree getPackageName();
+
+    /**
+     * Returns the names of the modules to which the package is opened,
+     * or null, if the package is opened to all modules.
+     *
+     * @return the names of the modules to which the package is opened, or null
+     */
+    List<? extends ExpressionTree> getModuleNames();
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ProvidesTree.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/ProvidesTree.java	Thu Dec 01 09:02:42 2016 +0000
@@ -25,6 +25,8 @@
 
 package com.sun.source.tree;
 
+import java.util.List;
+
 /**
  * A tree node for a 'provides' directive in a module declaration.
  *
@@ -43,8 +45,8 @@
     ExpressionTree getServiceName();
 
     /**
-     * Returns the name of the implementation type being provided.
-     * @return the name of the implementation type being provided
+     * Returns the names of the implementation types being provided.
+     * @return the names of the implementation types being provided
      */
-    ExpressionTree getImplementationName();
+    List<? extends ExpressionTree> getImplementationNames();
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/RequiresTree.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/RequiresTree.java	Thu Dec 01 09:02:42 2016 +0000
@@ -31,17 +31,24 @@
  * For example:
  * <pre>
  *    requires <em>module-name</em>;
- *    requires public <em>module-name</em>;
+ *    requires static <em>module-name</em>;
+ *    requires transitive <em>module-name</em>;
  * </pre>
  *
  * @since 9
  */
 public interface RequiresTree extends DirectiveTree {
     /**
-     * Returns true if this is a "requires public" directive.
-     * @return true if this is a "requires public" directive
+     * Returns true if this is a "requires static" directive.
+     * @return true if this is a "requires static" directive
      */
-    boolean isPublic();
+    boolean isStatic();
+
+    /**
+     * Returns true if this is a "requires transitive" directive.
+     * @return true if this is a "requires transitive" directive
+     */
+    boolean isTransitive();
 
     /**
      * Returns the name of the module that is required.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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
@@ -610,25 +610,31 @@
 
         /**
          * Used for instances of {@link ExportsTree} representing
-         * export directives in a module declaration.
+         * exports directives in a module declaration.
          */
         EXPORTS(ExportsTree.class),
 
         /**
+         * Used for instances of {@link ExportsTree} representing
+         * opens directives in a module declaration.
+         */
+        OPENS(OpensTree.class),
+
+        /**
          * Used for instances of {@link ProvidesTree} representing
-         * export directives in a module declaration.
+         * provides directives in a module declaration.
          */
         PROVIDES(ProvidesTree.class),
 
         /**
          * Used for instances of {@link RequiresTree} representing
-         * export directives in a module declaration.
+         * requires directives in a module declaration.
          */
         REQUIRES(RequiresTree.class),
 
         /**
          * Used for instances of {@link UsesTree} representing
-         * export directives in a module declaration.
+         * uses directives in a module declaration.
          */
         USES(UsesTree.class),
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java	Thu Dec 01 09:02:42 2016 +0000
@@ -498,6 +498,14 @@
     R visitExports(ExportsTree node, P p);
 
     /**
+     * Visits an OpensTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
+    R visitOpens(OpensTree node, P p);
+
+    /**
      * Visits a ProvidesTree node.
      * @param node the node being visited
      * @param p a parameter value
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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
@@ -729,6 +729,11 @@
     }
 
     @Override
+    public R visitOpens(OpensTree node, P p) {
+        return defaultAction(node, p);
+    }
+
+    @Override
     public R visitProvides(ProvidesTree node, P p) {
         return defaultAction(node, p);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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
@@ -846,28 +846,41 @@
         return r;
     }
 
+    @Override
     public R visitModule(ModuleTree node, P p) {
-        R r = scan(node.getName(), p);
+        R r = scan(node.getAnnotations(), p);
+        r = scanAndReduce(node.getName(), p, r);
         r = scanAndReduce(node.getDirectives(), p, r);
         return r;
     }
 
+    @Override
     public R visitExports(ExportsTree node, P p) {
-        R r = scan(node.getExportName(), p);
+        R r = scan(node.getPackageName(), p);
+        r = scanAndReduce(node.getModuleNames(), p, r);
+        return r;
+    }
+
+    @Override
+    public R visitOpens(OpensTree node, P p) {
+        R r = scan(node.getPackageName(), p);
         r = scanAndReduce(node.getModuleNames(), p, r);
         return r;
     }
 
+    @Override
     public R visitProvides(ProvidesTree node, P p) {
         R r = scan(node.getServiceName(), p);
-        r = scanAndReduce(node.getImplementationName(), p, r);
+        r = scanAndReduce(node.getImplementationNames(), p, r);
         return r;
     }
 
+    @Override
     public R visitRequires(RequiresTree node, P p) {
         return scan(node.getModuleName(), p);
     }
 
+    @Override
     public R visitUses(UsesTree node, P p) {
         return scan(node.getServiceName(), p);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Thu Dec 01 09:02:42 2016 +0000
@@ -29,13 +29,16 @@
 import java.nio.file.Path;
 import java.util.EnumSet;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Set;
 
 import javax.lang.model.SourceVersion;
 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;
 
@@ -558,17 +561,17 @@
 
         if (wantClassFiles && (classLocn != null)) {
             fillIn(p, classLocn,
-                   fileManager.list(classLocn,
-                                    packageName,
-                                    classKinds,
-                                    false));
+                   list(classLocn,
+                        p,
+                        packageName,
+                        classKinds));
         }
         if (wantSourceFiles && (sourceLocn != null)) {
             fillIn(p, sourceLocn,
-                   fileManager.list(sourceLocn,
-                                    packageName,
-                                    sourceKinds,
-                                    false));
+                   list(sourceLocn,
+                        p,
+                        packageName,
+                        sourceKinds));
         }
     }
 
@@ -620,23 +623,23 @@
         String packageName = p.fullname.toString();
         if (wantSourceFiles && !haveSourcePath) {
             fillIn(p, CLASS_PATH,
-                   fileManager.list(CLASS_PATH,
-                                    packageName,
-                                    kinds,
-                                    false));
+                   list(CLASS_PATH,
+                        p,
+                        packageName,
+                        kinds));
         } else {
             if (wantClassFiles)
                 fillIn(p, CLASS_PATH,
-                       fileManager.list(CLASS_PATH,
-                                        packageName,
-                                        classKinds,
-                                        false));
+                       list(CLASS_PATH,
+                            p,
+                            packageName,
+                            classKinds));
             if (wantSourceFiles)
                 fillIn(p, SOURCE_PATH,
-                       fileManager.list(SOURCE_PATH,
-                                        packageName,
-                                        sourceKinds,
-                                        false));
+                       list(SOURCE_PATH,
+                            p,
+                            packageName,
+                            sourceKinds));
         }
     }
 
@@ -645,12 +648,12 @@
      */
     private void scanPlatformPath(PackageSymbol p) throws IOException {
         fillIn(p, PLATFORM_CLASS_PATH,
-               fileManager.list(PLATFORM_CLASS_PATH,
-                                p.fullname.toString(),
-                                allowSigFiles ? EnumSet.of(JavaFileObject.Kind.CLASS,
-                                                           JavaFileObject.Kind.OTHER)
-                                              : EnumSet.of(JavaFileObject.Kind.CLASS),
-                                false));
+               list(PLATFORM_CLASS_PATH,
+                    p,
+                    p.fullname.toString(),
+                    allowSigFiles ? EnumSet.of(JavaFileObject.Kind.CLASS,
+                                               JavaFileObject.Kind.OTHER)
+                                  : EnumSet.of(JavaFileObject.Kind.CLASS)));
     }
     // where
         @SuppressWarnings("fallthrough")
@@ -662,10 +665,7 @@
             for (JavaFileObject fo : files) {
                 switch (fo.getKind()) {
                 case OTHER:
-                    boolean sigFile = location == PLATFORM_CLASS_PATH &&
-                                      allowSigFiles &&
-                                      fo.getName().endsWith(".sig");
-                    if (!sigFile) {
+                    if (!isSigFile(location, fo)) {
                         extraFileActions(p, fo);
                         break;
                     }
@@ -682,10 +682,61 @@
                 }
                 default:
                     extraFileActions(p, fo);
+                    break;
                 }
             }
         }
 
+        boolean isSigFile(Location location, JavaFileObject fo) {
+            return location == PLATFORM_CLASS_PATH &&
+                   allowSigFiles &&
+                   fo.getName().endsWith(".sig");
+        }
+
+        Iterable<JavaFileObject> list(Location location,
+                                      PackageSymbol p,
+                                      String packageName,
+                                      Set<Kind> kinds) throws IOException {
+            Iterable<JavaFileObject> listed = fileManager.list(location,
+                                                               packageName,
+                                                               EnumSet.allOf(Kind.class),
+                                                               false);
+            return () -> new Iterator<JavaFileObject>() {
+                private final Iterator<JavaFileObject> original = listed.iterator();
+                private JavaFileObject next;
+                @Override
+                public boolean hasNext() {
+                    if (next == null) {
+                        while (original.hasNext()) {
+                            JavaFileObject fo = original.next();
+
+                            if (fo.getKind() != Kind.CLASS &&
+                                fo.getKind() != Kind.SOURCE &&
+                                !isSigFile(currentLoc, fo)) {
+                                p.flags_field |= Flags.HAS_RESOURCE;
+                            }
+
+                            if (kinds.contains(fo.getKind())) {
+                                next = fo;
+                                break;
+                            }
+                        }
+                    }
+                    return next != null;
+                }
+
+                @Override
+                public JavaFileObject next() {
+                    if (!hasNext())
+                        throw new NoSuchElementException();
+                    JavaFileObject result = next;
+                    next = null;
+                    return result;
+                }
+
+            };
+        }
+
     /**
      * Used for bad class definition files, such as bad .class files or
      * for .java files with unexpected package or class names.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java	Thu Dec 01 09:02:42 2016 +0000
@@ -53,7 +53,8 @@
 
     /** Flags for RequiresDirective. */
     public enum RequiresFlag {
-        PUBLIC(0x0020),
+        TRANSITIVE(0x0010),
+        STATIC_PHASE(0x0020),
         SYNTHETIC(0x1000),
         MANDATED(0x8000),
         EXTRA(0x10000);
@@ -73,17 +74,44 @@
         public final int value;
     }
 
+    /** Flags for ExportsDirective. */
+    public enum ExportsFlag {
+        SYNTHETIC(0x1000),
+        MANDATED(0x8000);
+
+        // overkill? move to ClassWriter?
+        public static int value(Set<ExportsFlag> s) {
+            int v = 0;
+            for (ExportsFlag f: s)
+                v |= f.value;
+            return v;
+        }
+
+        ExportsFlag(int value) {
+            this.value = value;
+        }
+
+        public final int value;
+    }
+
     /**
      * 'exports' Package ';'
+     * 'exports' Package 'to' ModuleList ';'
      */
     public static class ExportsDirective extends Directive
             implements ModuleElement.ExportsDirective {
         public final PackageSymbol packge;
         public final List<ModuleSymbol> modules;
+        public final Set<ExportsFlag> flags;
 
         public ExportsDirective(PackageSymbol packge, List<ModuleSymbol> modules) {
+            this(packge, modules, EnumSet.noneOf(ExportsFlag.class));
+        }
+
+        public ExportsDirective(PackageSymbol packge, List<ModuleSymbol> modules, Set<ExportsFlag> flags) {
             this.packge = packge;
             this.modules = modules;
+            this.flags = flags;
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
@@ -92,12 +120,12 @@
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public PackageElement getPackage() {
+        public PackageSymbol getPackage() {
             return packge;
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public java.util.List<? extends ModuleElement> getTargetModules() {
+        public java.util.List<ModuleSymbol> getTargetModules() {
             return modules == null
                     ? null
                     : Collections.unmodifiableList(modules);
@@ -112,17 +140,83 @@
         }
     }
 
+    /** Flags for OpensDirective. */
+    public enum OpensFlag {
+        SYNTHETIC(0x1000),
+        MANDATED(0x8000);
+
+        // overkill? move to ClassWriter?
+        public static int value(Set<OpensFlag> s) {
+            int v = 0;
+            for (OpensFlag f: s)
+                v |= f.value;
+            return v;
+        }
+
+        OpensFlag(int value) {
+            this.value = value;
+        }
+
+        public final int value;
+    }
+
+    /**
+     * 'opens' Package ';'
+     * 'opens' Package 'to' ModuleList ';'
+     */
+    public static class OpensDirective extends Directive
+            implements ModuleElement.OpensDirective {
+        public final PackageSymbol packge;
+        public final List<ModuleSymbol> modules;
+        public final Set<OpensFlag> flags;
+
+        public OpensDirective(PackageSymbol packge, List<ModuleSymbol> modules) {
+            this(packge, modules, EnumSet.noneOf(OpensFlag.class));
+        }
+
+        public OpensDirective(PackageSymbol packge, List<ModuleSymbol> modules, Set<OpensFlag> flags) {
+            this.packge = packge;
+            this.modules = modules;
+            this.flags = flags;
+        }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public ModuleElement.DirectiveKind getKind() {
+            return ModuleElement.DirectiveKind.OPENS;
+        }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public PackageSymbol getPackage() {
+            return packge;
+        }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public java.util.List<ModuleSymbol> getTargetModules() {
+            return modules == null
+                    ? null
+                    : Collections.unmodifiableList(modules);
+        }
+
+        @Override
+        public String toString() {
+            if (modules == null)
+                return "Opens[" + packge + "]";
+            else
+                return "Opens[" + packge + ":" + modules + "]";
+        }
+    }
+
     /**
      * 'provides' ServiceName 'with' QualifiedIdentifer ';'
      */
     public static class ProvidesDirective extends Directive
             implements ModuleElement.ProvidesDirective {
         public final ClassSymbol service;
-        public final ClassSymbol impl;
+        public final List<ClassSymbol> impls;
 
-        public ProvidesDirective(ClassSymbol service, ClassSymbol impl) {
+        public ProvidesDirective(ClassSymbol service, List<ClassSymbol> impls) {
             this.service = service;
-            this.impl = impl;
+            this.impls = impls;
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
@@ -131,37 +225,39 @@
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public TypeElement getService() {
+        public ClassSymbol getService() {
             return service;
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public TypeElement getImplementation() {
-            return impl;
+        public List<ClassSymbol> getImplementations() {
+            return impls;
         }
 
         @Override
         public String toString() {
-            return "Provides[" + service + "," + impl + "]";
+            return "Provides[" + service + "," + impls + "]";
         }
 
+        // TODO: delete?
         @Override
         public boolean equals(Object obj) {
             if (!(obj instanceof ProvidesDirective)) {
                 return false;
             }
             ProvidesDirective other = (ProvidesDirective)obj;
-            return service == other.service && impl == other.impl;
+            return service == other.service && impls.equals(other.impls);
         }
 
+        // TODO: delete?
         @Override
         public int hashCode() {
-            return service.hashCode() * 31 + impl.hashCode() * 37;
+            return service.hashCode() * 31 + impls.hashCode() * 37;
         }
     }
 
     /**
-     * 'requires' ['public'] ModuleName ';'
+     * 'requires' ('static' | 'transitive')* ModuleName ';'
      */
     public static class RequiresDirective extends Directive
             implements ModuleElement.RequiresDirective {
@@ -183,12 +279,17 @@
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public boolean isPublic() {
-            return flags.contains(RequiresFlag.PUBLIC);
+        public boolean isStatic() {
+            return flags.contains(RequiresFlag.STATIC_PHASE);
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public ModuleElement getDependency() {
+        public boolean isTransitive() {
+            return flags.contains(RequiresFlag.TRANSITIVE);
+        }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public ModuleSymbol getDependency() {
             return module;
         }
 
@@ -215,7 +316,7 @@
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public TypeElement getService() {
+        public ClassSymbol getService() {
             return service;
         }
 
@@ -224,6 +325,7 @@
             return "Uses[" + service + "]";
         }
 
+        // TODO: delete?
         @Override
         public boolean equals(Object obj) {
             if (!(obj instanceof UsesDirective)) {
@@ -233,6 +335,7 @@
             return service == other.service;
         }
 
+        // TODO: delete?
         @Override
         public int hashCode() {
             return service.hashCode() * 31;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Thu Dec 01 09:02:42 2016 +0000
@@ -294,9 +294,19 @@
     public static final long SYSTEM_MODULE = 1L<<53;
 
     /**
+     * Flag to indicate the given symbol has a @Deprecated annotation.
+     */
+    public static final long DEPRECATED_ANNOTATION = 1L<<54;
+
+    /**
      * Flag to indicate the given symbol has been deprecated and marked for removal.
      */
-    public static final long DEPRECATED_REMOVAL = 1L<<54;
+    public static final long DEPRECATED_REMOVAL = 1L<<55;
+
+    /**
+     * Flag to indicate the given PackageSymbol contains any non-.java and non-.class resources.
+     */
+    public static final long HAS_RESOURCE = 1L<<56;
 
     /** Modifier masks.
      */
@@ -408,7 +418,11 @@
         LAMBDA_METHOD(Flags.LAMBDA_METHOD),
         TYPE_TRANSLATED(Flags.TYPE_TRANSLATED),
         MODULE(Flags.MODULE),
-        DEPRECATED_REMOVAL(Flags.DEPRECATED_REMOVAL);
+        AUTOMATIC_MODULE(Flags.AUTOMATIC_MODULE),
+        SYSTEM_MODULE(Flags.SYSTEM_MODULE),
+        DEPRECATED_ANNOTATION(Flags.DEPRECATED_ANNOTATION),
+        DEPRECATED_REMOVAL(Flags.DEPRECATED_REMOVAL),
+        HAS_RESOURCE(Flags.HAS_RESOURCE);
 
         Flag(long flag) {
             this.value = flag;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,6 +28,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.annotation.Inherited;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Callable;
@@ -47,6 +48,7 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.ClassFinder.BadEnclosingMethodAttr;
+import com.sun.tools.javac.code.Directive.RequiresFlag;
 import com.sun.tools.javac.code.Kinds.Kind;
 import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata;
 import com.sun.tools.javac.code.Scope.WriteableScope;
@@ -359,6 +361,10 @@
         return (flags_field & DEPRECATED) != 0;
     }
 
+    public boolean hasDeprecatedAnnotation() {
+        return (flags_field & DEPRECATED_ANNOTATION) != 0;
+    }
+
     public boolean isDeprecatedForRemoval() {
         return (flags_field & DEPRECATED_REMOVAL) != 0;
     }
@@ -907,6 +913,7 @@
         public List<com.sun.tools.javac.code.Directive> directives;
         public List<com.sun.tools.javac.code.Directive.RequiresDirective> requires;
         public List<com.sun.tools.javac.code.Directive.ExportsDirective> exports;
+        public List<com.sun.tools.javac.code.Directive.OpensDirective> opens;
         public List<com.sun.tools.javac.code.Directive.ProvidesDirective> provides;
         public List<com.sun.tools.javac.code.Directive.UsesDirective> uses;
 
@@ -917,6 +924,7 @@
         public List<Symbol> enclosedPackages = List.nil();
 
         public Completer usesProvidesCompleter = Completer.NULL_COMPLETER;
+        public final Set<ModuleFlags> flags = EnumSet.noneOf(ModuleFlags.class);
 
         /**
          * Create a ModuleSymbol with an associated module-info ClassSymbol.
@@ -942,6 +950,11 @@
             return name.isEmpty() && owner == null;
         }
 
+        @Override
+        public boolean isDeprecated() {
+            return hasDeprecatedAnnotation();
+        }
+
         public boolean isNoModule() {
             return false;
         }
@@ -1007,6 +1020,26 @@
 
     }
 
+    public enum ModuleFlags {
+        OPEN(0x0020),
+        SYNTHETIC(0x1000),
+        MANDATED(0x8000);
+
+        public static int value(Set<ModuleFlags> s) {
+            int v = 0;
+            for (ModuleFlags f: s)
+                v |= f.value;
+            return v;
+        }
+
+        private ModuleFlags(int value) {
+            this.value = value;
+        }
+
+        public final int value;
+
+    }
+
     /** A class for package symbols
      */
     public static class PackageSymbol extends TypeSymbol
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Dec 01 09:02:42 2016 +0000
@@ -237,6 +237,9 @@
             // TYPE_PARAMETER doesn't aid in distinguishing between
             // Type annotations and declaration annotations on an
             // Element
+        } else if (e.value.name == names.MODULE) {
+            if (s.kind == MDL)
+                return AnnotationType.DECLARATION;
         } else {
             Assert.error("annotationTargetType(): unrecognized Attribute name " + e.value.name +
                     " (" + e.value.name.getClass() + ")");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Dec 01 09:02:42 2016 +0000
@@ -45,6 +45,7 @@
 import java.util.*;
 
 import static com.sun.tools.javac.code.Flags.SYNTHETIC;
+import static com.sun.tools.javac.code.Kinds.Kind.MDL;
 import static com.sun.tools.javac.code.Kinds.Kind.MTH;
 import static com.sun.tools.javac.code.Kinds.Kind.VAR;
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
@@ -337,9 +338,9 @@
 
             // Note: @Deprecated has no effect on local variables and parameters
             if (!c.type.isErroneous()
-                    && toAnnotate.owner.kind != MTH
+                    && (toAnnotate.kind == MDL || toAnnotate.owner.kind != MTH)
                     && types.isSameType(c.type, syms.deprecatedType)) {
-                toAnnotate.flags_field |= Flags.DEPRECATED;
+                toAnnotate.flags_field |= (Flags.DEPRECATED | Flags.DEPRECATED_ANNOTATION);
                 Attribute fr = c.member(names.forRemoval);
                 if (fr instanceof Attribute.Constant) {
                     Attribute.Constant v = (Attribute.Constant) fr;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Dec 01 09:02:42 2016 +0000
@@ -4432,6 +4432,17 @@
 
     public void visitModuleDef(JCModuleDecl tree) {
         tree.sym.completeUsesProvides();
+        ModuleSymbol msym = tree.sym;
+        Lint lint = env.outer.info.lint = env.outer.info.lint.augment(msym);
+        Lint prevLint = chk.setLint(lint);
+
+        chk.checkDeprecatedAnnotation(tree, msym);
+
+        try {
+            deferredLintHandler.flush(tree.pos());
+        } finally {
+            chk.setLint(prevLint);
+        }
     }
 
     /** Finish the attribution of a class. */
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Dec 01 09:02:42 2016 +0000
@@ -227,10 +227,18 @@
     void warnDeprecated(DiagnosticPosition pos, Symbol sym) {
         if (sym.isDeprecatedForRemoval()) {
             if (!lint.isSuppressed(LintCategory.REMOVAL)) {
-                removalHandler.report(pos, "has.been.deprecated.for.removal", sym, sym.location());
+                if (sym.kind == MDL) {
+                    removalHandler.report(pos, "has.been.deprecated.for.removal.module", sym);
+                } else {
+                    removalHandler.report(pos, "has.been.deprecated.for.removal", sym, sym.location());
+                }
             }
         } else if (!lint.isSuppressed(LintCategory.DEPRECATION)) {
-            deprecationHandler.report(pos, "has.been.deprecated", sym, sym.location());
+            if (sym.kind == MDL) {
+                deprecationHandler.report(pos, "has.been.deprecated.module", sym);
+            } else {
+                deprecationHandler.report(pos, "has.been.deprecated", sym, sym.location());
+            }
         }
     }
 
@@ -3245,7 +3253,7 @@
     void checkDeprecated(final DiagnosticPosition pos, final Symbol other, final Symbol s) {
         if ( (s.isDeprecatedForRemoval()
                 || s.isDeprecated() && !other.isDeprecated())
-              && s.outermostClass() != other.outermostClass()) {
+                && (s.outermostClass() != other.outermostClass() || s.outermostClass() == null)) {
             deferredLintHandler.report(new DeferredLintHandler.LintLogger() {
                 @Override
                 public void report() {
@@ -3851,7 +3859,7 @@
             }
 
             if (whatPackage.modle != inPackage.modle && whatPackage.modle != syms.java_base) {
-                //check that relativeTo.modle requires public what.modle, somehow:
+                //check that relativeTo.modle requires transitive what.modle, somehow:
                 List<ModuleSymbol> todo = List.of(inPackage.modle);
 
                 while (todo.nonEmpty()) {
@@ -3860,13 +3868,13 @@
                     if (current == whatPackage.modle)
                         return ; //OK
                     for (RequiresDirective req : current.requires) {
-                        if (req.isPublic()) {
+                        if (req.isTransitive()) {
                             todo = todo.prepend(req.module);
                         }
                     }
                 }
 
-                log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleNotRequiredPublic(kindName(what), what, what.packge().modle));
+                log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleNotRequiredTransitive(kindName(what), what, what.packge().modle));
             }
         }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -167,6 +167,9 @@
      */
     ListBuffer<ClassSymbol> uncompleted;
 
+    /** The queue of modules whose imports still need to be checked. */
+    ListBuffer<JCCompilationUnit> unfinishedModules = new ListBuffer<>();
+
     /** A dummy class to serve as enclClass for toplevel environments.
      */
     private JCClassDecl predefClassDef;
@@ -308,6 +311,10 @@
         boolean isPkgInfo = tree.sourcefile.isNameCompatible("package-info",
                                                              JavaFileObject.Kind.SOURCE);
         if (TreeInfo.isModuleInfo(tree)) {
+            JCPackageDecl pd = tree.getPackage();
+            if (pd != null) {
+                log.error(pd.pos(), Errors.NoPkgInModuleInfoJava);
+            }
             tree.packge = syms.rootPackage;
             Env<AttrContext> topEnv = topLevelEnv(tree);
             classEnter(tree.defs, topEnv);
@@ -509,7 +516,9 @@
     public void visitModuleDef(JCModuleDecl tree) {
         Env<AttrContext> moduleEnv = moduleEnv(tree, env);
         typeEnvs.put(tree.sym, moduleEnv);
-        todo.append(moduleEnv);
+        if (modules.isInModuleGraph(tree.sym)) {
+            todo.append(moduleEnv);
+        }
     }
 
     /** Default class enter visitor method: do nothing.
@@ -552,7 +561,19 @@
                         prevUncompleted.append(clazz);
                 }
 
-                typeEnter.ensureImportsChecked(trees);
+                if (!modules.modulesInitialized()) {
+                    for (JCCompilationUnit cut : trees) {
+                        if (cut.getModuleDecl() != null) {
+                            unfinishedModules.append(cut);
+                        } else {
+                            typeEnter.ensureImportsChecked(List.of(cut));
+                        }
+                    }
+                } else {
+                    typeEnter.ensureImportsChecked(unfinishedModules.toList());
+                    unfinishedModules.clear();
+                    typeEnter.ensureImportsChecked(trees);
+                }
             }
         } finally {
             uncompleted = prevUncompleted;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Dec 01 09:02:42 2016 +0000
@@ -2387,6 +2387,7 @@
     public void visitModuleDef(JCModuleDecl tree) {
         ModuleSymbol msym = tree.sym;
         ClassSymbol c = msym.module_info;
+        c.setAttributes(msym);
         c.flags_field |= Flags.MODULE;
         createInfoClass(List.<JCAnnotation>nil(), tree.sym.module_info);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Thu Dec 01 09:02:42 2016 +0000
@@ -50,9 +50,14 @@
 import javax.tools.JavaFileObject.Kind;
 import javax.tools.StandardLocation;
 
+import com.sun.source.tree.ModuleTree.ModuleKind;
 import com.sun.tools.javac.code.ClassFinder;
+import com.sun.tools.javac.code.DeferredLintHandler;
 import com.sun.tools.javac.code.Directive;
 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.Directive.UsesDirective;
@@ -66,6 +71,7 @@
 import com.sun.tools.javac.code.Symbol.Completer;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Symbol.ModuleFlags;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.code.Symtab;
@@ -78,14 +84,18 @@
 import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.tree.JCTree.JCDirective;
 import com.sun.tools.javac.tree.JCTree.JCExports;
 import com.sun.tools.javac.tree.JCTree.JCExpression;
 import com.sun.tools.javac.tree.JCTree.JCModuleDecl;
+import com.sun.tools.javac.tree.JCTree.JCOpens;
 import com.sun.tools.javac.tree.JCTree.JCPackageDecl;
 import com.sun.tools.javac.tree.JCTree.JCProvides;
 import com.sun.tools.javac.tree.JCTree.JCRequires;
 import com.sun.tools.javac.tree.JCTree.JCUses;
+import com.sun.tools.javac.tree.JCTree.Tag;
 import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.util.Abort;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.JCDiagnostic;
@@ -96,20 +106,15 @@
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Options;
-
-import static com.sun.tools.javac.code.Flags.UNATTRIBUTED;
-import static com.sun.tools.javac.code.Kinds.Kind.MDL;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-
-import com.sun.tools.javac.tree.JCTree.JCDirective;
-import com.sun.tools.javac.tree.JCTree.Tag;
-import com.sun.tools.javac.util.Abort;
 import com.sun.tools.javac.util.Position;
 
 import static com.sun.tools.javac.code.Flags.ABSTRACT;
 import static com.sun.tools.javac.code.Flags.ENUM;
 import static com.sun.tools.javac.code.Flags.PUBLIC;
-import static com.sun.tools.javac.tree.JCTree.Tag.MODULEDEF;
+import static com.sun.tools.javac.code.Flags.UNATTRIBUTED;
+import static com.sun.tools.javac.code.Kinds.Kind.MDL;
+import static com.sun.tools.javac.code.Kinds.Kind.MTH;
+import static com.sun.tools.javac.code.TypeTag.CLASS;
 
 /**
  *  TODO: fill in
@@ -127,6 +132,8 @@
     private final Names names;
     private final Symtab syms;
     private final Attr attr;
+    private final Check chk;
+    private final DeferredLintHandler deferredLintHandler;
     private final TypeEnvs typeEnvs;
     private final Types types;
     private final JavaFileManager fileManager;
@@ -169,6 +176,8 @@
         names = Names.instance(context);
         syms = Symtab.instance(context);
         attr = Attr.instance(context);
+        chk = Check.instance(context);
+        deferredLintHandler = DeferredLintHandler.instance(context);
         typeEnvs = TypeEnvs.instance(context);
         moduleFinder = ModuleFinder.instance(context);
         types = Types.instance(context);
@@ -276,6 +285,10 @@
         return defaultModule;
     }
 
+    public boolean modulesInitialized() {
+        return allModules != null;
+    }
+
     private Set<ModuleSymbol> enterModules(List<JCCompilationUnit> trees, ClassSymbol c) {
         Set<ModuleSymbol> modules = new LinkedHashSet<>();
         for (JCCompilationUnit tree : trees) {
@@ -292,9 +305,9 @@
 
     private void enterModule(JCCompilationUnit toplevel, ClassSymbol c, Set<ModuleSymbol> modules) {
         boolean isModuleInfo = toplevel.sourcefile.isNameCompatible("module-info", Kind.SOURCE);
-        boolean isModuleDecl = toplevel.defs.nonEmpty() && toplevel.defs.head.hasTag(MODULEDEF);
+        boolean isModuleDecl = toplevel.getModuleDecl() != null;
         if (isModuleDecl) {
-            JCModuleDecl decl = (JCModuleDecl) toplevel.defs.head;
+            JCModuleDecl decl = toplevel.getModuleDecl();
             if (!isModuleInfo) {
                 log.error(decl.pos(), Errors.ModuleDeclSbInModuleInfoJava);
             }
@@ -352,8 +365,8 @@
                     if (locn != null) {
                         Name name = names.fromString(fileManager.inferModuleName(locn));
                         ModuleSymbol msym;
-                        if (tree.defs.head.hasTag(MODULEDEF)) {
-                            JCModuleDecl decl = (JCModuleDecl) tree.defs.head;
+                        JCModuleDecl decl = tree.getModuleDecl();
+                        if (decl != null) {
                             msym = decl.sym;
                             if (msym.name != name) {
                                 log.error(decl.qualId, Errors.ModuleNameMismatch(msym.name, name));
@@ -449,17 +462,14 @@
     }
 
     private Location getModuleLocation(JCCompilationUnit tree) throws IOException {
-        switch (tree.defs.head.getTag()) {
-            case MODULEDEF:
-                return getModuleLocation(tree.sourcefile, null);
-
-            case PACKAGEDEF:
-                JCPackageDecl pkg = (JCPackageDecl) tree.defs.head;
-                return getModuleLocation(tree.sourcefile, TreeInfo.fullName(pkg.pid));
-
-            default:
-                // code in unnamed module
-                return null;
+        if (tree.getModuleDecl() != null) {
+            return getModuleLocation(tree.sourcefile, null);
+        } else if (tree.getPackage() != null) {
+            JCPackageDecl pkg = tree.getPackage();
+            return getModuleLocation(tree.sourcefile, TreeInfo.fullName(pkg.pid));
+        } else {
+            // code in unnamed module
+            return null;
         }
     }
 
@@ -535,6 +545,7 @@
                 String pack = binName.lastIndexOf('.') != (-1) ? binName.substring(0, binName.lastIndexOf('.')) : ""; //unnamed package????
                 if (seenPackages.add(pack)) {
                     ExportsDirective d = new ExportsDirective(syms.enterPackage(msym, names.fromString(pack)), null);
+                    //TODO: opens?
                     directives.add(d);
                     exports.add(d);
                 }
@@ -562,7 +573,7 @@
             if (ms == syms.unnamedModule || ms == msym)
                 continue;
             Set<RequiresFlag> flags = (ms.flags_field & Flags.AUTOMATIC_MODULE) != 0 ?
-                    EnumSet.of(RequiresFlag.PUBLIC) : EnumSet.noneOf(RequiresFlag.class);
+                    EnumSet.of(RequiresFlag.TRANSITIVE) : EnumSet.noneOf(RequiresFlag.class);
             RequiresDirective d = new RequiresDirective(ms, flags);
             directives.add(d);
             requires.add(d);
@@ -585,9 +596,10 @@
                 ModuleVisitor v = new ModuleVisitor();
                 JavaFileObject prev = log.useSource(tree.sourcefile);
                 try {
-                    tree.defs.head.accept(v);
-                    checkCyclicDependencies((JCModuleDecl) tree.defs.head);
+                    JCModuleDecl moduleDecl = tree.getModuleDecl();
+                    moduleDecl.accept(v);
                     completeModule(msym);
+                    checkCyclicDependencies(moduleDecl);
                 } finally {
                     log.useSource(prev);
                     msym.flags_field &= ~UNATTRIBUTED;
@@ -605,17 +617,25 @@
     class ModuleVisitor extends JCTree.Visitor {
         private ModuleSymbol sym;
         private final Set<ModuleSymbol> allRequires = new HashSet<>();
-        private final Set<PackageSymbol> allExports = new HashSet<>();
+        private final Map<PackageSymbol,List<ExportsDirective>> allExports = new HashMap<>();
+        private final Map<PackageSymbol,List<OpensDirective>> allOpens = new HashMap<>();
 
         @Override
         public void visitModuleDef(JCModuleDecl tree) {
             sym = Assert.checkNonNull(tree.sym);
 
+            if (tree.getModuleType() == ModuleKind.OPEN) {
+                sym.flags.add(ModuleFlags.OPEN);
+            }
+            sym.flags_field |= (tree.mods.flags & Flags.DEPRECATED);
+
             sym.requires = List.nil();
             sym.exports = List.nil();
+            sym.opens = List.nil();
             tree.directives.forEach(t -> t.accept(this));
             sym.requires = sym.requires.reverse();
             sym.exports = sym.exports.reverse();
+            sym.opens = sym.opens.reverse();
             ensureJavaBase();
         }
 
@@ -629,8 +649,10 @@
             } else {
                 allRequires.add(msym);
                 Set<RequiresFlag> flags = EnumSet.noneOf(RequiresFlag.class);
-                if (tree.isPublic)
-                    flags.add(RequiresFlag.PUBLIC);
+                if (tree.isTransitive)
+                    flags.add(RequiresFlag.TRANSITIVE);
+                if (tree.isStaticPhase)
+                    flags.add(RequiresFlag.STATIC_PHASE);
                 RequiresDirective d = new RequiresDirective(msym, flags);
                 tree.directive = d;
                 sym.requires = sym.requires.prepend(d);
@@ -642,29 +664,123 @@
             Name name = TreeInfo.fullName(tree.qualid);
             PackageSymbol packge = syms.enterPackage(sym, name);
             attr.setPackageSymbols(tree.qualid, packge);
-            if (!allExports.add(packge)) {
-                log.error(tree.qualid.pos(), Errors.DuplicateExports(packge));
+
+            if (tree.hasTag(Tag.OPENS) && sym.flags.contains(ModuleFlags.OPEN)) {
+                log.error(tree.pos(), Errors.NoOpensUnlessStrong);
+            }
+            List<ExportsDirective> exportsForPackage = allExports.computeIfAbsent(packge, p -> List.nil());
+            for (ExportsDirective d : exportsForPackage) {
+                reportExportsConflict(tree, packge);
             }
 
             List<ModuleSymbol> toModules = null;
             if (tree.moduleNames != null) {
-                Set<ModuleSymbol> to = new HashSet<>();
+                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 if (!to.add(msym)) {
-                        log.error(n.pos(), Errors.DuplicateExports(msym));
+                    } else {
+                        for (ExportsDirective d : exportsForPackage) {
+                            checkDuplicateExportsToModule(n, msym, d);
+                        }
+                        if (!to.add(msym)) {
+                            reportExportsConflictToModule(n, msym);
+                        }
                     }
                 }
                 toModules = List.from(to);
             }
 
             if (toModules == null || !toModules.isEmpty()) {
-                ExportsDirective d = new ExportsDirective(packge, toModules);
+                Set<ExportsFlag> flags = EnumSet.noneOf(ExportsFlag.class);
+                ExportsDirective d = new ExportsDirective(packge, toModules, flags);
+                sym.exports = sym.exports.prepend(d);
                 tree.directive = d;
-                sym.exports = sym.exports.prepend(d);
+
+                allExports.put(packge, exportsForPackage.prepend(d));
+            }
+        }
+
+        private void reportExportsConflict(JCExports tree, PackageSymbol packge) {
+            log.error(tree.qualid.pos(), Errors.ConflictingExports(packge));
+        }
+
+        private void checkDuplicateExportsToModule(JCExpression name, ModuleSymbol msym,
+                ExportsDirective d) {
+            if (d.modules != null) {
+                for (ModuleSymbol other : d.modules) {
+                    if (msym == other) {
+                        reportExportsConflictToModule(name, msym);
+                    }
+                }
+            }
+        }
+
+        private void reportExportsConflictToModule(JCExpression name, ModuleSymbol msym) {
+            log.error(name.pos(), Errors.ConflictingExportsToModule(msym));
+        }
+
+        @Override
+        public void visitOpens(JCOpens tree) {
+            Name name = TreeInfo.fullName(tree.qualid);
+            PackageSymbol packge = syms.enterPackage(sym, name);
+            attr.setPackageSymbols(tree.qualid, packge);
+
+            if (sym.flags.contains(ModuleFlags.OPEN)) {
+                log.error(tree.pos(), Errors.NoOpensUnlessStrong);
+            }
+            List<OpensDirective> opensForPackage = allOpens.computeIfAbsent(packge, p -> List.nil());
+            for (OpensDirective d : opensForPackage) {
+                reportOpensConflict(tree, packge);
             }
+
+            List<ModuleSymbol> toModules = null;
+            if (tree.moduleNames != null) {
+                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);
+                        }
+                    }
+                }
+                toModules = List.from(to);
+            }
+
+            if (toModules == null || !toModules.isEmpty()) {
+                Set<OpensFlag> flags = EnumSet.noneOf(OpensFlag.class);
+                OpensDirective d = new OpensDirective(packge, toModules, flags);
+                sym.opens = sym.opens.prepend(d);
+                tree.directive = d;
+
+                allOpens.put(packge, opensForPackage.prepend(d));
+            }
+        }
+
+        private void reportOpensConflict(JCOpens tree, PackageSymbol packge) {
+            log.error(tree.qualid.pos(), Errors.ConflictingOpens(packge));
+        }
+
+        private void checkDuplicateOpensToModule(JCExpression name, ModuleSymbol msym,
+                OpensDirective d) {
+            if (d.modules != null) {
+                for (ModuleSymbol other : d.modules) {
+                    if (msym == other) {
+                        reportOpensConflictToModule(name, msym);
+                    }
+                }
+            }
+        }
+
+        private void reportOpensConflictToModule(JCExpression name, ModuleSymbol msym) {
+            log.error(name.pos(), Errors.ConflictingOpensToModule(msym));
         }
 
         @Override
@@ -706,10 +822,14 @@
             Env<AttrContext> env = typeEnvs.get(msym);
             UsesProvidesVisitor v = new UsesProvidesVisitor(msym, env);
             JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
+            JCModuleDecl decl = env.toplevel.getModuleDecl();
+            DiagnosticPosition prevLintPos = deferredLintHandler.setPos(decl.pos());
+
             try {
-                env.toplevel.defs.head.accept(v);
+                decl.accept(v);
             } finally {
                 log.useSource(prev);
+                deferredLintHandler.setPos(prevLintPos);
             }
         };
     }
@@ -718,8 +838,8 @@
         private final ModuleSymbol msym;
         private final Env<AttrContext> env;
 
-        private final Set<Directive.UsesDirective> allUses = new HashSet<>();
-        private final Set<Directive.ProvidesDirective> allProvides = new HashSet<>();
+        private final Set<ClassSymbol> allUses = new HashSet<>();
+        private final Map<ClassSymbol, Set<ClassSymbol>> allProvides = new HashMap<>();
 
         public UsesProvidesVisitor(ModuleSymbol msym, Env<AttrContext> env) {
             this.msym = msym;
@@ -752,6 +872,15 @@
             msym.directives = msym.directives.prepend(tree.directive);
         }
 
+        @Override
+        public void visitOpens(JCOpens tree) {
+            if (tree.directive.packge.members().isEmpty() &&
+                ((tree.directive.packge.flags() & Flags.HAS_RESOURCE) == 0)) {
+                log.error(tree.qualid.pos(), Errors.PackageEmptyOrNotFound(tree.directive.packge));
+            }
+            msym.directives = msym.directives.prepend(tree.directive);
+        }
+
         MethodSymbol noArgsConstructor(ClassSymbol tsym) {
             for (Symbol sym : tsym.members().getSymbolsByName(names.init)) {
                 MethodSymbol mSym = (MethodSymbol)sym;
@@ -762,34 +891,61 @@
             return null;
         }
 
+        MethodSymbol factoryMethod(ClassSymbol tsym) {
+            for (Symbol sym : tsym.members().getSymbolsByName(names.provider, sym -> sym.kind == MTH)) {
+                MethodSymbol mSym = (MethodSymbol)sym;
+                if (mSym.isStatic() && (mSym.flags() & Flags.PUBLIC) != 0 && mSym.params().isEmpty()) {
+                    return mSym;
+                }
+            }
+            return null;
+        }
+
         Map<Directive.ProvidesDirective, JCProvides> directiveToTreeMap = new HashMap<>();
 
         @Override
         public void visitProvides(JCProvides tree) {
             Type st = attr.attribType(tree.serviceName, env, syms.objectType);
-            Type it = attr.attribType(tree.implName, env, syms.objectType);
             ClassSymbol service = (ClassSymbol) st.tsym;
-            ClassSymbol impl = (ClassSymbol) it.tsym;
-            if (!types.isSubtype(it, st)) {
-                log.error(tree.implName.pos(), Errors.ServiceImplementationMustBeSubtypeOfServiceInterface);
-            }
-            if ((impl.flags() & ABSTRACT) != 0) {
-                log.error(tree.implName.pos(), Errors.ServiceImplementationIsAbstract(impl));
-            } else if (impl.isInner()) {
-                log.error(tree.implName.pos(), Errors.ServiceImplementationIsInner(impl));
-            } else {
-                MethodSymbol constr = noArgsConstructor(impl);
-                if (constr == null) {
-                    log.error(tree.implName.pos(), Errors.ServiceImplementationDoesntHaveANoArgsConstructor(impl));
-                } else if ((constr.flags() & PUBLIC) == 0) {
-                    log.error(tree.implName.pos(), Errors.ServiceImplementationNoArgsConstructorNotPublic(impl));
+            ListBuffer<ClassSymbol> impls = new ListBuffer<>();
+            for (JCExpression implName : tree.implNames) {
+                Type it = attr.attribType(implName, env, syms.objectType);
+                ClassSymbol impl = (ClassSymbol) it.tsym;
+                //find provider factory:
+                MethodSymbol factory = factoryMethod(impl);
+                if (factory != null) {
+                    Type returnType = factory.type.getReturnType();
+                    if (!types.isSubtype(returnType, st)) {
+                        log.error(implName.pos(), Errors.ServiceImplementationProviderReturnMustBeSubtypeOfServiceInterface);
+                    }
+                } else {
+                    if (!types.isSubtype(it, st)) {
+                        log.error(implName.pos(), Errors.ServiceImplementationMustBeSubtypeOfServiceInterface);
+                    } else if ((impl.flags() & ABSTRACT) != 0) {
+                        log.error(implName.pos(), Errors.ServiceImplementationIsAbstract(impl));
+                    } else if (impl.isInner()) {
+                        log.error(implName.pos(), Errors.ServiceImplementationIsInner(impl));
+                    } else {
+                        MethodSymbol constr = noArgsConstructor(impl);
+                        if (constr == null) {
+                            log.error(implName.pos(), Errors.ServiceImplementationDoesntHaveANoArgsConstructor(impl));
+                        } else if ((constr.flags() & PUBLIC) == 0) {
+                            log.error(implName.pos(), Errors.ServiceImplementationNoArgsConstructorNotPublic(impl));
+                        }
+                    }
+                }
+                if (it.hasTag(CLASS)) {
+                    // For now, we just check the pair (service-type, impl-type) is unique
+                    // TODO, check only one provides per service type as well
+                    if (allProvides.computeIfAbsent(service, s -> new HashSet<>()).add(impl)) {
+                        impls.append(impl);
+                    } else {
+                        log.error(implName.pos(), Errors.DuplicateProvides(service, impl));
+                    }
                 }
             }
-            if (st.hasTag(CLASS) && it.hasTag(CLASS)) {
-                Directive.ProvidesDirective d = new Directive.ProvidesDirective(service, impl);
-                if (!allProvides.add(d)) {
-                    log.error(tree.pos(), Errors.DuplicateProvides(service, impl));
-                }
+            if (st.hasTag(CLASS) && !impls.isEmpty()) {
+                Directive.ProvidesDirective d = new Directive.ProvidesDirective(service, impls.toList());
                 msym.provides = msym.provides.prepend(d);
                 msym.directives = msym.directives.prepend(d);
                 directiveToTreeMap.put(d, tree);
@@ -799,6 +955,7 @@
         @Override
         public void visitRequires(JCRequires tree) {
             if (tree.directive != null) {
+                chk.checkDeprecated(tree.moduleName.pos(), msym, tree.directive.module);
                 msym.directives = msym.directives.prepend(tree.directive);
             }
         }
@@ -811,53 +968,58 @@
                 log.error(tree.qualid.pos(), Errors.ServiceDefinitionIsEnum(st.tsym));
             } else if (st.hasTag(CLASS)) {
                 ClassSymbol service = (ClassSymbol) st.tsym;
-                Directive.UsesDirective d = new Directive.UsesDirective(service);
-                if (!allUses.add(d)) {
+                if (allUses.add(service)) {
+                    Directive.UsesDirective d = new Directive.UsesDirective(service);
+                    msym.uses = msym.uses.prepend(d);
+                    msym.directives = msym.directives.prepend(d);
+                } else {
                     log.error(tree.pos(), Errors.DuplicateUses(service));
                 }
-                msym.uses = msym.uses.prepend(d);
-                msym.directives = msym.directives.prepend(d);
             }
         }
 
         private void checkForCorrectness() {
-            for (Directive.ProvidesDirective provides : allProvides) {
+            for (Directive.ProvidesDirective provides : msym.provides) {
                 JCProvides tree = directiveToTreeMap.get(provides);
-                /* The implementation must be defined in the same module as the provides directive
-                 * (else, error)
-                 */
-                PackageSymbol implementationDefiningPackage = provides.impl.packge();
-                if (implementationDefiningPackage.modle != msym) {
-                    log.error(tree.pos(), Errors.ServiceImplementationNotInRightModule(implementationDefiningPackage.modle));
-                }
+                for (ClassSymbol impl : provides.impls) {
+                    /* The implementation must be defined in the same module as the provides directive
+                     * (else, error)
+                     */
+                    PackageSymbol implementationDefiningPackage = impl.packge();
+                    if (implementationDefiningPackage.modle != msym) {
+                        // TODO: should use tree for the implentation name, not the entire provides tree
+                        // TODO: should improve error message to identify the implementation type
+                        log.error(tree.pos(), Errors.ServiceImplementationNotInRightModule(implementationDefiningPackage.modle));
+                    }
 
-                /* There is no inherent requirement that module that provides a service should actually
-                 * use it itself. However, it is a pointless declaration if the service package is not
-                 * exported and there is no uses for the service.
-                 */
-                PackageSymbol interfaceDeclaringPackage = provides.service.packge();
-                boolean isInterfaceDeclaredInCurrentModule = interfaceDeclaringPackage.modle == msym;
-                boolean isInterfaceExportedFromAReadableModule =
-                        msym.visiblePackages.get(interfaceDeclaringPackage.fullname) == interfaceDeclaringPackage;
-                if (isInterfaceDeclaredInCurrentModule && !isInterfaceExportedFromAReadableModule) {
-                    // ok the interface is declared in this module. Let's check if it's exported
-                    boolean warn = true;
-                    for (ExportsDirective export : msym.exports) {
-                        if (interfaceDeclaringPackage == export.packge) {
-                            warn = false;
-                            break;
-                        }
-                    }
-                    if (warn) {
-                        for (UsesDirective uses : msym.uses) {
-                            if (provides.service == uses.service) {
+                    /* There is no inherent requirement that module that provides a service should actually
+                     * use it itself. However, it is a pointless declaration if the service package is not
+                     * exported and there is no uses for the service.
+                     */
+                    PackageSymbol interfaceDeclaringPackage = provides.service.packge();
+                    boolean isInterfaceDeclaredInCurrentModule = interfaceDeclaringPackage.modle == msym;
+                    boolean isInterfaceExportedFromAReadableModule =
+                            msym.visiblePackages.get(interfaceDeclaringPackage.fullname) == interfaceDeclaringPackage;
+                    if (isInterfaceDeclaredInCurrentModule && !isInterfaceExportedFromAReadableModule) {
+                        // ok the interface is declared in this module. Let's check if it's exported
+                        boolean warn = true;
+                        for (ExportsDirective export : msym.exports) {
+                            if (interfaceDeclaringPackage == export.packge) {
                                 warn = false;
                                 break;
                             }
                         }
-                    }
-                    if (warn) {
-                        log.warning(tree.pos(), Warnings.ServiceProvidedButNotExportedOrUsed(provides.service));
+                        if (warn) {
+                            for (UsesDirective uses : msym.uses) {
+                                if (provides.service == uses.service) {
+                                    warn = false;
+                                    break;
+                                }
+                            }
+                        }
+                        if (warn) {
+                            log.warning(tree.pos(), Warnings.ServiceProvidedButNotExportedOrUsed(provides.service));
+                        }
                     }
                 }
             }
@@ -973,6 +1135,10 @@
         allModules = result;
     }
 
+    public boolean isInModuleGraph(ModuleSymbol msym) {
+        return allModules == null || allModules.contains(msym);
+    }
+
     private Set<ModuleSymbol> computeTransitiveClosure(Iterable<? extends ModuleSymbol> base, Set<ModuleSymbol> observable) {
         List<ModuleSymbol> todo = List.nil();
 
@@ -1019,7 +1185,8 @@
                     return ;
                 }
                 ModuleSymbol msym = (ModuleSymbol) sym;
-                Set<ModuleSymbol> allModules = allModules();
+                Set<ModuleSymbol> allModules = new HashSet<>(allModules());
+                allModules.remove(syms.unnamedModule);
                 for (ModuleSymbol m : allModules) {
                     m.complete();
                 }
@@ -1033,7 +1200,7 @@
         };
     }
 
-    private final Map<ModuleSymbol, Set<ModuleSymbol>> requiresPublicCache = new HashMap<>();
+    private final Map<ModuleSymbol, Set<ModuleSymbol>> requiresTransitiveCache = new HashMap<>();
 
     private void completeModule(ModuleSymbol msym) {
         if (inInitModules) {
@@ -1079,34 +1246,36 @@
         }
 
         Set<ModuleSymbol> readable = new LinkedHashSet<>();
-        Set<ModuleSymbol> requiresPublic = new HashSet<>();
+        Set<ModuleSymbol> requiresTransitive = new HashSet<>();
 
         for (RequiresDirective d : msym.requires) {
             d.module.complete();
             readable.add(d.module);
-            Set<ModuleSymbol> s = retrieveRequiresPublic(d.module);
+            Set<ModuleSymbol> s = retrieveRequiresTransitive(d.module);
             Assert.checkNonNull(s, () -> "no entry in cache for " + d.module);
             readable.addAll(s);
-            if (d.flags.contains(RequiresFlag.PUBLIC)) {
-                requiresPublic.add(d.module);
-                requiresPublic.addAll(s);
+            if (d.flags.contains(RequiresFlag.TRANSITIVE)) {
+                requiresTransitive.add(d.module);
+                requiresTransitive.addAll(s);
             }
         }
 
-        requiresPublicCache.put(msym, requiresPublic);
+        requiresTransitiveCache.put(msym, requiresTransitive);
         initVisiblePackages(msym, readable);
         for (ExportsDirective d: msym.exports) {
-            d.packge.modle = msym;
+            if (d.packge != null) {
+                d.packge.modle = msym;
+            }
         }
 
     }
 
-    private Set<ModuleSymbol> retrieveRequiresPublic(ModuleSymbol msym) {
-        Set<ModuleSymbol> requiresPublic = requiresPublicCache.get(msym);
+    private Set<ModuleSymbol> retrieveRequiresTransitive(ModuleSymbol msym) {
+        Set<ModuleSymbol> requiresTransitive = requiresTransitiveCache.get(msym);
 
-        if (requiresPublic == null) {
+        if (requiresTransitive == null) {
             //the module graph may contain cycles involving automatic modules or --add-reads edges
-            requiresPublic = new HashSet<>();
+            requiresTransitive = new HashSet<>();
 
             Set<ModuleSymbol> seen = new HashSet<>();
             List<ModuleSymbol> todo = List.of(msym);
@@ -1116,14 +1285,14 @@
                 todo = todo.tail;
                 if (!seen.add(current))
                     continue;
-                requiresPublic.add(current);
+                requiresTransitive.add(current);
                 current.complete();
                 Iterable<? extends RequiresDirective> requires;
                 if (current != syms.unnamedModule) {
                     Assert.checkNonNull(current.requires, () -> current + ".requires == null; " + msym);
                     requires = current.requires;
                     for (RequiresDirective rd : requires) {
-                        if (rd.isPublic())
+                        if (rd.isTransitive())
                             todo = todo.prepend(rd.module);
                     }
                 } else {
@@ -1133,10 +1302,10 @@
                 }
             }
 
-            requiresPublic.remove(msym);
+            requiresTransitive.remove(msym);
         }
 
-        return requiresPublic;
+        return requiresTransitive;
     }
 
     private void initVisiblePackages(ModuleSymbol msym, Collection<ModuleSymbol> readable) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -160,8 +160,6 @@
         // if there remain any unimported toplevels (these must have
         // no classes at all), process their import statements as well.
         for (JCCompilationUnit tree : trees) {
-            if (tree.defs.nonEmpty() && tree.defs.head.hasTag(MODULEDEF))
-                continue;
             if (!tree.starImportScope.isFilled()) {
                 Env<AttrContext> topEnv = enter.topLevelEnv(tree);
                 finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); });
@@ -344,13 +342,22 @@
                     throw new FatalError(diags.fragment("fatal.err.no.java.lang"));
                 importAll(make.at(tree.pos()).Import(make.QualIdent(javaLang), false), javaLang, env);
 
+                JCModuleDecl decl = tree.getModuleDecl();
+
                 // Process the package def and all import clauses.
-                if (tree.getPackage() != null)
+                if (tree.getPackage() != null && decl == null)
                     checkClassPackageClash(tree.getPackage());
 
                 for (JCImport imp : tree.getImports()) {
                     doImport(imp);
                 }
+
+                if (decl != null) {
+                    //check @Deprecated:
+                    markDeprecated(decl.sym, decl.mods.annotations, env);
+                    // process module annotations
+                    annotate.annotateLater(decl.mods.annotations, env, env.toplevel.modle, null);
+                }
             } finally {
                 this.env = prevEnv;
                 chk.setLint(prevLint);
@@ -745,12 +752,7 @@
                 }
             }
 
-            // Annotations.
-            // In general, we cannot fully process annotations yet,  but we
-            // can attribute the annotation types and then check to see if the
-            // @Deprecated annotation is present.
-            attr.attribAnnotationTypes(tree.mods.annotations, baseEnv);
-            handleDeprecatedAnnotation(tree.mods.annotations, sym);
+            markDeprecated(sym, tree.mods.annotations, baseEnv);
 
             chk.checkNonCyclicDecl(tree);
         }
@@ -765,32 +767,6 @@
                 return superType;
             }
 
-            /**
-             * If a list of annotations contains a reference to java.lang.Deprecated,
-             * set the DEPRECATED flag.
-             * If the annotation is marked forRemoval=true, also set DEPRECATED_REMOVAL.
-             **/
-            private void handleDeprecatedAnnotation(List<JCAnnotation> annotations, Symbol sym) {
-                for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
-                    JCAnnotation a = al.head;
-                    if (a.annotationType.type == syms.deprecatedType) {
-                        sym.flags_field |= Flags.DEPRECATED;
-                        a.args.stream()
-                                .filter(e -> e.hasTag(ASSIGN))
-                                .map(e -> (JCAssign) e)
-                                .filter(assign -> TreeInfo.name(assign.lhs) == names.forRemoval)
-                                .findFirst()
-                                .ifPresent(assign -> {
-                                    JCExpression rhs = TreeInfo.skipParens(assign.rhs);
-                                    if (rhs.hasTag(LITERAL)
-                                            && Boolean.TRUE.equals(((JCLiteral) rhs).getValue())) {
-                                        sym.flags_field |= DEPRECATED_REMOVAL;
-                                    }
-                                });
-                    }
-                }
-            }
-
         @Override
         public void complete(Symbol sym) throws CompletionFailure {
             Assert.check((topLevelPhase instanceof ImportsPhase) ||
@@ -1135,4 +1111,41 @@
         List<JCExpression> typeargs = typarams.nonEmpty() ? make.Types(typarams) : null;
         return make.Exec(make.Apply(typeargs, meth, make.Idents(params)));
     }
+
+    /**
+     * Mark sym deprecated if annotations contain @Deprecated annotation.
+     */
+    public void markDeprecated(Symbol sym, List<JCAnnotation> annotations, Env<AttrContext> env) {
+        // In general, we cannot fully process annotations yet,  but we
+        // can attribute the annotation types and then check to see if the
+        // @Deprecated annotation is present.
+        attr.attribAnnotationTypes(annotations, env);
+        handleDeprecatedAnnotations(annotations, sym);
+    }
+
+    /**
+     * If a list of annotations contains a reference to java.lang.Deprecated,
+     * set the DEPRECATED flag.
+     * If the annotation is marked forRemoval=true, also set DEPRECATED_REMOVAL.
+     **/
+    private void handleDeprecatedAnnotations(List<JCAnnotation> annotations, Symbol sym) {
+        for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
+            JCAnnotation a = al.head;
+            if (a.annotationType.type == syms.deprecatedType) {
+                sym.flags_field |= (Flags.DEPRECATED | Flags.DEPRECATED_ANNOTATION);
+                a.args.stream()
+                        .filter(e -> e.hasTag(ASSIGN))
+                        .map(e -> (JCAssign) e)
+                        .filter(assign -> TreeInfo.name(assign.lhs) == names.forRemoval)
+                        .findFirst()
+                        .ifPresent(assign -> {
+                            JCExpression rhs = TreeInfo.skipParens(assign.rhs);
+                            if (rhs.hasTag(LITERAL)
+                                    && Boolean.TRUE.equals(((JCLiteral) rhs).getValue())) {
+                                sym.flags_field |= DEPRECATED_REMOVAL;
+                            }
+                        });
+            }
+        }
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Thu Dec 01 09:02:42 2016 +0000
@@ -29,6 +29,7 @@
 import java.io.InputStream;
 import java.lang.ref.SoftReference;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -128,7 +129,7 @@
 
     protected String classLoaderClass;
 
-    protected Locations locations;
+    protected final Locations locations;
 
     /**
      * A flag for clients to use to indicate that this file manager should
@@ -209,7 +210,10 @@
             addReadsMethod.invoke(thisModule, targetModule);
         } catch (NoSuchMethodException e) {
             // ignore
-        } catch (Exception e) {
+        } catch (IllegalAccessException
+                | IllegalArgumentException
+                | SecurityException
+                | InvocationTargetException e) {
             throw new Abort(e);
         }
         return targetLoader;
@@ -324,12 +328,12 @@
 
     @SuppressWarnings("cast")
     public CharBuffer decode(ByteBuffer inbuf, boolean ignoreEncodingErrors) {
-        String encodingName = getEncodingName();
+        String encName = getEncodingName();
         CharsetDecoder decoder;
         try {
-            decoder = getDecoder(encodingName, ignoreEncodingErrors);
+            decoder = getDecoder(encName, ignoreEncodingErrors);
         } catch (IllegalCharsetNameException | UnsupportedCharsetException e) {
-            log.error("unsupported.encoding", encodingName);
+            log.error("unsupported.encoding", encName);
             return (CharBuffer)CharBuffer.allocate(1).flip();
         }
 
@@ -365,7 +369,7 @@
                     unmappable.append(String.format("%02X", inbuf.get()));
                 }
 
-                String charsetName = charset == null ? encodingName : charset.name();
+                String charsetName = charset == null ? encName : charset.name();
 
                 log.error(dest.limit(),
                           Errors.IllegalCharForEncoding(unmappable.toString(), charsetName));
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1091,7 +1091,8 @@
                     }
 
                     // finally clean up the module name
-                    mn =  mn.replaceAll("[^A-Za-z0-9]", ".")  // replace non-alphanumeric
+                    mn =  mn.replaceAll("(\\.|\\d)*$", "")    // remove trailing version
+                            .replaceAll("[^A-Za-z0-9]", ".")  // replace non-alphanumeric
                             .replaceAll("(\\.)(\\1)+", ".")   // collapse repeating dots
                             .replaceAll("^\\.", "")           // drop leading dots
                             .replaceAll("\\.$", "");          // drop trailing dots
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Thu Dec 01 09:02:42 2016 +0000
@@ -129,8 +129,11 @@
  * String Translation Routines
  ***********************************************************************/
 
-    /** Return internal representation of buf[offset..offset+len-1],
-     *  converting '/' to '.'.
+    /**
+     * Return internal representation of buf[offset..offset+len-1], converting '/' to '.'.
+     *
+     * Note: the naming is the inverse of that used by JVMS 4.2 The Internal Form Of Names,
+     * which defines "internal name" to be the form using "/" instead of "."
      */
     public static byte[] internalize(byte[] buf, int offset, int len) {
         byte[] translated = new byte[len];
@@ -142,15 +145,21 @@
         return translated;
     }
 
-    /** Return internal representation of given name,
-     *  converting '/' to '.'.
+    /**
+     * Return internal representation of given name, converting '/' to '.'.
+     *
+     * Note: the naming is the inverse of that used by JVMS 4.2 The Internal Form Of Names,
+     * which defines "internal name" to be the form using "/" instead of "."
      */
     public static byte[] internalize(Name name) {
         return internalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
     }
 
-    /** Return external representation of buf[offset..offset+len-1],
-     *  converting '.' to '/'.
+    /**
+     * Return external representation of buf[offset..offset+len-1], converting '.' to '/'.
+     *
+     * Note: the naming is the inverse of that used by JVMS 4.2 The Internal Form Of Names,
+     * which defines "internal name" to be the form using "/" instead of "."
      */
     public static byte[] externalize(byte[] buf, int offset, int len) {
         byte[] translated = new byte[len];
@@ -162,8 +171,11 @@
         return translated;
     }
 
-    /** Return external representation of given name,
-     *  converting '/' to '.'.
+    /**
+     * Return external representation of given name, converting '/' to '.'.
+     *
+     * Note: the naming is the inverse of that used by JVMS 4.2 The Internal Form Of Names,
+     * which defines "internal name" to be the form using "/" instead of "."
      */
     public static byte[] externalize(Name name) {
         return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Dec 01 09:02:42 2016 +0000
@@ -62,7 +62,9 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
+
 import com.sun.tools.javac.code.Scope.LookupKind;
+
 import static com.sun.tools.javac.code.TypeTag.ARRAY;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
@@ -159,6 +161,9 @@
      */
     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];
@@ -584,6 +589,53 @@
         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 '.')
+     */
+    Name readModuleName(int i) {
+        Name name = readName(i);
+        // FIXME: temporary compatibility code
+        if (readNewModuleAttribute) {
+            return names.fromUtf(internalize(name));
+        } else {
+            return name;
+        }
+    }
+
+    /** Read module_flags.
+     */
+    Set<ModuleFlags> readModuleFlags(int flags) {
+        Set<ModuleFlags> set = EnumSet.noneOf(ModuleFlags.class);
+        for (ModuleFlags f : ModuleFlags.values()) {
+            if ((flags & f.value) != 0)
+                set.add(f);
+        }
+        return set;
+    }
+
+    /** Read exports_flags.
+     */
+    Set<ExportsFlag> readExportsFlags(int flags) {
+        Set<ExportsFlag> set = EnumSet.noneOf(ExportsFlag.class);
+        for (ExportsFlag f: ExportsFlag.values()) {
+            if ((flags & f.value) != 0)
+                set.add(f);
+        }
+        return set;
+    }
+
+    /** Read opens_flags.
+     */
+    Set<OpensFlag> readOpensFlags(int flags) {
+        Set<OpensFlag> set = EnumSet.noneOf(OpensFlag.class);
+        for (OpensFlag f: OpensFlag.values()) {
+            if ((flags & f.value) != 0)
+                set.add(f);
+        }
+        return set;
+    }
+
     /** Read requires_flags.
      */
     Set<RequiresFlag> readRequiresFlags(int flags) {
@@ -996,7 +1048,9 @@
 
             new AttributeReader(names.Deprecated, V45_3, CLASS_OR_MEMBER_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
-                    sym.flags_field |= DEPRECATED;
+                    Symbol s = sym.owner.kind == MDL ? sym.owner : sym;
+
+                    s.flags_field |= DEPRECATED;
                 }
             },
 
@@ -1228,11 +1282,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);
+                            }
+                        }
+
+                        msym.flags.addAll(readModuleFlags(nextChar()));
+
                         ListBuffer<RequiresDirective> requires = new ListBuffer<>();
                         int nrequires = nextChar();
                         for (int i = 0; i < nrequires; i++) {
-                            Name name = readName(nextChar());
-                            ModuleSymbol rsym = syms.enterModule(name);
+                            ModuleSymbol rsym = syms.enterModule(readModuleName(nextChar()));
                             Set<RequiresFlag> flags = readRequiresFlags(nextChar());
                             requires.add(new RequiresDirective(rsym, flags));
                         }
@@ -1244,6 +1307,7 @@
                         for (int i = 0; i < nexports; i++) {
                             Name n = readName(nextChar());
                             PackageSymbol p = syms.enterPackage(currentModule, names.fromUtf(internalize(n)));
+                            Set<ExportsFlag> flags = readExportsFlags(nextChar());
                             int nto = nextChar();
                             List<ModuleSymbol> to;
                             if (nto == 0) {
@@ -1251,13 +1315,36 @@
                             } else {
                                 ListBuffer<ModuleSymbol> lb = new ListBuffer<>();
                                 for (int t = 0; t < nto; t++)
-                                    lb.append(syms.enterModule(readName(nextChar())));
+                                    lb.append(syms.enterModule(readModuleName(nextChar())));
                                 to = lb.toList();
                             }
-                            exports.add(new ExportsDirective(p, to));
+                            exports.add(new ExportsDirective(p, to, flags));
                         }
                         msym.exports = exports.toList();
                         directives.addAll(msym.exports);
+                        ListBuffer<OpensDirective> opens = new ListBuffer<>();
+                        int nopens = nextChar();
+                        if (nopens != 0 && msym.flags.contains(ModuleFlags.OPEN)) {
+                            throw badClassFile("module.non.zero.opens", currentModule.name);
+                        }
+                        for (int i = 0; i < nopens; i++) {
+                            Name n = readName(nextChar());
+                            PackageSymbol p = syms.enterPackage(currentModule, names.fromUtf(internalize(n)));
+                            Set<OpensFlag> flags = readOpensFlags(nextChar());
+                            int nto = nextChar();
+                            List<ModuleSymbol> to;
+                            if (nto == 0) {
+                                to = null;
+                            } else {
+                                ListBuffer<ModuleSymbol> lb = new ListBuffer<>();
+                                for (int t = 0; t < nto; t++)
+                                    lb.append(syms.enterModule(readModuleName(nextChar())));
+                                to = lb.toList();
+                            }
+                            opens.add(new OpensDirective(p, to, flags));
+                        }
+                        msym.opens = opens.toList();
+                        directives.addAll(msym.opens);
 
                         msym.directives = directives.toList();
 
@@ -1271,17 +1358,21 @@
 
                         ListBuffer<InterimProvidesDirective> provides = new ListBuffer<>();
                         int nprovides = nextChar();
-                        for (int i = 0; i < nprovides; i++) {
+                        for (int p = 0; p < nprovides; p++) {
                             Name srvc = readClassName(nextChar());
-                            Name impl = readClassName(nextChar());
-                            provides.add(new InterimProvidesDirective(srvc, impl));
+                            int nimpls = nextChar();
+                            ListBuffer<Name> impls = new ListBuffer<>();
+                            for (int i = 0; i < nimpls; i++) {
+                                impls.append(readClassName(nextChar()));
+                            provides.add(new InterimProvidesDirective(srvc, impls.toList()));
+                            }
                         }
                         interimProvides = provides.toList();
                     }
                 }
             },
 
-            new AttributeReader(names.Version, V53, CLASS_ATTRIBUTE) {
+            new AttributeReader(names.ModuleVersion, V53, CLASS_ATTRIBUTE) {
                 @Override
                 protected boolean accepts(AttributeKind kind) {
                     return super.accepts(kind) && allowModules;
@@ -1480,7 +1571,7 @@
                     } else if (proxy.type.tsym == syms.repeatableType.tsym) {
                         repeatable = proxy;
                     } else if (proxy.type.tsym == syms.deprecatedType.tsym) {
-                        sym.flags_field |= DEPRECATED;
+                        sym.flags_field |= (DEPRECATED | DEPRECATED_ANNOTATION);
                         for (Pair<Name, Attribute> v : proxy.values) {
                             if (v.fst == names.forRemoval && v.snd instanceof Attribute.Constant) {
                                 Attribute.Constant c = (Attribute.Constant) v.snd;
@@ -1547,7 +1638,7 @@
         // support preliminary jsr175-format class files
         if (buf[poolIdx[i]] == CONSTANT_Class)
             return readClassSymbol(i).type;
-        return readType(i);
+        return readTypeToProxy(i);
     }
     Type readEnumType(int i) {
         // support preliminary jsr175-format class files
@@ -1555,11 +1646,25 @@
         int length = getChar(index + 1);
         if (buf[index + length + 2] != ';')
             return enterClass(readName(i)).type;
-        return readType(i);
+        return readTypeToProxy(i);
+    }
+    Type readTypeToProxy(int i) {
+        if (currentModule.module_info == currentOwner) {
+            int index = poolIdx[i];
+            return new ProxyType(Arrays.copyOfRange(buf, index + 3, index + 3 + getChar(index + 1)));
+        } else {
+            return readType(i);
+        }
     }
 
     CompoundAnnotationProxy readCompoundAnnotation() {
-        Type t = readTypeOrClassSymbol(nextChar());
+        Type t;
+        if (currentModule.module_info == currentOwner) {
+            int index = poolIdx[nextChar()];
+            t = new ProxyType(Arrays.copyOfRange(buf, index + 3, index + 3 + getChar(index + 1)));
+        } else {
+            t = readTypeOrClassSymbol(nextChar());
+        }
         int numFields = nextChar();
         ListBuffer<Pair<Name,Attribute>> pairs = new ListBuffer<>();
         for (int i=0; i<numFields; i++) {
@@ -1800,7 +1905,7 @@
         case 'e':
             return new EnumAttributeProxy(readEnumType(nextChar()), readName(nextChar()));
         case 'c':
-            return new Attribute.Class(types, readTypeOrClassSymbol(nextChar()));
+            return new ClassAttributeProxy(readTypeOrClassSymbol(nextChar()));
         case '[': {
             int n = nextChar();
             ListBuffer<Attribute> l = new ListBuffer<>();
@@ -1817,6 +1922,7 @@
 
     interface ProxyVisitor extends Attribute.Visitor {
         void visitEnumAttributeProxy(EnumAttributeProxy proxy);
+        void visitClassAttributeProxy(ClassAttributeProxy proxy);
         void visitArrayAttributeProxy(ArrayAttributeProxy proxy);
         void visitCompoundAnnotationProxy(CompoundAnnotationProxy proxy);
     }
@@ -1836,6 +1942,19 @@
         }
     }
 
+    static class ClassAttributeProxy extends Attribute {
+        Type classType;
+        public ClassAttributeProxy(Type classType) {
+            super(null);
+            this.classType = classType;
+        }
+        public void accept(Visitor v) { ((ProxyVisitor)v).visitClassAttributeProxy(this); }
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public String toString() {
+            return "/*proxy class*/" + classType + ".class";
+        }
+    }
+
     static class ArrayAttributeProxy extends Attribute {
         List<Attribute> values;
         ArrayAttributeProxy(List<Attribute> values) {
@@ -1909,14 +2028,15 @@
         }
 
         Attribute.Compound deproxyCompound(CompoundAnnotationProxy a) {
+            Type annotationType = resolvePossibleProxyType(a.type);
             ListBuffer<Pair<Symbol.MethodSymbol,Attribute>> buf = new ListBuffer<>();
             for (List<Pair<Name,Attribute>> l = a.values;
                  l.nonEmpty();
                  l = l.tail) {
-                MethodSymbol meth = findAccessMethod(a.type, l.head.fst);
+                MethodSymbol meth = findAccessMethod(annotationType, l.head.fst);
                 buf.append(new Pair<>(meth, deproxy(meth.type.getReturnType(), l.head.snd)));
             }
-            return new Attribute.Compound(a.type, buf.toList());
+            return new Attribute.Compound(annotationType, buf.toList());
         }
 
         MethodSymbol findAccessMethod(Type container, Name name) {
@@ -2000,7 +2120,8 @@
 
         public void visitEnumAttributeProxy(EnumAttributeProxy proxy) {
             // type.tsym.flatName() should == proxy.enumFlatName
-            TypeSymbol enumTypeSym = proxy.enumType.tsym;
+            Type enumType = resolvePossibleProxyType(proxy.enumType);
+            TypeSymbol enumTypeSym = enumType.tsym;
             VarSymbol enumerator = null;
             CompletionFailure failure = null;
             try {
@@ -2030,6 +2151,12 @@
             }
         }
 
+        @Override
+        public void visitClassAttributeProxy(ClassAttributeProxy proxy) {
+            Type classType = resolvePossibleProxyType(proxy.classType);
+            result = new Attribute.Class(types, classType);
+        }
+
         public void visitArrayAttributeProxy(ArrayAttributeProxy proxy) {
             int length = proxy.values.length();
             Attribute[] ats = new Attribute[length];
@@ -2044,6 +2171,21 @@
         public void visitCompoundAnnotationProxy(CompoundAnnotationProxy proxy) {
             result = deproxyCompound(proxy);
         }
+
+        Type resolvePossibleProxyType(Type t) {
+            if (t instanceof ProxyType) {
+                Assert.check(requestingOwner.owner.kind == MDL);
+                ModuleSymbol prevCurrentModule = currentModule;
+                currentModule = (ModuleSymbol) requestingOwner.owner;
+                try {
+                    return ((ProxyType) t).resolve();
+                } finally {
+                    currentModule = prevCurrentModule;
+                }
+            } else {
+                return t;
+            }
+        }
     }
 
     class AnnotationDefaultCompleter extends AnnotationDeproxy implements Runnable {
@@ -2086,7 +2228,11 @@
         AnnotationCompleter(Symbol sym, List<CompoundAnnotationProxy> l) {
             super(currentOwner.kind == MTH
                     ? currentOwner.enclClass() : (ClassSymbol)currentOwner);
-            this.sym = sym;
+            if (sym.kind == TYP && sym.owner.kind == MDL) {
+                this.sym = sym.owner;
+            } else {
+                this.sym = sym;
+            }
             this.l = l;
             this.classFile = currentClassFile;
         }
@@ -2097,6 +2243,18 @@
             try {
                 currentClassFile = classFile;
                 List<Attribute.Compound> newList = deproxyCompoundList(l);
+                for (Attribute.Compound attr : newList) {
+                    if (attr.type.tsym == syms.deprecatedType.tsym) {
+                        sym.flags_field |= (DEPRECATED | DEPRECATED_ANNOTATION);
+                        Attribute forRemoval = attr.member(names.forRemoval);
+                        if (forRemoval instanceof Attribute.Constant) {
+                            Attribute.Constant c = (Attribute.Constant) forRemoval;
+                            if (c.type == syms.booleanType && ((Integer) c.value) != 0) {
+                                sym.flags_field |= DEPRECATED_REMOVAL;
+                            }
+                        }
+                    }
+                }
                 if (sym.annotationsPendingCompletion()) {
                     sym.setDeclarationAttributes(newList);
                 } else {
@@ -2407,15 +2565,22 @@
             }
         } else {
             c.flags_field = flags;
-            Name modInfoName = readModuleInfoName(nextChar());
             currentModule = (ModuleSymbol) c.owner;
-            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);
+            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;
             }
         }
 
@@ -2500,7 +2665,7 @@
 
         minorVersion = nextChar();
         majorVersion = nextChar();
-        int maxMajor = Version.MAX().major;
+        int maxMajor = 53; // Version.MAX().major;  //******* TEMPORARY *******
         int maxMinor = Version.MAX().minor;
         if (majorVersion > maxMajor ||
             majorVersion * 1000 + minorVersion <
@@ -2542,6 +2707,8 @@
                 List<Type> found = foundTypeVariables;
                 missingTypeVariables = List.nil();
                 foundTypeVariables = List.nil();
+                interimUses = List.nil();
+                interimProvides = List.nil();
                 filling = false;
                 ClassType ct = (ClassType)currentOwner.type;
                 ct.supertype_field =
@@ -2808,6 +2975,36 @@
         }
     }
 
+    private class ProxyType extends Type {
+
+        private final byte[] content;
+
+        public ProxyType(byte[] content) {
+            super(syms.noSymbol, TypeMetadata.EMPTY);
+            this.content = content;
+        }
+
+        @Override
+        public TypeTag getTag() {
+            return TypeTag.NONE;
+        }
+
+        @Override
+        public Type cloneWithMetadata(TypeMetadata metadata) {
+            throw new UnsupportedOperationException();
+        }
+
+        public Type resolve() {
+            return sigToType(content, 0, content.length);
+        }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public String toString() {
+            return "<ProxyType>";
+        }
+
+    }
+
     private static final class InterimUsesDirective {
         public final Name service;
 
@@ -2819,11 +3016,11 @@
 
     private static final class InterimProvidesDirective {
         public final Name service;
-        public final Name impl;
+        public final List<Name> impls;
 
-        public InterimProvidesDirective(Name service, Name impl) {
+        public InterimProvidesDirective(Name service, List<Name> impls) {
             this.service = service;
-            this.impl = impl;
+            this.impls = impls;
         }
 
     }
@@ -2852,8 +3049,12 @@
             currentModule.uses = uses.toList();
             ListBuffer<ProvidesDirective> provides = new ListBuffer<>();
             for (InterimProvidesDirective interim : interimProvidesCopy) {
+                ListBuffer<ClassSymbol> impls = new ListBuffer<>();
+                for (Name impl : interim.impls) {
+                    impls.append(syms.enterClass(currentModule, impl));
+                }
                 ProvidesDirective d = new ProvidesDirective(syms.enterClass(currentModule, interim.service),
-                                                            syms.enterClass(currentModule, interim.impl));
+                                                            impls.toList());
                 provides.add(d);
                 directives.add(d);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -30,6 +30,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 
 import javax.tools.JavaFileManager;
 import javax.tools.FileObject;
@@ -952,6 +953,10 @@
         ModuleSymbol m = (ModuleSymbol) c.owner;
 
         int alenIdx = writeAttr(names.Module);
+
+        databuf.appendChar(pool.put(names.fromUtf(externalize(m.name))));
+        databuf.appendChar(ModuleFlags.value(m.flags)); // module_flags
+
         ListBuffer<RequiresDirective> requires = new ListBuffer<>();
         for (RequiresDirective r: m.requires) {
             if (!r.flags.contains(RequiresFlag.EXTRA))
@@ -959,7 +964,7 @@
         }
         databuf.appendChar(requires.size());
         for (RequiresDirective r: requires) {
-            databuf.appendChar(pool.put(r.module.name));
+            databuf.appendChar(pool.put(names.fromUtf(externalize(r.module.name))));
             databuf.appendChar(RequiresFlag.value(r.flags));
         }
 
@@ -967,12 +972,29 @@
         databuf.appendChar(exports.size());
         for (ExportsDirective e: exports) {
             databuf.appendChar(pool.put(names.fromUtf(externalize(e.packge.flatName()))));
+            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(msym.name));
+                for (ModuleSymbol msym: e.modules) {
+                    databuf.appendChar(pool.put(names.fromUtf(externalize(msym.name))));
+                }
+            }
+        }
+
+        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(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))));
+                }
             }
         }
 
@@ -982,12 +1004,19 @@
             databuf.appendChar(pool.put(s.service));
         }
 
-        List<ProvidesDirective> services = m.provides;
-        databuf.appendChar(services.size());
-        for (ProvidesDirective s: services) {
-            databuf.appendChar(pool.put(s.service));
-            databuf.appendChar(pool.put(s.impl));
+        // temporary fix to merge repeated provides clause for same service;
+        // eventually this should be disallowed when analyzing the module,
+        // so that each service type only appears once.
+        Map<ClassSymbol, Set<ClassSymbol>> mergedProvides = new LinkedHashMap<>();
+        for (ProvidesDirective p : m.provides) {
+            mergedProvides.computeIfAbsent(p.service, s -> new LinkedHashSet<>()).addAll(p.impls);
         }
+        databuf.appendChar(mergedProvides.size());
+        mergedProvides.forEach((srvc, impls) -> {
+            databuf.appendChar(pool.put(srvc));
+            databuf.appendChar(impls.size());
+            impls.forEach(impl -> databuf.appendChar(pool.put(impl)));
+        });
 
         endAttr(alenIdx);
         return 1;
@@ -1688,7 +1717,11 @@
         }
         databuf.appendChar(flags);
 
-        databuf.appendChar(pool.put(c));
+        if (c.owner.kind == MDL) {
+            databuf.appendChar(0);
+        } else {
+            databuf.appendChar(pool.put(c));
+        }
         databuf.appendChar(supertype.hasTag(CLASS) ? pool.put(supertype.tsym) : 0);
         databuf.appendChar(interfaces.length());
         for (List<Type> l = interfaces; l.nonEmpty(); l = l.tail)
@@ -1766,12 +1799,20 @@
         acount += writeEnclosingMethodAttribute(c);
         if (c.owner.kind == MDL) {
             acount += writeModuleAttribute(c);
+            acount += writeFlagAttrs(c.owner.flags());
         }
         acount += writeExtraClassAttributes(c);
 
         poolbuf.appendInt(JAVA_MAGIC);
-        poolbuf.appendChar(target.minorVersion);
-        poolbuf.appendChar(target.majorVersion);
+
+        if (c.owner.kind == MDL) {
+            // temporarily overide to force use of v53 for module-info.class
+            poolbuf.appendChar(0);
+            poolbuf.appendChar(53);
+        } else {
+            poolbuf.appendChar(target.minorVersion);
+            poolbuf.appendChar(target.majorVersion);
+        }
 
         writePool(c.pool);
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ModuleNameReader.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ModuleNameReader.java	Thu Dec 01 09:02:42 2016 +0000
@@ -31,8 +31,6 @@
 
 import javax.tools.JavaFileObject;
 
-import com.sun.tools.javac.jvm.ClassFile;
-
 import static com.sun.tools.javac.jvm.ClassFile.*;
 
 
@@ -93,11 +91,44 @@
 
         int minorVersion = nextChar();
         int majorVersion = nextChar();
+        if (majorVersion < 53)
+            throw new BadClassFile("bad major version number for module: " + majorVersion);
 
         indexPool();
 
-        int accessflags = nextChar();
-        return readModuleInfoName(nextChar());
+        int access_flags = nextChar();
+        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;
+                }
+            }
+            throw new BadClassFile("no Module attribute");
+        } else {
+            // old form
+            return readModuleInfoName(this_class);
+        }
+    }
+
+    void checkZero(int count, String name) throws BadClassFile {
+        if (count != 0)
+            throw new BadClassFile("invalid " + name + " for module: " + count);
     }
 
     /** Extract a character at position bp from buf.
@@ -166,6 +197,20 @@
         }
     }
 
+    String getUtf8Value(int index, boolean internalize) throws BadClassFile {
+        int utf8Index = poolIdx[index];
+        if (buf[utf8Index] == CONSTANT_Utf8) {
+            int len = getChar(utf8Index + 1);
+            int start = utf8Index + 3;
+            if (internalize) {
+                return new String(ClassFile.internalize(buf, start, len));
+            } else {
+                return new String(buf, start, len);
+            }
+        }
+        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.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Thu Dec 01 09:02:42 2016 +0000
@@ -608,8 +608,9 @@
             log.error(Errors.ProcessorpathNoProcessormodulepath);
         }
 
-        if (obsoleteOptionFound)
+        if (obsoleteOptionFound && lintOptions) {
             log.warning(LintCategory.OPTIONS, "option.obsolete.suppression");
+        }
 
         SourceVersion sv = Source.toSourceVersion(source);
         validateAddExports(sv);
@@ -617,6 +618,10 @@
         validateAddReads(sv);
         validateLimitModules(sv);
 
+        if (lintOptions && options.isSet(Option.ADD_OPENS)) {
+            log.warning(LintCategory.OPTIONS, Warnings.AddopensIgnored);
+        }
+
         return !errors && (log.nerrors == 0);
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Thu Dec 01 09:02:42 2016 +0000
@@ -584,6 +584,8 @@
         }
     },
 
+    ADD_OPENS("--add-opens", null, null, HIDDEN, BASIC),
+
     ADD_READS("--add-reads", "opt.arg.addReads", "opt.addReads", EXTENDED, BASIC) {
         @Override
         public boolean process(OptionHelper helper, String option, String arg) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Thu Dec 01 09:02:42 2016 +0000
@@ -375,7 +375,8 @@
     @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isDeprecated(Element e) {
         Symbol sym = cast(Symbol.class, e);
-        return (sym.flags() & Flags.DEPRECATED) != 0;
+        sym.complete();
+        return sym.isDeprecated();
     }
 
     @DefinedBy(Api.LANGUAGE_MODEL)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Dec 01 09:02:42 2016 +0000
@@ -29,6 +29,7 @@
 import java.util.stream.Collectors;
 
 import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
+import com.sun.source.tree.ModuleTree.ModuleKind;
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.parser.Tokens.*;
@@ -51,7 +52,6 @@
 import static com.sun.tools.javac.parser.Tokens.TokenKind.IMPORT;
 import static com.sun.tools.javac.parser.Tokens.TokenKind.LT;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
-import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
 
 /** The parser maps a token sequence into an abstract syntax
  *  tree. It operates by recursive descent, with code derived
@@ -3105,65 +3105,78 @@
         Token firstToken = token;
         JCModifiers mods = null;
         boolean consumedToplevelDoc = false;
+        boolean seenImport = false;
+        boolean seenPackage = false;
         ListBuffer<JCTree> defs = new ListBuffer<>();
-
-        if (token.kind == IDENTIFIER && token.name() == names.module) {
-            defs.append(moduleDecl(token.comment(CommentStyle.JAVADOC)));
+        if (token.kind == MONKEYS_AT)
+            mods = modifiersOpt();
+
+        if (token.kind == PACKAGE) {
+            int packagePos = token.pos;
+            List<JCAnnotation> annotations = List.nil();
+            seenPackage = true;
+            if (mods != null) {
+                checkNoMods(mods.flags);
+                annotations = mods.annotations;
+                mods = null;
+            }
+            nextToken();
+            JCExpression pid = qualident(false);
+            accept(SEMI);
+            JCPackageDecl pd = F.at(packagePos).PackageDecl(annotations, pid);
+            attach(pd, firstToken.comment(CommentStyle.JAVADOC));
             consumedToplevelDoc = true;
-        } else {
-            boolean seenImport = false;
-            boolean seenPackage = false;
-            if (token.kind == MONKEYS_AT)
-                mods = modifiersOpt();
-
-            if (token.kind == PACKAGE) {
-                int packagePos = token.pos;
-                List<JCAnnotation> annotations = List.nil();
-                seenPackage = true;
-                if (mods != null) {
-                    checkNoMods(mods.flags);
-                    annotations = mods.annotations;
-                    mods = null;
+            storeEnd(pd, token.pos);
+            defs.append(pd);
+        }
+
+        boolean checkForImports = true;
+        boolean firstTypeDecl = true;
+        while (token.kind != EOF) {
+            if (token.pos <= endPosTable.errorEndPos) {
+                // error recovery
+                skip(checkForImports, false, false, false);
+                if (token.kind == EOF)
+                    break;
+            }
+            if (checkForImports && mods == null && token.kind == IMPORT) {
+                seenImport = true;
+                defs.append(importDeclaration());
+            } else {
+                Comment docComment = token.comment(CommentStyle.JAVADOC);
+                if (firstTypeDecl && !seenImport && !seenPackage) {
+                    docComment = firstToken.comment(CommentStyle.JAVADOC);
+                    consumedToplevelDoc = true;
                 }
-                nextToken();
-                JCExpression pid = qualident(false);
-                accept(SEMI);
-                JCPackageDecl pd = F.at(packagePos).PackageDecl(annotations, pid);
-                attach(pd, firstToken.comment(CommentStyle.JAVADOC));
-                consumedToplevelDoc = true;
-                storeEnd(pd, token.pos);
-                defs.append(pd);
-            }
-            boolean checkForImports = true;
-            boolean firstTypeDecl = true;
-            while (token.kind != EOF) {
-                if (token.pos <= endPosTable.errorEndPos) {
-                    // error recovery
-                    skip(checkForImports, false, false, false);
-                    if (token.kind == EOF)
+                if (mods != null || token.kind != SEMI)
+                    mods = modifiersOpt(mods);
+                if (firstTypeDecl && token.kind == IDENTIFIER) {
+                    ModuleKind kind = ModuleKind.STRONG;
+                    if (token.name() == names.open) {
+                        kind = ModuleKind.OPEN;
+                        nextToken();
+                    }
+                    if (token.kind == IDENTIFIER && token.name() == names.module) {
+                        if (mods != null) {
+                            checkNoMods(mods.flags & ~Flags.DEPRECATED);
+                        }
+                        defs.append(moduleDecl(mods, kind, docComment));
+                        consumedToplevelDoc = true;
                         break;
+                    } else if (kind != ModuleKind.STRONG) {
+                        reportSyntaxError(token.pos, "expected.module");
+                    }
                 }
-                if (checkForImports && mods == null && token.kind == IMPORT) {
-                    seenImport = true;
-                    defs.append(importDeclaration());
-                } else {
-                    Comment docComment = token.comment(CommentStyle.JAVADOC);
-                    if (firstTypeDecl && !seenImport && !seenPackage) {
-                        docComment = firstToken.comment(CommentStyle.JAVADOC);
-                        consumedToplevelDoc = true;
-                    }
-                    JCTree def = typeDeclaration(mods, docComment);
-                    if (def instanceof JCExpressionStatement)
-                        def = ((JCExpressionStatement)def).expr;
-                    defs.append(def);
-                    if (def instanceof JCClassDecl)
-                        checkForImports = false;
-                    mods = null;
-                    firstTypeDecl = false;
-                }
+                JCTree def = typeDeclaration(mods, docComment);
+                if (def instanceof JCExpressionStatement)
+                    def = ((JCExpressionStatement)def).expr;
+                defs.append(def);
+                if (def instanceof JCClassDecl)
+                    checkForImports = false;
+                mods = null;
+                firstTypeDecl = false;
             }
         }
-
         JCTree.JCCompilationUnit toplevel = F.at(firstToken.pos).TopLevel(defs.toList());
         if (!consumedToplevelDoc)
             attach(toplevel, firstToken.comment(CommentStyle.JAVADOC));
@@ -3178,7 +3191,7 @@
         return toplevel;
     }
 
-    JCModuleDecl moduleDecl(Comment dc) {
+    JCModuleDecl moduleDecl(JCModifiers mods, ModuleKind kind, Comment dc) {
         int pos = token.pos;
         if (!allowModules) {
             log.error(pos, Errors.ModulesNotSupportedInSource(source.name));
@@ -3194,7 +3207,7 @@
         accept(RBRACE);
         accept(EOF);
 
-        JCModuleDecl result = toP(F.at(pos).ModuleDef(name, directives));
+        JCModuleDecl result = toP(F.at(pos).ModuleDef(mods, kind, name, directives));
         attach(result, dc);
         return result;
     }
@@ -3205,15 +3218,38 @@
             int pos = token.pos;
             if (token.name() == names.requires) {
                 nextToken();
-                boolean isPublic = false;
-                if (token.kind == PUBLIC) {
-                    isPublic = true;
+                boolean isTransitive = false;
+                boolean isStaticPhase = false;
+            loop:
+                while (true) {
+                    switch (token.kind) {
+                        case IDENTIFIER:
+                            if (token.name() == names.transitive && !isTransitive) {
+                                Token t1 = S.token(1);
+                                if (t1.kind == SEMI || t1.kind == DOT) {
+                                    break loop;
+                                }
+                                isTransitive = true;
+                                break;
+                            } else {
+                                break loop;
+                            }
+                        case STATIC:
+                            if (isStaticPhase) {
+                                error(token.pos, "repeated.modifier");
+                            }
+                            isStaticPhase = true;
+                            break;
+                        default:
+                            break loop;
+                    }
                     nextToken();
                 }
                 JCExpression moduleName = qualident(false);
                 accept(SEMI);
-                defs.append(toP(F.at(pos).Requires(isPublic, moduleName)));
-            } else if (token.name() == names.exports) {
+                defs.append(toP(F.at(pos).Requires(isTransitive, isStaticPhase, moduleName)));
+            } else if (token.name() == names.exports || token.name() == names.opens) {
+                boolean exports = token.name() == names.exports;
                 nextToken();
                 JCExpression pkgName = qualident(false);
                 List<JCExpression> moduleNames = null;
@@ -3222,15 +3258,21 @@
                     moduleNames = qualidentList(false);
                 }
                 accept(SEMI);
-                defs.append(toP(F.at(pos).Exports(pkgName, moduleNames)));
+                JCDirective d;
+                if (exports) {
+                    d = F.at(pos).Exports(pkgName, moduleNames);
+                } else {
+                    d = F.at(pos).Opens(pkgName, moduleNames);
+                }
+                defs.append(toP(d));
             } else if (token.name() == names.provides) {
                 nextToken();
                 JCExpression serviceName = qualident(false);
                 if (token.kind == IDENTIFIER && token.name() == names.with) {
                     nextToken();
-                    JCExpression implName = qualident(false);
+                    List<JCExpression> implNames = qualidentList(false);
                     accept(SEMI);
-                    defs.append(toP(F.at(pos).Provides(serviceName, implName)));
+                    defs.append(toP(F.at(pos).Provides(serviceName, implNames)));
                 } else {
                     error(token.pos, "expected", "'" + names.with + "'");
                     skip(false, false, false, false);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -872,6 +872,9 @@
 compiler.err.pkg.annotations.sb.in.package-info.java=\
     package annotations should be in file package-info.java
 
+compiler.err.no.pkg.in.module-info.java=\
+    package clauses should not be in file module-info.java
+
 # 0: symbol
 compiler.err.pkg.clashes.with.class.of.same.name=\
     package {0} clashes with class of same name
@@ -1463,6 +1466,14 @@
     {0} in {1} has been deprecated and marked for removal
 
 # 0: symbol
+compiler.warn.has.been.deprecated.module=\
+    module {0} has been deprecated
+
+# 0: symbol
+compiler.warn.has.been.deprecated.for.removal.module=\
+    module {0} has been deprecated and marked for removal
+
+# 0: symbol
 compiler.warn.sun.proprietary=\
     {0} is internal proprietary API and may be removed in a future release
 
@@ -1796,6 +1807,9 @@
     reached end of file while parsing
 
 ## The following are related in form, but do not easily fit the above paradigm.
+compiler.err.expected.module=\
+    ''module'' expected
+
 compiler.err.dot.class.expected=\
     ''.class'' expected
 
@@ -2747,8 +2761,23 @@
     duplicate requires: {0}
 
 # 0: symbol
-compiler.err.duplicate.exports=\
-    duplicate export: {0}
+compiler.err.conflicting.exports=\
+    duplicate or conflicting exports: {0}
+
+# 0: symbol
+compiler.err.conflicting.opens=\
+    duplicate or conflicting opens: {0}
+
+# 0: symbol
+compiler.err.conflicting.exports.to.module=\
+    duplicate or conflicting exports to module: {0}
+
+# 0: symbol
+compiler.err.conflicting.opens.to.module=\
+    duplicate or conflicting opens to module: {0}
+
+compiler.err.no.opens.unless.strong=\
+    ''opens'' only allowed in strong modules
 
 # 0: symbol, 1: symbol
 compiler.err.duplicate.provides=\
@@ -2763,7 +2792,11 @@
     the service implementation is an abstract class: {0}
 
 compiler.err.service.implementation.must.be.subtype.of.service.interface=\
-    the service implementation type must be a subtype of the service interface type
+    the service implementation type must be a subtype of the service interface type, or \
+    have a public static no-args method named "provider" returning the service implementation
+
+compiler.err.service.implementation.provider.return.must.be.subtype.of.service.interface=\
+    the "provider" method return type must be a subtype of the service interface type
 
 # 0: symbol
 compiler.err.service.implementation.is.inner=\
@@ -2799,6 +2832,14 @@
 compiler.misc.module.name.mismatch=\
     module name {0} does not match expected name {1}
 
+# 0: name
+compiler.err.module.non.zero.opens=\
+    open module {0} has non-zero opens_count
+
+# 0: name
+compiler.misc.module.non.zero.opens=\
+    open module {0} has non-zero opens_count
+
 compiler.err.module.decl.sb.in.module-info.java=\
     module declarations should be in a file named module-info.java
 
@@ -2855,6 +2896,9 @@
 compiler.err.addmods.all.module.path.invalid=\
     --add-modules ALL-MODULE-PATH can only be used when compiling the unnamed module
 
+compiler.warn.addopens.ignored=\
+    --add-opens has no effect at compile time
+
 compiler.misc.locn.module_source_path=\
     module source path
 
@@ -2885,8 +2929,8 @@
 compiler.warn.leaks.not.accessible.unexported=\
     {0} {1} in module {2} is not exported
 # 0: kind name, 1: symbol, 2: symbol
-compiler.warn.leaks.not.accessible.not.required.public=\
-    {0} {1} in module {2} is not indirectly exported using 'requires public'
+compiler.warn.leaks.not.accessible.not.required.transitive=\
+    {0} {1} in module {2} is not indirectly exported using 'requires transitive'
 # 0: kind name, 1: symbol, 2: symbol
 compiler.warn.leaks.not.accessible.unexported.qualified=\
     {0} {1} in module {2} may not be visible to all clients that require this module
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -841,7 +841,7 @@
 
 ## All errors which do not refer to a particular line in the source code are
 ## preceded by this string.
-compiler.err.error=\u30A8\u30E9\u30FC: 
+compiler.err.error=\u30A8\u30E9\u30FC:
 
 # The following error messages do not refer to a line in the source code.
 compiler.err.cant.read.file={0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093
@@ -1021,7 +1021,7 @@
 ## Warning messages may also include the following prefix to identify a
 ## lint option
 # 0: option name
-compiler.warn.lintOption=[{0}] 
+compiler.warn.lintOption=[{0}]
 
 # 0: symbol
 compiler.warn.constant.SVUID=serialVersionUID\u306F\u30AF\u30E9\u30B9{0}\u306E\u5B9A\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -841,7 +841,7 @@
 
 ## All errors which do not refer to a particular line in the source code are
 ## preceded by this string.
-compiler.err.error=\u9519\u8BEF: 
+compiler.err.error=\u9519\u8BEF:
 
 # The following error messages do not refer to a line in the source code.
 compiler.err.cant.read.file=\u65E0\u6CD5\u8BFB\u53D6: {0}
@@ -927,7 +927,7 @@
 # 0: boolean, 1: symbol
 compiler.note.mref.stat.1=\u8F6C\u6362\u65B9\u6CD5\u5F15\u7528\n\u66FF\u4EE3 metafactory = {0}\nbridge \u65B9\u6CD5 = {1}
 
-compiler.note.note=\u6CE8: 
+compiler.note.note=\u6CE8:
 
 # 0: file name
 compiler.note.deprecated.filename={0}\u4F7F\u7528\u6216\u8986\u76D6\u4E86\u5DF2\u8FC7\u65F6\u7684 API\u3002
@@ -1016,12 +1016,12 @@
 ##
 
 ## All warning messages are preceded by the following string.
-compiler.warn.warning=\u8B66\u544A: 
+compiler.warn.warning=\u8B66\u544A:
 
 ## Warning messages may also include the following prefix to identify a
 ## lint option
 # 0: option name
-compiler.warn.lintOption=[{0}] 
+compiler.warn.lintOption=[{0}]
 
 # 0: symbol
 compiler.warn.constant.SVUID=serialVersionUID \u5728\u7C7B{0}\u4E2D\u5FC5\u987B\u662F\u5E38\u91CF
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Dec 01 09:02:42 2016 +0000
@@ -47,7 +47,10 @@
 
 import javax.tools.JavaFileManager.Location;
 
+import com.sun.source.tree.ModuleTree.ModuleKind;
 import com.sun.tools.javac.code.Directive.ExportsDirective;
+import com.sun.tools.javac.code.Directive.OpensDirective;
+import com.sun.tools.javac.code.Type.ModuleType;
 
 /**
  * Root class for abstract syntax tree nodes. It provides definitions
@@ -352,6 +355,7 @@
 
         MODULEDEF,
         EXPORTS,
+        OPENS,
         PROVIDES,
         REQUIRES,
         USES,
@@ -527,6 +531,16 @@
         @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.COMPILATION_UNIT; }
 
+        public JCModuleDecl getModuleDecl() {
+            for (JCTree tree : defs) {
+                if (tree.hasTag(MODULEDEF)) {
+                    return (JCModuleDecl) tree;
+                }
+            }
+
+            return null;
+        }
+
         @DefinedBy(Api.COMPILER_TREE)
         public JCPackageDecl getPackage() {
             // PackageDecl must be the first entry if it exists
@@ -2619,11 +2633,17 @@
     }
 
     public static class JCModuleDecl extends JCTree implements ModuleTree {
+        public JCModifiers mods;
+        public ModuleType type;
+        private final ModuleKind kind;
         public JCExpression qualId;
         public List<JCDirective> directives;
         public ModuleSymbol sym;
 
-        protected JCModuleDecl(JCExpression qualId, List<JCDirective> directives) {
+        protected JCModuleDecl(JCModifiers mods, ModuleKind kind,
+                JCExpression qualId, List<JCDirective> directives) {
+            this.mods = mods;
+            this.kind = kind;
             this.qualId = qualId;
             this.directives = directives;
         }
@@ -2637,6 +2657,16 @@
         }
 
         @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<? extends AnnotationTree> getAnnotations() {
+            return mods.annotations;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public ModuleKind getModuleType() {
+            return kind;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getName() {
             return qualId;
         }
@@ -2677,7 +2707,7 @@
         }
 
         @Override @DefinedBy(Api.COMPILER_TREE)
-        public JCExpression getExportName() {
+        public JCExpression getPackageName() {
             return qualid;
         }
 
@@ -2693,18 +2723,58 @@
 
         @Override
         public Tag getTag() {
-            return EXPORTS;
+            return Tag.EXPORTS;
+        }
+    }
+
+    public static class JCOpens extends JCDirective
+            implements OpensTree {
+        public JCExpression qualid;
+        public List<JCExpression> moduleNames;
+        public OpensDirective directive;
+
+        protected JCOpens(JCExpression qualId, List<JCExpression> moduleNames) {
+            this.qualid = qualId;
+            this.moduleNames = moduleNames;
+        }
+
+        @Override
+        public void accept(Visitor v) { v.visitOpens(this); }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Kind getKind() {
+            return Kind.OPENS;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public JCExpression getPackageName() {
+            return qualid;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<JCExpression> getModuleNames() {
+            return moduleNames;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public <R, D> R accept(TreeVisitor<R, D> v, D d) {
+            return v.visitOpens(this, d);
+        }
+
+        @Override
+        public Tag getTag() {
+            return Tag.OPENS;
         }
     }
 
     public static class JCProvides extends JCDirective
             implements ProvidesTree {
         public JCExpression serviceName;
-        public JCExpression implName;
+        public List<JCExpression> implNames;
 
-        protected JCProvides(JCExpression serviceName, JCExpression implName) {
+        protected JCProvides(JCExpression serviceName, List<JCExpression> implNames) {
             this.serviceName = serviceName;
-            this.implName = implName;
+            this.implNames = implNames;
         }
 
         @Override
@@ -2726,8 +2796,8 @@
         }
 
         @Override @DefinedBy(Api.COMPILER_TREE)
-        public JCExpression getImplementationName() {
-            return implName;
+        public List<JCExpression> getImplementationNames() {
+            return implNames;
         }
 
         @Override
@@ -2738,12 +2808,14 @@
 
     public static class JCRequires extends JCDirective
             implements RequiresTree {
-        public boolean isPublic;
+        public boolean isTransitive;
+        public boolean isStaticPhase;
         public JCExpression moduleName;
         public RequiresDirective directive;
 
-        protected JCRequires(boolean isPublic, JCExpression moduleName) {
-            this.isPublic = isPublic;
+        protected JCRequires(boolean isTransitive, boolean isStaticPhase, JCExpression moduleName) {
+            this.isTransitive = isTransitive;
+            this.isStaticPhase = isStaticPhase;
             this.moduleName = moduleName;
         }
 
@@ -2761,8 +2833,13 @@
         }
 
         @Override @DefinedBy(Api.COMPILER_TREE)
-        public boolean isPublic() {
-            return isPublic;
+        public boolean isTransitive() {
+            return isTransitive;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public boolean isStatic() {
+            return isStaticPhase;
         }
 
         @Override @DefinedBy(Api.COMPILER_TREE)
@@ -2946,10 +3023,11 @@
         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
         JCErroneous Erroneous(List<? extends JCTree> errs);
-        JCModuleDecl ModuleDef(JCExpression qualId, List<JCDirective> directives);
+        JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind, JCExpression qualId, List<JCDirective> directives);
         JCExports Exports(JCExpression qualId, List<JCExpression> moduleNames);
-        JCProvides Provides(JCExpression serviceName, JCExpression implName);
-        JCRequires Requires(boolean isPublic, JCExpression qualId);
+        JCOpens Opens(JCExpression qualId, List<JCExpression> moduleNames);
+        JCProvides Provides(JCExpression serviceName, List<JCExpression> implNames);
+        JCRequires Requires(boolean isTransitive, boolean isStaticPhase, JCExpression qualId);
         JCUses Uses(JCExpression qualId);
         LetExpr LetExpr(List<JCVariableDecl> defs, JCExpression expr);
     }
@@ -3013,6 +3091,7 @@
         public void visitErroneous(JCErroneous that)         { visitTree(that); }
         public void visitModuleDef(JCModuleDecl that)        { visitTree(that); }
         public void visitExports(JCExports that)             { visitTree(that); }
+        public void visitOpens(JCOpens that)                 { visitTree(that); }
         public void visitProvides(JCProvides that)           { visitTree(that); }
         public void visitRequires(JCRequires that)           { visitTree(that); }
         public void visitUses(JCUses that)                   { visitTree(that); }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,6 +28,7 @@
 import java.io.*;
 
 import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
+import com.sun.source.tree.ModuleTree.ModuleKind;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
@@ -441,6 +442,10 @@
     @Override
     public void visitModuleDef(JCModuleDecl tree) {
         try {
+            printAnnotations(tree.mods.annotations);
+            if (tree.getModuleType() == ModuleKind.OPEN) {
+                print("open ");
+            }
             print("module ");
             printExpr(tree.qualId);
             if (tree.directives == null) {
@@ -457,7 +462,11 @@
     @Override
     public void visitExports(JCExports tree) {
         try {
-            print("exports ");
+            if (tree.hasTag(EXPORTS)) {
+                print("exports ");
+            } else {
+                print("opens ");
+            }
             printExpr(tree.qualid);
             if (tree.moduleNames != null) {
                 print(" to ");
@@ -475,7 +484,7 @@
             print("provides ");
             printExpr(tree.serviceName);
             print(" with ");
-            printExpr(tree.implName);
+            printExprs(tree.implNames);
             print(";");
         } catch (IOException e) {
             throw new UncheckedIOException(e);
@@ -486,8 +495,10 @@
     public void visitRequires(JCRequires tree) {
         try {
             print("requires ");
-            if (tree.isPublic)
-                print("public ");
+            if (tree.isStaticPhase)
+                print("static ");
+            if (tree.isTransitive)
+                print("transitive ");
             printExpr(tree.moduleName);
             print(";");
         } catch (IOException e) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,6 +26,7 @@
 package com.sun.tools.javac.tree;
 
 import com.sun.source.tree.*;
+import com.sun.source.tree.Tree.Kind;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
@@ -508,9 +509,10 @@
     @Override @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitModule(ModuleTree node, P p) {
         JCModuleDecl t = (JCModuleDecl) node;
+        JCModifiers mods = copy(t.mods, p);
         JCExpression qualId = copy(t.qualId);
         List<JCDirective> directives = copy(t.directives);
-        return M.at(t.pos).ModuleDef(qualId, directives);
+        return M.at(t.pos).ModuleDef(mods, t.getModuleType(), qualId, directives);
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
@@ -522,18 +524,26 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public JCOpens visitOpens(OpensTree node, P p) {
+        JCOpens t = (JCOpens) node;
+        JCExpression qualId = copy(t.qualid, p);
+        List<JCExpression> moduleNames = copy(t.moduleNames, p);
+        return M.at(t.pos).Opens(qualId, moduleNames);
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public JCProvides visitProvides(ProvidesTree node, P p) {
         JCProvides t = (JCProvides) node;
         JCExpression serviceName = copy(t.serviceName, p);
-        JCExpression implName = copy(t.implName, p);
-        return M.at(t.pos).Provides(serviceName, implName);
+        List<JCExpression> implNames = copy(t.implNames, p);
+        return M.at(t.pos).Provides(serviceName, implNames);
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
     public JCRequires visitRequires(RequiresTree node, P p) {
         JCRequires t = (JCRequires) node;
         JCExpression moduleName = copy(t.moduleName, p);
-        return M.at(t.pos).Requires(t.isPublic, moduleName);
+        return M.at(t.pos).Requires(t.isTransitive, t.isStaticPhase, moduleName);
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Dec 01 09:02:42 2016 +0000
@@ -378,6 +378,11 @@
             return Position.NOPOS;
 
         switch(tree.getTag()) {
+            case MODULEDEF: {
+                JCModuleDecl md = (JCModuleDecl)tree;
+                return md.mods.annotations.isEmpty() ? md.pos :
+                       md.mods.annotations.head.pos;
+            }
             case PACKAGEDEF: {
                 JCPackageDecl pd = (JCPackageDecl)tree;
                 return pd.annotations.isEmpty() ? pd.pos :
@@ -769,8 +774,9 @@
         switch (node.getTag()) {
         case TOPLEVEL:
             JCCompilationUnit cut = (JCCompilationUnit) node;
-            if (isModuleInfo(cut) && cut.defs.nonEmpty() && cut.defs.head.hasTag(MODULEDEF))
-                return symbolFor(cut.defs.head);
+            JCModuleDecl moduleDecl = cut.getModuleDecl();
+            if (isModuleInfo(cut) && moduleDecl != null)
+                return symbolFor(moduleDecl);
             return cut.packge;
         case MODULEDEF:
             return ((JCModuleDecl) node).sym;
@@ -1076,6 +1082,11 @@
         case TYPE_ANNOTATION:
             return Tree.Kind.TYPE_ANNOTATION;
 
+        case EXPORTS:
+            return Tree.Kind.EXPORTS;
+        case OPENS:
+            return Tree.Kind.OPENS;
+
         default:
             return null;
         }
@@ -1158,7 +1169,7 @@
 
     public static boolean isModuleInfo(JCCompilationUnit tree) {
         return tree.sourcefile.isNameCompatible("module-info", JavaFileObject.Kind.SOURCE)
-                && tree.defs.nonEmpty() && tree.defs.head.hasTag(MODULEDEF);
+                && tree.getModuleDecl() != null;
     }
 
     public static JCModuleDecl getModule(JCCompilationUnit t) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,6 +27,8 @@
 
 import java.util.Iterator;
 
+import com.sun.source.tree.ModuleTree.ModuleKind;
+import com.sun.source.tree.Tree.Kind;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
@@ -538,8 +540,9 @@
     }
 
     @Override
-    public JCModuleDecl ModuleDef(JCExpression qualid, List<JCDirective> directives) {
-        JCModuleDecl tree = new JCModuleDecl(qualid, directives);
+    public JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind,
+            JCExpression qualid, List<JCDirective> directives) {
+        JCModuleDecl tree = new JCModuleDecl(mods, kind, qualid, directives);
         tree.pos = pos;
         return tree;
     }
@@ -552,15 +555,22 @@
     }
 
     @Override
-    public JCProvides Provides(JCExpression serviceName, JCExpression implName) {
-        JCProvides tree = new JCProvides(serviceName, implName);
+    public JCOpens Opens(JCExpression qualId, List<JCExpression> moduleNames) {
+        JCOpens tree = new JCOpens(qualId, moduleNames);
         tree.pos = pos;
         return tree;
     }
 
     @Override
-    public JCRequires Requires(boolean isPublic, JCExpression qualId) {
-        JCRequires tree = new JCRequires(isPublic, qualId);
+    public JCProvides Provides(JCExpression serviceName, List<JCExpression> implNames) {
+        JCProvides tree = new JCProvides(serviceName, implNames);
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override
+    public JCRequires Requires(boolean isTransitive, boolean isStaticPhase, JCExpression qualId) {
+        JCRequires tree = new JCRequires(isTransitive, isStaticPhase, qualId);
         tree.pos = pos;
         return tree;
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -73,6 +73,7 @@
 
     @Override
     public void visitModuleDef(JCModuleDecl tree) {
+        scan(tree.mods);
         scan(tree.qualId);
         scan(tree.directives);
     }
@@ -84,9 +85,15 @@
     }
 
     @Override
+    public void visitOpens(JCOpens tree) {
+        scan(tree.qualid);
+        scan(tree.moduleNames);
+    }
+
+    @Override
     public void visitProvides(JCProvides tree) {
         scan(tree.serviceName);
-        scan(tree.implName);
+        scan(tree.implNames);
     }
 
     @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java	Thu Dec 01 09:02:42 2016 +0000
@@ -51,4 +51,5 @@
             from.addExports(pack, to);
         }
     }
-}
\ No newline at end of file
+}
+
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Thu Dec 01 09:02:42 2016 +0000
@@ -64,11 +64,14 @@
     public final Name _super;
     public final Name _this;
     public final Name exports;
+    public final Name opens;
     public final Name module;
     public final Name provides;
     public final Name requires;
     public final Name to;
+    public final Name transitive;
     public final Name uses;
+    public final Name open;
     public final Name with;
 
     // field and method names
@@ -101,6 +104,7 @@
     public final Name length;
     public final Name next;
     public final Name ordinal;
+    public final Name provider;
     public final Name serialVersionUID;
     public final Name toString;
     public final Name value;
@@ -146,6 +150,7 @@
     public final Name LocalVariableTypeTable;
     public final Name MethodParameters;
     public final Name Module;
+    public final Name ModuleVersion;
     public final Name RuntimeInvisibleAnnotations;
     public final Name RuntimeInvisibleParameterAnnotations;
     public final Name RuntimeInvisibleTypeAnnotations;
@@ -160,7 +165,6 @@
     public final Name Synthetic;
     public final Name Value;
     public final Name Varargs;
-    public final Name Version;
 
     // members of java.lang.annotation.ElementType
     public final Name ANNOTATION_TYPE;
@@ -168,6 +172,7 @@
     public final Name FIELD;
     public final Name LOCAL_VARIABLE;
     public final Name METHOD;
+    public final Name MODULE;
     public final Name PACKAGE;
     public final Name PARAMETER;
     public final Name TYPE;
@@ -220,11 +225,14 @@
         _super = fromString("super");
         _this = fromString("this");
         exports = fromString("exports");
+        opens = fromString("opens");
         module = fromString("module");
         provides = fromString("provides");
         requires = fromString("requires");
         to = fromString("to");
+        transitive = fromString("transitive");
         uses = fromString("uses");
+        open = fromString("open");
         with = fromString("with");
 
         // field and method names
@@ -257,6 +265,7 @@
         length = fromString("length");
         next = fromString("next");
         ordinal = fromString("ordinal");
+        provider = fromString("provider");
         serialVersionUID = fromString("serialVersionUID");
         toString = fromString("toString");
         value = fromString("value");
@@ -303,6 +312,7 @@
         LocalVariableTypeTable = fromString("LocalVariableTypeTable");
         MethodParameters = fromString("MethodParameters");
         Module = fromString("Module");
+        ModuleVersion = fromString("ModuleVersion");
         RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
         RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
         RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
@@ -317,7 +327,6 @@
         Synthetic = fromString("Synthetic");
         Value = fromString("Value");
         Varargs = fromString("Varargs");
-        Version = fromString("Version");
 
         // members of java.lang.annotation.ElementType
         ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
@@ -325,6 +334,7 @@
         FIELD = fromString("FIELD");
         LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
         METHOD = fromString("METHOD");
+        MODULE = fromString("MODULE");
         PACKAGE = fromString("PACKAGE");
         PARAMETER = fromString("PARAMETER");
         TYPE = fromString("TYPE");
--- a/langtools/src/jdk.compiler/share/classes/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,7 +28,7 @@
  *  and its command line equivalent, <em>javac</em>, as well as <em>javah</em>.
  */
 module jdk.compiler {
-    requires public java.compiler;
+    requires transitive java.compiler;
 
     exports com.sun.source.doctree;
     exports com.sun.source.tree;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -79,7 +79,7 @@
  * module declaration, to create a module set to considered for documentation
  * as follows:
  * <ul>
- * <li> public -- follows and expands  all "requires public" edges in the module graph
+ * <li> transitive -- follows and expands  all "requires transitive" edges in the module graph
  * <li> all    -- follows and expands  all "requires" edges in the module graph.
  * By default, only the specified modules will be considered, without expansion
  * of the module dependencies.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,11 +28,18 @@
 import java.util.ArrayList;
 import java.util.EnumMap;
 import java.util.List;
+import java.util.SortedSet;
 
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.PackageElement;
+
+import com.sun.source.doctree.DocTree;
 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;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
 import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder.DeprElementKind;
@@ -57,6 +64,8 @@
 
     private String getAnchorName(DeprElementKind kind) {
         switch (kind) {
+            case MODULE:
+                return "module";
             case PACKAGE:
                 return "package";
             case INTERFACE:
@@ -88,6 +97,8 @@
 
     private String getHeadingKey(DeprElementKind kind) {
         switch (kind) {
+            case MODULE:
+                return "doclet.Deprecated_Modules";
             case PACKAGE:
                 return "doclet.Deprecated_Packages";
             case INTERFACE:
@@ -119,6 +130,8 @@
 
     private String getSummaryKey(DeprElementKind kind) {
         switch (kind) {
+            case MODULE:
+                return "doclet.deprecated_modules";
             case PACKAGE:
                 return "doclet.deprecated_packages";
             case INTERFACE:
@@ -150,6 +163,8 @@
 
     private String getHeaderKey(DeprElementKind kind) {
         switch (kind) {
+            case MODULE:
+                return "doclet.Module";
             case PACKAGE:
                 return "doclet.Package";
             case INTERFACE:
@@ -197,6 +212,7 @@
         writerMap = new EnumMap<>(DeprElementKind.class);
         for (DeprElementKind kind : DeprElementKind.values()) {
             switch (kind) {
+                case MODULE:
                 case PACKAGE:
                 case INTERFACE:
                 case CLASS:
@@ -268,12 +284,16 @@
                 List<String> memberTableHeader = new ArrayList<>();
                 memberTableHeader.add(resources.getText(getHeaderKey(kind)));
                 memberTableHeader.add(resources.getText("doclet.Description"));
-                if (kind == DeprElementKind.PACKAGE)
+                if (kind == DeprElementKind.MODULE) {
+                    addModuleDeprecatedAPI(deprapi.getSet(kind),
+                            getHeadingKey(kind), memberTableSummary, memberTableHeader, div);
+                } else if (kind == DeprElementKind.PACKAGE) {
                     addPackageDeprecatedAPI(deprapi.getSet(kind),
                             getHeadingKey(kind), memberTableSummary, memberTableHeader, div);
-                else
+                } else {
                     writerMap.get(kind).addDeprecatedAPI(deprapi.getSet(kind),
                             getHeadingKey(kind), memberTableSummary, memberTableHeader, div);
+                }
             }
         }
         if (configuration.allowTag(HtmlTag.MAIN)) {
@@ -373,4 +393,88 @@
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.deprecatedLabel);
         return li;
     }
+
+    /**
+     * Add module deprecation 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
+     */
+    protected void addModuleDeprecatedAPI(SortedSet<Element> deprMdles, String headingKey,
+            String tableSummary, List<String> tableHeader, Content contentTree) {
+        if (deprMdles.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 : deprMdles) {
+                ModuleElement mdle = (ModuleElement) e;
+                HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
+                        getModuleLink(mdle, new StringContent(mdle.getQualifiedName())));
+                HtmlTree tr = HtmlTree.TR(thRow);
+                HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
+                tdDesc.addStyle(HtmlStyle.colLast);
+                List<? extends DocTree> tags = utils.getDeprecatedTrees(mdle);
+                if (!tags.isEmpty()) {
+                    addInlineDeprecatedComment(mdle, 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);
+        }
+    }
+
+    /**
+     * 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);
+        }
+    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1046,48 +1046,6 @@
     }
 
     /**
-     * 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);
-        }
-    }
-
-    /**
      * Return the path to the class page for a typeElement.
      *
      * @param te   TypeElement for which the path is requested.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Thu Dec 01 09:02:42 2016 +0000
@@ -114,6 +114,7 @@
      *
      * @param heading the heading for the section
      */
+    @Override
     public Content getModuleHeader(String heading) {
         HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
@@ -126,6 +127,9 @@
         }
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
+        Content annotationContent = new HtmlTree(HtmlTag.P);
+        addAnnotationInfo(mdle, annotationContent);
+        div.addContent(annotationContent);
         Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
                 HtmlStyle.title, contents.moduleLabel);
         tHeading.addContent(Contents.SPACE);
@@ -143,6 +147,7 @@
     /**
      * Get the content header.
      */
+    @Override
     public Content getContentHeader() {
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.contentContainer);
@@ -152,6 +157,7 @@
     /**
      * Get the summary section header.
      */
+    @Override
     public Content getSummaryHeader() {
         HtmlTree li = new HtmlTree(HtmlTag.LI);
         li.addStyle(HtmlStyle.blockList);
@@ -163,6 +169,7 @@
      *
      * @param summaryContentTree the content tree to be added to the summary tree.
      */
+    @Override
     public Content getSummaryTree(Content summaryContentTree) {
         HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
         return ul;
@@ -225,7 +232,7 @@
      * Add the list of directives for the module.
      *
      * @param dirs the list of module directives
-     * @params tbody the content tree to which the list is added
+     * @param tbody the content tree to which the list is added
      */
     public void addList(List<ModuleElement.Directive> dirs, Content tbody) {
         boolean altColor = true;
@@ -238,6 +245,9 @@
                 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;
@@ -254,6 +264,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addModulesSummary(Content summaryContentTree) {
         List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.REQUIRES);
         if (dirs != null && !dirs.isEmpty()) {
@@ -307,6 +318,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addPackagesSummary(Content summaryContentTree) {
         List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.EXPORTS);
         if (dirs != null && !dirs.isEmpty()) {
@@ -376,6 +388,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addServicesSummary(Content summaryContentTree) {
         List<ModuleElement.Directive> usesDirs = directiveMap.get(DirectiveKind.USES);
         List<ModuleElement.Directive> providesDirs = directiveMap.get(DirectiveKind.PROVIDES);
@@ -459,33 +472,60 @@
      * @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) {
-        TypeElement impl = direct.getImplementation();
-        TypeElement srv = direct.getService();
-        Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl));
-        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);
-        addSummaryComment(srv, tdDesc);
-        HtmlTree tr = HtmlTree.TR(thType);
-        tr.addContent(tdDesc);
-        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-        tbody.addContent(tr);
+        List<? extends TypeElement> impls = direct.getImplementations();
+        for (TypeElement impl : impls) {
+            TypeElement srv = direct.getService();
+            Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl));
+            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);
+            addSummaryComment(srv, tdDesc);
+            HtmlTree tr = HtmlTree.TR(thType);
+            tr.addContent(tdDesc);
+            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+            tbody.addContent(tr);
+        }
+    }
+
+    /**
+     * Add the module deprecation information to the documentation tree.
+     *
+     * @param div the content tree to which the deprecation information will be added
+     */
+    public void addDeprecationInfo(Content div) {
+        List<? extends DocTree> deprs = utils.getBlockTags(mdle, DocTree.Kind.DEPRECATED);
+        if (utils.isDeprecated(mdle)) {
+            CommentHelper ch = utils.getCommentHelper(mdle);
+            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
+            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
+            deprDiv.addContent(deprPhrase);
+            if (!deprs.isEmpty()) {
+                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
+                if (!commentTags.isEmpty()) {
+                    addInlineDeprecatedComment(mdle, deprs.get(0), deprDiv);
+                }
+            }
+            div.addContent(deprDiv);
+        }
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addModuleDescription(Content moduleContentTree) {
         if (!utils.getFullBody(mdle).isEmpty()) {
             Content tree = configuration.allowTag(HtmlTag.SECTION) ? HtmlTree.SECTION() : moduleContentTree;
+            addDeprecationInfo(tree);
             tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION);
             tree.addContent(getMarkerAnchor(SectionName.MODULE_DESCRIPTION));
             addInlineComment(mdle, tree);
@@ -498,6 +538,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addModuleTags(Content moduleContentTree) {
         Content tree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION()
@@ -513,6 +554,7 @@
      *
      * @param subDiv the content tree to which the summary detail links will be added
      */
+    @Override
     protected void addSummaryDetailLinks(Content subDiv) {
         Content div = HtmlTree.DIV(getNavSummaryLinks());
         subDiv.addContent(div);
@@ -560,6 +602,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addModuleContent(Content contentTree, Content moduleContentTree) {
         if (configuration.allowTag(HtmlTag.MAIN)) {
             mainTree.addContent(moduleContentTree);
@@ -572,6 +615,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addModuleFooter(Content contentTree) {
         Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
                 ? HtmlTree.FOOTER()
@@ -633,6 +677,7 @@
      *
      * @return a content tree for the previous link
      */
+    @Override
     public Content getNavLinkPrevious() {
         Content li;
         if (prevModule == null) {
@@ -649,6 +694,7 @@
      *
      * @return a content tree for the next link
      */
+    @Override
     public Content getNavLinkNext() {
         Content li;
         if (nextModule == null) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -71,6 +71,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_Modules=Deprecated Modules
 doclet.Deprecated_Packages=Deprecated Packages
 doclet.Deprecated_Classes=Deprecated Classes
 doclet.Deprecated_Enums=Deprecated Enums
@@ -83,6 +84,7 @@
 doclet.Deprecated_Methods=Deprecated Methods
 doclet.Deprecated_Enum_Constants=Deprecated Enum Constants
 doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements
+doclet.deprecated_modules=deprecated modules
 doclet.deprecated_packages=deprecated packages
 doclet.deprecated_classes=deprecated classes
 doclet.deprecated_enums=deprecated enums
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -99,7 +99,7 @@
 doclet.Subinterfaces=\u65E2\u77E5\u306E\u30B5\u30D6\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u30EA\u30B9\u30C8:
 doclet.Implementing_Classes=\u65E2\u77E5\u306E\u5B9F\u88C5\u30AF\u30E9\u30B9\u306E\u30EA\u30B9\u30C8:
 doclet.Functional_Interface=\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
-doclet.Functional_Interface_Message=\u3053\u308C\u306F\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306A\u306E\u3067\u3001\u30E9\u30E0\u30C0\u5F0F\u307E\u305F\u306F\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u5272\u5F53\u3066\u30BF\u30FC\u30B2\u30C3\u30C8\u3068\u3057\u3066\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002 
+doclet.Functional_Interface_Message=\u3053\u308C\u306F\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306A\u306E\u3067\u3001\u30E9\u30E0\u30C0\u5F0F\u307E\u305F\u306F\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u5272\u5F53\u3066\u30BF\u30FC\u30B2\u30C3\u30C8\u3068\u3057\u3066\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002
 doclet.also=\u540C\u69D8\u306B
 doclet.Frames=\u30D5\u30EC\u30FC\u30E0
 doclet.No_Frames=\u30D5\u30EC\u30FC\u30E0\u306A\u3057
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import javax.lang.model.element.Element;
+import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 
@@ -51,6 +52,7 @@
     private final Configuration configuration;
     private final Utils utils;
     public static enum DeprElementKind {
+        MODULE,
         PACKAGE,
         INTERFACE,
         CLASS,
@@ -82,12 +84,19 @@
 
     /**
      * Build the sorted list of all the deprecated APIs in this run.
-     * Build separate lists for deprecated packages, classes, constructors,
+     * Build separate lists for deprecated modules, packages, classes, constructors,
      * methods and fields.
      *
      * @param configuration the current configuration of the doclet.
      */
     private void buildDeprecatedAPIInfo() {
+        SortedSet<ModuleElement> modules = configuration.modules;
+        SortedSet<Element> mset = deprecatedMap.get(DeprElementKind.MODULE);
+        for (Element me : modules) {
+            if (utils.isDeprecated(me)) {
+                mset.add(me);
+            }
+        }
         SortedSet<PackageElement> packages = configuration.packages;
         SortedSet<Element> pset = deprecatedMap.get(DeprElementKind.PACKAGE);
         for (Element pe : packages) {
@@ -95,7 +104,6 @@
                 pset.add(pe);
             }
         }
-        deprecatedMap.put(DeprElementKind.PACKAGE, pset);
         for (Element e : configuration.docEnv.getIncludedTypeElements()) {
             TypeElement te = (TypeElement)e;
             SortedSet<Element> eset;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Thu Dec 01 09:02:42 2016 +0000
@@ -516,10 +516,10 @@
     private Set<ModuleElement> getModuleRequires(ModuleElement mdle, boolean isPublic) {
         Set<ModuleElement> result = new HashSet<>();
         for (RequiresDirective rd : ElementFilter.requiresIn(mdle.getDirectives())) {
-            if (isPublic && rd.isPublic()) {
+            if (isPublic && rd.isTransitive()) {
                 result.add(rd.getDependency());
             }
-            if (!isPublic && !rd.isPublic()) {
+            if (!isPublic && !rd.isTransitive()) {
                 result.add(rd.getDependency());
             }
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Thu Dec 01 09:02:42 2016 +0000
@@ -479,7 +479,7 @@
 
         void setExpandRequires(ToolOption opt, String arg) throws OptionException {
             switch (arg) {
-                case "public":
+                case "transitive":
                     jdtoolOpts.put(opt, AccessKind.PUBLIC);
                     break;
                 case "all":
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -81,8 +81,8 @@
 main.opt.expand.requires.desc=\
     Instructs the tool to expand the set of modules to be\n\
     documented. By default, only the modules given explicitly on\n\
-    the command line will be documented. A value of "public" will\n\
-    additionally include all "requires public" dependencies of\n\
+    the command line will be documented. A value of "transitive" will\n\
+    additionally include all "requires transitive" dependencies of\n\
     those modules. A value of "all" will include all dependencies\n\
     of those modules.
 
--- a/langtools/src/jdk.javadoc/share/classes/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,8 +28,8 @@
  *  and its command line equivalent, <em>javadoc</em>.
  */
 module jdk.javadoc {
-    requires public java.compiler;
-    requires public jdk.compiler;
+    requires transitive java.compiler;
+    requires transitive jdk.compiler;
     requires java.xml;
 
     exports com.sun.javadoc;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -42,20 +42,22 @@
     public static final String BootstrapMethods         = "BootstrapMethods";
     public static final String CharacterRangeTable      = "CharacterRangeTable";
     public static final String Code                     = "Code";
-    public static final String ConcealedPackages        = "ConcealedPackages";
     public static final String ConstantValue            = "ConstantValue";
     public static final String CompilationID            = "CompilationID";
     public static final String Deprecated               = "Deprecated";
     public static final String EnclosingMethod          = "EnclosingMethod";
     public static final String Exceptions               = "Exceptions";
-    public static final String Hashes                   = "Hashes";
     public static final String InnerClasses             = "InnerClasses";
     public static final String LineNumberTable          = "LineNumberTable";
     public static final String LocalVariableTable       = "LocalVariableTable";
     public static final String LocalVariableTypeTable   = "LocalVariableTypeTable";
-    public static final String MainClass                = "MainClass";
     public static final String MethodParameters         = "MethodParameters";
     public static final String Module                   = "Module";
+    public static final String ModuleHashes             = "ModuleHashes";
+    public static final String ModuleMainClass          = "ModuleMainClass";
+    public static final String ModulePackages           = "ModulePackages";
+    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";
@@ -69,8 +71,6 @@
     public static final String StackMap                 = "StackMap";
     public static final String StackMapTable            = "StackMapTable";
     public static final String Synthetic                = "Synthetic";
-    public static final String TargetPlatform           = "TargetPlatform";
-    public static final String Version                  = "Version";
 
     public static class Factory {
         public Factory() {
@@ -115,19 +115,21 @@
             standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
             standardAttributes.put(Code,              Code_attribute.class);
             standardAttributes.put(CompilationID,     CompilationID_attribute.class);
-            standardAttributes.put(ConcealedPackages, ConcealedPackages_attribute.class);
             standardAttributes.put(ConstantValue,     ConstantValue_attribute.class);
             standardAttributes.put(Deprecated,        Deprecated_attribute.class);
             standardAttributes.put(EnclosingMethod,   EnclosingMethod_attribute.class);
             standardAttributes.put(Exceptions,        Exceptions_attribute.class);
-            standardAttributes.put(Hashes,            Hashes_attribute.class);
             standardAttributes.put(InnerClasses,      InnerClasses_attribute.class);
             standardAttributes.put(LineNumberTable,   LineNumberTable_attribute.class);
             standardAttributes.put(LocalVariableTable, LocalVariableTable_attribute.class);
             standardAttributes.put(LocalVariableTypeTable, LocalVariableTypeTable_attribute.class);
-            standardAttributes.put(MainClass,         MainClass_attribute.class);
             standardAttributes.put(MethodParameters,  MethodParameters_attribute.class);
             standardAttributes.put(Module,            Module_attribute.class);
+            standardAttributes.put(ModuleHashes,      ModuleHashes_attribute.class);
+            standardAttributes.put(ModuleMainClass,   ModuleMainClass_attribute.class);
+            standardAttributes.put(ModulePackages,    ModulePackages_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);
@@ -141,8 +143,6 @@
             standardAttributes.put(StackMap,          StackMap_attribute.class);
             standardAttributes.put(StackMapTable,     StackMapTable_attribute.class);
             standardAttributes.put(Synthetic,         Synthetic_attribute.class);
-            standardAttributes.put(TargetPlatform,    TargetPlatform_attribute.class);
-            standardAttributes.put(Version,           Version_attribute.class);
         }
 
         private Map<String,Class<? extends Attribute>> standardAttributes;
@@ -178,19 +178,21 @@
         R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p);
         R visitCode(Code_attribute attr, P p);
         R visitCompilationID(CompilationID_attribute attr, P p);
-        R visitConcealedPackages(ConcealedPackages_attribute attr, P p);
         R visitConstantValue(ConstantValue_attribute attr, P p);
         R visitDeprecated(Deprecated_attribute attr, P p);
         R visitEnclosingMethod(EnclosingMethod_attribute attr, P p);
         R visitExceptions(Exceptions_attribute attr, P p);
-        R visitHashes(Hashes_attribute attr, P p);
         R visitInnerClasses(InnerClasses_attribute attr, P p);
         R visitLineNumberTable(LineNumberTable_attribute attr, P p);
         R visitLocalVariableTable(LocalVariableTable_attribute attr, P p);
         R visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, P p);
-        R visitMainClass(MainClass_attribute attr, P p);
         R visitMethodParameters(MethodParameters_attribute attr, P p);
         R visitModule(Module_attribute attr, P p);
+        R visitModuleHashes(ModuleHashes_attribute attr, P p);
+        R visitModuleMainClass(ModuleMainClass_attribute attr, P p);
+        R visitModulePackages(ModulePackages_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);
@@ -204,7 +206,5 @@
         R visitStackMap(StackMap_attribute attr, P p);
         R visitStackMapTable(StackMapTable_attribute attr, P p);
         R visitSynthetic(Synthetic_attribute attr, P p);
-        R visitTargetPlatform(TargetPlatform_attribute attr, P p);
-        R visitVersion(Version_attribute attr, P p);
     }
 }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -55,6 +55,9 @@
 
     /**
      * Write a ClassFile data structure to a file.
+     * @param classFile the classfile object to be written
+     * @param f the file
+     * @throws IOException if an error occurs while writing the file
      */
     public void write(ClassFile classFile, File f) throws IOException {
         try (FileOutputStream f_out = new FileOutputStream(f)) {
@@ -64,6 +67,9 @@
 
     /**
      * Write a ClassFile data structure to a stream.
+     * @param classFile the classfile object to be written
+     * @param s the stream
+     * @throws IOException if an error occurs while writing the file
      */
     public void write(ClassFile classFile, OutputStream s) throws IOException {
         this.classFile = classFile;
@@ -419,7 +425,7 @@
         }
 
         @Override
-        public Void visitConcealedPackages(ConcealedPackages_attribute attr, ClassOutputStream out) {
+        public Void visitModulePackages(ModulePackages_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.packages_count);
             for (int i: attr.packages_index)
                 out.writeShort(i);
@@ -461,12 +467,15 @@
         }
 
         @Override
-        public Void visitHashes(Hashes_attribute attr, ClassOutputStream out) {
+        public Void visitModuleHashes(ModuleHashes_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.algorithm_index);
             out.writeShort(attr.hashes_table.length);
-            for (Hashes_attribute.Entry e: attr.hashes_table) {
-                out.writeShort(e.requires_index);
-                out.writeShort(e.hash_index);
+            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;
         }
@@ -534,33 +543,54 @@
         }
 
         @Override
-        public Void visitMainClass(MainClass_attribute attr, ClassOutputStream out) {
+        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.requires.length);
             for (Module_attribute.RequiresEntry e: attr.requires) {
                 out.writeShort(e.requires_index);
                 out.writeShort(e.requires_flags);
             }
+
             out.writeShort(attr.exports.length);
             for (Module_attribute.ExportsEntry e: attr.exports) {
                 out.writeShort(e.exports_index);
+                out.writeShort(e.exports_flags);
                 out.writeShort(e.exports_to_index.length);
                 for (int index: e.exports_to_index)
                     out.writeShort(index);
             }
+
+            out.writeShort(attr.opens.length);
+            for (Module_attribute.OpensEntry e: attr.opens) {
+                out.writeShort(e.opens_index);
+                out.writeShort(e.opens_flags);
+                out.writeShort(e.opens_to_index.length);
+                for (int index: e.opens_to_index)
+                    out.writeShort(index);
+            }
+
             out.writeShort(attr.uses_index.length);
-            for (int index: attr.uses_index)
+            for (int index: attr.uses_index) {
                 out.writeShort(index);
+            }
+
             out.writeShort(attr.provides.length);
             for (Module_attribute.ProvidesEntry e: attr.provides) {
                 out.writeShort(e.provides_index);
-                out.writeShort(e.with_index);
+                out.writeShort(e.with_count);
+                for (int with : e.with_index) {
+                    out.writeShort(with);
+                }
             }
+
             return null;
         }
 
@@ -656,7 +686,7 @@
         }
 
         @Override
-        public Void visitTargetPlatform(TargetPlatform_attribute attr, ClassOutputStream out) {
+        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);
@@ -668,7 +698,7 @@
         }
 
         @Override
-        public Void visitVersion(Version_attribute attr, ClassOutputStream out) {
+        public Void visitModuleVersion(ModuleVersion_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.version_index);
             return null;
         }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConcealedPackages_attribute.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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 ConcealedPackages_attribute extends Attribute {
-    ConcealedPackages_attribute(ClassReader cr, int name_index, int length)
-            throws IOException {
-        super(name_index, length);
-        packages_count = cr.readUnsignedShort();
-        packages_index = new int[packages_count];
-        for (int i = 0; i < packages_count; i++)
-            packages_index[i] = cr.readUnsignedShort();
-    }
-
-    public ConcealedPackages_attribute(ConstantPool constant_pool,
-                                       int[] packages_index)
-            throws ConstantPoolException {
-        this(constant_pool.getUTF8Index(Attribute.ConcealedPackages),
-             packages_index);
-    }
-
-    public ConcealedPackages_attribute(int name_index,
-                                       int[] packages_index) {
-        super(name_index, 2 + packages_index.length * 2);
-        this.packages_count = packages_index.length;
-        this.packages_index = packages_index;
-    }
-
-    public String getPackage(int index, ConstantPool constant_pool) throws ConstantPoolException {
-        int package_index = packages_index[index];
-        return constant_pool.getUTF8Value(package_index);
-    }
-
-    @Override
-    public <R, D> R accept(Visitor<R, D> visitor, D data) {
-        return visitor.visitConcealedPackages(this, data);
-    }
-
-    public final int packages_count;
-    public final int[] packages_index;
-}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Hashes_attribute.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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 Hashes_attribute extends Attribute {
-    Hashes_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        algorithm_index = cr.readUnsignedShort();
-        hashes_table_length = cr.readUnsignedShort();
-        hashes_table = new Entry[hashes_table_length];
-        for (int i = 0; i < hashes_table_length; i++)
-            hashes_table[i] = new Entry(cr);
-    }
-
-    public Hashes_attribute(ConstantPool constant_pool, int algorithm_index, Entry[] hashes_table)
-            throws ConstantPoolException {
-        this(constant_pool.getUTF8Index(Attribute.Hashes), algorithm_index, hashes_table);
-    }
-
-    public Hashes_attribute(int name_index, int algorithm_index, Entry[] hashes_table) {
-        super(name_index, 4 + hashes_table.length * Entry.length());
-        this.algorithm_index = algorithm_index;
-        this.hashes_table_length = hashes_table.length;
-        this.hashes_table = hashes_table;
-    }
-
-    @Override
-    public <R, D> R accept(Visitor<R, D> visitor, D data) {
-        return visitor.visitHashes(this, data);
-    }
-
-    public final int algorithm_index;
-    public final int hashes_table_length;
-    public final Entry[] hashes_table;
-
-    public static class Entry {
-        Entry(ClassReader cr) throws IOException {
-            requires_index = cr.readUnsignedShort();
-            hash_index = cr.readUnsignedShort();
-        }
-
-        public static int length() {
-            return 4;
-        }
-
-        public final int requires_index;
-        public final int hash_index;
-    }
-
-}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/MainClass_attribute.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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 MainClass_attribute extends Attribute {
-    MainClass_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        main_class_index = cr.readUnsignedShort();
-    }
-
-    public MainClass_attribute(ConstantPool constant_pool, int mainClass_index)
-            throws ConstantPoolException {
-        this(constant_pool.getUTF8Index(Attribute.Version), mainClass_index);
-    }
-
-    public MainClass_attribute(int name_index, int mainClass_index) {
-        super(name_index, 2);
-        this.main_class_index = mainClass_index;
-    }
-
-    public String getMainClassName(ConstantPool constant_pool) throws ConstantPoolException {
-        return constant_pool.getClassInfo(main_class_index).getName();
-    }
-
-    @Override
-    public <R, D> R accept(Visitor<R, D> visitor, D data) {
-        return visitor.visitMainClass(this, data);
-    }
-
-    public final int main_class_index;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleHashes_attribute.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,95 @@
+/*
+ * 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 ModuleHashes_attribute extends Attribute {
+    ModuleHashes_attribute(ClassReader cr, int name_index, int length) throws IOException {
+        super(name_index, length);
+        algorithm_index = cr.readUnsignedShort();
+        hashes_table_length = cr.readUnsignedShort();
+        hashes_table = new Entry[hashes_table_length];
+        for (int i = 0; i < hashes_table_length; i++)
+            hashes_table[i] = new Entry(cr);
+    }
+
+    public ModuleHashes_attribute(ConstantPool constant_pool, int algorithm_index, Entry[] hashes_table)
+            throws ConstantPoolException {
+        this(constant_pool.getUTF8Index(Attribute.ModuleHashes), algorithm_index, hashes_table);
+    }
+
+    public ModuleHashes_attribute(int name_index, int algorithm_index, Entry[] hashes_table) {
+        super(name_index, 2 + 2 + length(hashes_table));
+        this.algorithm_index = algorithm_index;
+        this.hashes_table_length = hashes_table.length;
+        this.hashes_table = hashes_table;
+    }
+
+    @Override
+    public <R, D> R accept(Visitor<R, D> visitor, D data) {
+        return visitor.visitModuleHashes(this, data);
+    }
+
+    private static int length(Entry[] hashes_table) {
+        int len = 0;
+        for (Entry e: hashes_table) {
+            len += e.length();
+        }
+        return len;
+    }
+
+    public final int algorithm_index;
+    public final int hashes_table_length;
+    public final Entry[] hashes_table;
+
+    public static class Entry {
+        Entry(ClassReader cr) throws IOException {
+            module_name_index = cr.readUnsignedShort();
+            int hash_length = cr.readUnsignedShort();
+            hash = new byte[hash_length];
+            for (int i=0; i<hash_length; i++) {
+                hash[i] = (byte) cr.readUnsignedByte();
+            }
+        }
+
+        public int length() {
+            return 4 + hash.length;
+        }
+
+        public final int module_name_index;
+        public final byte[] hash;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleMainClass_attribute.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,64 @@
+/*
+ * 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 ModuleMainClass_attribute extends Attribute {
+    ModuleMainClass_attribute(ClassReader cr, int name_index, int length) throws IOException {
+        super(name_index, length);
+        main_class_index = cr.readUnsignedShort();
+    }
+
+    public ModuleMainClass_attribute(ConstantPool constant_pool, int mainClass_index)
+            throws ConstantPoolException {
+        this(constant_pool.getUTF8Index(Attribute.ModuleMainClass), mainClass_index);
+    }
+
+    public ModuleMainClass_attribute(int name_index, int mainClass_index) {
+        super(name_index, 2);
+        this.main_class_index = mainClass_index;
+    }
+
+    public String getMainClassName(ConstantPool constant_pool) throws ConstantPoolException {
+        return constant_pool.getClassInfo(main_class_index).getName();
+    }
+
+    @Override
+    public <R, D> R accept(Visitor<R, D> visitor, D data) {
+        return visitor.visitModuleMainClass(this, data);
+    }
+
+    public final int main_class_index;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModulePackages_attribute.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,74 @@
+/*
+ * 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 ModulePackages_attribute extends Attribute {
+    ModulePackages_attribute(ClassReader cr, int name_index, int length)
+            throws IOException {
+        super(name_index, length);
+        packages_count = cr.readUnsignedShort();
+        packages_index = new int[packages_count];
+        for (int i = 0; i < packages_count; i++)
+            packages_index[i] = cr.readUnsignedShort();
+    }
+
+    public ModulePackages_attribute(ConstantPool constant_pool,
+                              int[] packages_index)
+            throws ConstantPoolException {
+        this(constant_pool.getUTF8Index(Attribute.ModulePackages),
+             packages_index);
+    }
+
+    public ModulePackages_attribute(int name_index,
+                              int[] packages_index) {
+        super(name_index, 2 + packages_index.length * 2);
+        this.packages_count = packages_index.length;
+        this.packages_index = packages_index;
+    }
+
+    public String getPackage(int index, ConstantPool constant_pool) throws ConstantPoolException {
+        int package_index = packages_index[index];
+        return constant_pool.getUTF8Value(package_index);
+    }
+
+    @Override
+    public <R, D> R accept(Visitor<R, D> visitor, D data) {
+        return visitor.visitModulePackages(this, data);
+    }
+
+    public final int packages_count;
+    public final int[] packages_index;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,54 @@
+/*
+ * 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 ModuleTarget_attribute extends Attribute {
+    ModuleTarget_attribute(ClassReader cr, int name_index, int length) throws IOException {
+        super(name_index, length);
+        os_name_index = cr.readUnsignedShort();
+        os_arch_index = cr.readUnsignedShort();
+        os_version_index = cr.readUnsignedShort();
+    }
+
+    @Override
+    public <R, D> R accept(Visitor<R, D> visitor, D data) {
+        return visitor.visitModuleTarget(this, data);
+    }
+
+    public final int os_name_index;
+    public final int os_arch_index;
+    public final int os_version_index;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleVersion_attribute.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,60 @@
+/*
+ * 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	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,24 +36,38 @@
  *  deletion without notice.</b>
  */
 public class Module_attribute extends Attribute {
-    public static final int ACC_PUBLIC    =   0x20;
-    public static final int ACC_SYNTHETIC = 0x1000;
-    public static final int ACC_MANDATED  = 0x8000;
+    public static final int ACC_TRANSITIVE      =   0x10;
+    public static final int ACC_STATIC_PHASE    =   0x20;
+    public static final int ACC_OPEN            =   0x20;
+    public static final int ACC_SYNTHETIC       = 0x1000;
+    public static final int ACC_MANDATED        = 0x8000;
 
     Module_attribute(ClassReader cr, int name_index, int length) throws IOException {
         super(name_index, length);
+
+        module_name = cr.readUnsignedShort();
+        module_flags = cr.readUnsignedShort();
+
         requires_count = cr.readUnsignedShort();
         requires = new RequiresEntry[requires_count];
         for (int i = 0; i < requires_count; i++)
             requires[i] = new RequiresEntry(cr);
+
         exports_count = cr.readUnsignedShort();
         exports = new ExportsEntry[exports_count];
         for (int i = 0; i < exports_count; i++)
             exports[i] = new ExportsEntry(cr);
+
+        opens_count = cr.readUnsignedShort();
+        opens = new OpensEntry[opens_count];
+        for (int i = 0; i < opens_count; i++)
+            opens[i] = new OpensEntry(cr);
+
         uses_count = cr.readUnsignedShort();
         uses_index = new int[uses_count];
         for (int i = 0; i < uses_count; i++)
             uses_index[i] = cr.readUnsignedShort();
+
         provides_count = cr.readUnsignedShort();
         provides = new ProvidesEntry[provides_count];
         for (int i = 0; i < provides_count; i++)
@@ -61,20 +75,26 @@
     }
 
     public Module_attribute(int name_index,
+            int module_name,
+            int module_flags,
             RequiresEntry[] requires,
             ExportsEntry[] exports,
+            OpensEntry[] opens,
             int[] uses,
             ProvidesEntry[] provides) {
         super(name_index, 2);
+        this.module_name = module_name;
+        this.module_flags = module_flags;
         requires_count = requires.length;
         this.requires = requires;
         exports_count = exports.length;
         this.exports = exports;
+        opens_count = opens.length;
+        this.opens = opens;
         uses_count = uses.length;
         this.uses_index = uses;
         provides_count = provides.length;
         this.provides = provides;
-
     }
 
     public String getUses(int index, ConstantPool constant_pool) throws ConstantPoolException {
@@ -87,10 +107,14 @@
         return visitor.visitModule(this, data);
     }
 
+    public final int module_name;
+    public final int module_flags;
     public final int requires_count;
     public final RequiresEntry[] requires;
     public final int exports_count;
     public final ExportsEntry[] exports;
+    public final int opens_count;
+    public final OpensEntry[] opens;
     public final int uses_count;
     public final int[] uses_index;
     public final int provides_count;
@@ -120,14 +144,16 @@
     public static class ExportsEntry {
         ExportsEntry(ClassReader cr) throws IOException {
             exports_index = cr.readUnsignedShort();
+            exports_flags = cr.readUnsignedShort();
             exports_to_count = cr.readUnsignedShort();
             exports_to_index = new int[exports_to_count];
             for (int i = 0; i < exports_to_count; i++)
                 exports_to_index[i] = cr.readUnsignedShort();
         }
 
-        public ExportsEntry(int index, int[] to) {
+        public ExportsEntry(int index, int flags, int[] to) {
             this.exports_index = index;
+            this.exports_flags = flags;
             this.exports_to_count = to.length;
             this.exports_to_index = to;
         }
@@ -137,24 +163,57 @@
         }
 
         public final int exports_index;
+        public final int exports_flags;
         public final int exports_to_count;
         public final int[] exports_to_index;
     }
 
+    public static class OpensEntry {
+        OpensEntry(ClassReader cr) throws IOException {
+            opens_index = cr.readUnsignedShort();
+            opens_flags = cr.readUnsignedShort();
+            opens_to_count = cr.readUnsignedShort();
+            opens_to_index = new int[opens_to_count];
+            for (int i = 0; i < opens_to_count; i++)
+                opens_to_index[i] = cr.readUnsignedShort();
+        }
+
+        public OpensEntry(int index, int flags, int[] to) {
+            this.opens_index = index;
+            this.opens_flags = flags;
+            this.opens_to_count = to.length;
+            this.opens_to_index = to;
+        }
+
+        public int length() {
+            return 4 + 2 * opens_to_index.length;
+        }
+
+        public final int opens_index;
+        public final int opens_flags;
+        public final int opens_to_count;
+        public final int[] opens_to_index;
+    }
+
     public static class ProvidesEntry {
         ProvidesEntry(ClassReader cr) throws IOException {
             provides_index = cr.readUnsignedShort();
-            with_index = cr.readUnsignedShort();
+            with_count = cr.readUnsignedShort();
+            with_index = new int[with_count];
+            for (int i = 0; i < with_count; i++)
+                with_index[i] = cr.readUnsignedShort();
         }
 
-        public ProvidesEntry(int provides, int with) {
+        public ProvidesEntry(int provides, int[] with) {
             this.provides_index = provides;
+            this.with_count = with.length;
             this.with_index = with;
         }
 
         public static final int length = 4;
 
         public final int provides_index;
-        public final int with_index;
+        public final int with_count;
+        public final int[] with_index;
     }
 }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TargetPlatform_attribute.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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 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 TargetPlatform_attribute extends Attribute {
-    TargetPlatform_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        os_name_index = cr.readUnsignedShort();
-        os_arch_index = cr.readUnsignedShort();
-        os_version_index = cr.readUnsignedShort();
-    }
-
-    @Override
-    public <R, D> R accept(Visitor<R, D> visitor, D data) {
-        return visitor.visitTargetPlatform(this, data);
-    }
-
-    public final int os_name_index;
-    public final int os_arch_index;
-    public final int os_version_index;
-}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Version_attribute.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 Version_attribute extends Attribute {
-    Version_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        version_index = cr.readUnsignedShort();
-    }
-
-    public Version_attribute(ConstantPool constant_pool, int version_index)
-            throws ConstantPoolException {
-        this(constant_pool.getUTF8Index(Attribute.Version), version_index);
-    }
-
-    public Version_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.visitVersion(this, data);
-    }
-
-    public final int version_index;
-}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -34,7 +34,6 @@
 import com.sun.tools.classfile.CharacterRangeTable_attribute.Entry;
 import com.sun.tools.classfile.Code_attribute;
 import com.sun.tools.classfile.CompilationID_attribute;
-import com.sun.tools.classfile.ConcealedPackages_attribute;
 import com.sun.tools.classfile.ConstantPool;
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.ConstantValue_attribute;
@@ -42,15 +41,18 @@
 import com.sun.tools.classfile.Deprecated_attribute;
 import com.sun.tools.classfile.EnclosingMethod_attribute;
 import com.sun.tools.classfile.Exceptions_attribute;
-import com.sun.tools.classfile.Hashes_attribute;
 import com.sun.tools.classfile.InnerClasses_attribute;
 import com.sun.tools.classfile.InnerClasses_attribute.Info;
 import com.sun.tools.classfile.LineNumberTable_attribute;
 import com.sun.tools.classfile.LocalVariableTable_attribute;
 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
-import com.sun.tools.classfile.MainClass_attribute;
 import com.sun.tools.classfile.MethodParameters_attribute;
 import com.sun.tools.classfile.Module_attribute;
+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.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;
@@ -64,8 +66,6 @@
 import com.sun.tools.classfile.StackMapTable_attribute;
 import com.sun.tools.classfile.StackMap_attribute;
 import com.sun.tools.classfile.Synthetic_attribute;
-import com.sun.tools.classfile.TargetPlatform_attribute;
-import com.sun.tools.classfile.Version_attribute;
 
 import static com.sun.tools.classfile.AccessFlags.*;
 
@@ -237,7 +237,7 @@
         return null;
     }
 
-    private String getJavaPackage(ConcealedPackages_attribute attr, int index) {
+    private String getJavaPackage(ModulePackages_attribute attr, int index) {
         try {
             return getJavaName(attr.getPackage(index, constant_pool));
         } catch (ConstantPoolException e) {
@@ -246,8 +246,8 @@
     }
 
     @Override
-    public Void visitConcealedPackages(ConcealedPackages_attribute attr, Void ignore) {
-        println("ConcealedPackages: ");
+    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]);
@@ -323,22 +323,24 @@
     }
 
     @Override
-    public Void visitHashes(Hashes_attribute attr, Void ignore) {
-        println("Hashes:");
+    public Void visitModuleHashes(ModuleHashes_attribute attr, Void ignore) {
+        println("ModuleHashes:");
         indent(+1);
         print("algorithm #" + attr.algorithm_index);
         tab();
         println("// " + getAlgorithm(attr));
-        for (Hashes_attribute.Entry e : attr.hashes_table) {
-            print("#" + e.requires_index + ", #" + e.hash_index);
+        for (ModuleHashes_attribute.Entry e : attr.hashes_table) {
+            print("#" + e.module_name_index);
             tab();
-            println("// " + getRequires(e) + ": " + getHash(e));
+            println("// " + getModuleName(e));
+            println("hash_length: " + e.hash.length);
+            println("hash: [" + toHex(e.hash) + "]");
         }
         indent(-1);
         return null;
     }
 
-    private String getAlgorithm(Hashes_attribute attr) {
+    private String getAlgorithm(ModuleHashes_attribute attr) {
         try {
             return constant_pool.getUTF8Value(attr.algorithm_index);
         } catch (ConstantPoolException e) {
@@ -346,17 +348,9 @@
         }
     }
 
-    private String getRequires(Hashes_attribute.Entry entry) {
+    private String getModuleName(ModuleHashes_attribute.Entry entry) {
         try {
-            return constant_pool.getUTF8Value(entry.requires_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    private String getHash(Hashes_attribute.Entry entry) {
-        try {
-            return constant_pool.getUTF8Value(entry.hash_index);
+            return constant_pool.getUTF8Value(entry.module_name_index);
         } catch (ConstantPoolException e) {
             return report(e);
         }
@@ -456,15 +450,15 @@
     }
 
     @Override
-    public Void visitMainClass(MainClass_attribute attr, Void ignore) {
-        print("MainClass: #" + attr.main_class_index);
+    public Void visitModuleMainClass(ModuleMainClass_attribute attr, Void ignore) {
+        print("ModuleMainClass: #" + attr.main_class_index);
         tab();
         print("// " + getJavaClassName(attr));
         println();
         return null;
     }
 
-    private String getJavaClassName(MainClass_attribute a) {
+    private String getJavaClassName(ModuleMainClass_attribute a) {
         try {
             return getJavaName(a.getMainClassName(constant_pool));
         } catch (ConstantPoolException e) {
@@ -477,7 +471,6 @@
     @Override
     public Void visitMethodParameters(MethodParameters_attribute attr,
                                       Void ignore) {
-
         final String header = String.format(format, "Name", "Flags");
         println("MethodParameters:");
         indent(+1);
@@ -501,8 +494,25 @@
     public Void visitModule(Module_attribute attr, Void ignore) {
         println("Module:");
         indent(+1);
+
+        print(attr.module_name);
+        tab();
+        println("// " + constantWriter.stringValue(attr.module_name));
+
+        print(String.format("%x", attr.module_flags));
+        tab();
+        print("// ");
+        if ((attr.module_flags & Module_attribute.ACC_OPEN) != 0)
+            print(" ACC_OPEN");
+        if ((attr.module_flags & Module_attribute.ACC_MANDATED) != 0)
+            print(" ACC_MANDATED");
+        if ((attr.module_flags & Module_attribute.ACC_SYNTHETIC) != 0)
+            print(" ACC_SYNTHETIC");
+        println();
+
         printRequiresTable(attr);
         printExportsTable(attr);
+        printOpensTable(attr);
         printUsesTable(attr);
         printProvidesTable(attr);
         indent(-1);
@@ -511,63 +521,107 @@
 
     protected void printRequiresTable(Module_attribute attr) {
         Module_attribute.RequiresEntry[] entries = attr.requires;
-        println(entries.length + "\t// " + "requires");
+        print(entries.length);
+        tab();
+        println("// " + "requires");
         indent(+1);
         for (Module_attribute.RequiresEntry e: entries) {
-            print("#" + e.requires_index + "," +
-                    String.format("%x", e.requires_flags)+ "\t// requires");
-            if ((e.requires_flags & Module_attribute.ACC_PUBLIC) != 0)
-                print(" public");
+            print("#" + e.requires_index + "," + String.format("%x", e.requires_flags));
+            tab();
+            print("// " + constantWriter.stringValue(e.requires_index));
+            if ((e.requires_flags & Module_attribute.ACC_TRANSITIVE) != 0)
+                print(" ACC_TRANSITIVE");
+            if ((e.requires_flags & Module_attribute.ACC_STATIC_PHASE) != 0)
+                print(" ACC_STATIC_PHASE");
             if ((e.requires_flags & Module_attribute.ACC_SYNTHETIC) != 0)
-                print(" synthetic");
+                print(" ACC_SYNTHETIC");
             if ((e.requires_flags & Module_attribute.ACC_MANDATED) != 0)
-                print(" mandated");
-            println(" " + constantWriter.stringValue(e.requires_index));
+                print(" ACC_MANDATED");
+            println();
         }
         indent(-1);
     }
 
     protected void printExportsTable(Module_attribute attr) {
         Module_attribute.ExportsEntry[] entries = attr.exports;
-        println(entries.length + "\t// " + "exports");
+        print(entries.length);
+        tab();
+        println("// exports");
         indent(+1);
         for (Module_attribute.ExportsEntry e: entries) {
-            print("#" + e.exports_index + "\t// exports");
-            print(" " + constantWriter.stringValue(e.exports_index));
-            if (e.exports_to_index.length == 0) {
-                println();
-            } else {
-                println(" to ... " + e.exports_to_index.length);
-                indent(+1);
-                for (int to: e.exports_to_index) {
-                    println("#" + to + "\t// ... to " + constantWriter.stringValue(to));
-                }
-                indent(-1);
-            }
+            printExportOpenEntry(e.exports_index, e.exports_flags, e.exports_to_index);
+        }
+        indent(-1);
+    }
+
+    protected void printOpensTable(Module_attribute attr) {
+        Module_attribute.OpensEntry[] entries = attr.opens;
+        print(entries.length);
+        tab();
+        println("// opens");
+        indent(+1);
+        for (Module_attribute.OpensEntry e: entries) {
+            printExportOpenEntry(e.opens_index, e.opens_flags, e.opens_to_index);
         }
         indent(-1);
     }
 
+    protected void printExportOpenEntry(int index, int flags, int[] to_index) {
+        print("#" + index + "," + String.format("%x", flags));
+        tab();
+        print("// ");
+        print(constantWriter.stringValue(index));
+        if ((flags & Module_attribute.ACC_MANDATED) != 0)
+            print(" ACC_MANDATED");
+        if ((flags & Module_attribute.ACC_SYNTHETIC) != 0)
+            print(" ACC_SYNTHETIC");
+        if (to_index.length == 0) {
+            println();
+        } else {
+            println(" to ... " + to_index.length);
+            indent(+1);
+            for (int to: to_index) {
+                print("#" + to);
+                tab();
+                println("// ... to " + constantWriter.stringValue(to));
+            }
+            indent(-1);
+        }
+    }
+
     protected void printUsesTable(Module_attribute attr) {
         int[] entries = attr.uses_index;
-        println(entries.length + "\t// " + "uses services");
+        print(entries.length);
+        tab();
+        println("// " + "uses");
         indent(+1);
         for (int e: entries) {
-            println("#" + e + "\t// uses " + constantWriter.stringValue(e));
+            print("#" + e);
+            tab();
+            println("// " + constantWriter.stringValue(e));
         }
         indent(-1);
     }
 
     protected void printProvidesTable(Module_attribute attr) {
         Module_attribute.ProvidesEntry[] entries = attr.provides;
-        println(entries.length + "\t// " + "provides services");
+        print(entries.length);
+        tab();
+        println("// " + "provides");
         indent(+1);
         for (Module_attribute.ProvidesEntry e: entries) {
-            print("#" + e.provides_index + ",#" +
-                    e.with_index + "\t// provides ");
+            print("#" + e.provides_index);
+            tab();
+            print("// ");
             print(constantWriter.stringValue(e.provides_index));
-            print (" with ");
-            println(constantWriter.stringValue(e.with_index));
+            println(" with ... " + e.with_count);
+            indent(+1);
+            for (int with : e.with_index) {
+                print("#" + with);
+                tab();
+                println("// ... with " + constantWriter.stringValue(with));
+            }
+            indent(-1);
         }
         indent(-1);
     }
@@ -876,8 +930,8 @@
     }
 
     @Override
-    public Void visitTargetPlatform(TargetPlatform_attribute attr, Void ignore) {
-        println("TargetPlatform:");
+    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) {
@@ -901,7 +955,7 @@
         return null;
     }
 
-    private String getOSName(TargetPlatform_attribute attr) {
+    private String getOSName(ModuleTarget_attribute attr) {
         try {
             return constant_pool.getUTF8Value(attr.os_name_index);
         } catch (ConstantPoolException e) {
@@ -909,7 +963,7 @@
         }
     }
 
-    private String getOSArch(TargetPlatform_attribute attr) {
+    private String getOSArch(ModuleTarget_attribute attr) {
         try {
             return constant_pool.getUTF8Value(attr.os_arch_index);
         } catch (ConstantPoolException e) {
@@ -917,7 +971,7 @@
         }
     }
 
-    private String getOSVersion(TargetPlatform_attribute attr) {
+    private String getOSVersion(ModuleTarget_attribute attr) {
         try {
             return constant_pool.getUTF8Value(attr.os_version_index);
         } catch (ConstantPoolException e) {
@@ -926,8 +980,8 @@
     }
 
     @Override
-    public Void visitVersion(Version_attribute attr, Void ignore) {
-        print("Version: #" + attr.version_index);
+    public Void visitModuleVersion(ModuleVersion_attribute attr, Void ignore) {
+        print("ModuleVersion: #" + attr.version_index);
         indent(+1);
         tab();
         println("// " + getVersion(attr));
@@ -935,7 +989,7 @@
         return null;
     }
 
-    private String getVersion(Version_attribute attr) {
+    private String getVersion(ModuleVersion_attribute attr) {
         try {
             return constant_pool.getUTF8Value(attr.version_index);
         } catch (ConstantPoolException e) {
@@ -962,6 +1016,14 @@
         return StringUtils.toUpperCase(s);
     }
 
+    static String toHex(byte[] ba) {
+        StringBuilder sb = new StringBuilder(ba.length);
+        for (byte b: ba) {
+            sb.append(String.format("%02x", b & 0xff));
+        }
+        return sb.toString();
+    }
+
     private final AnnotationWriter annotationWriter;
     private final CodeWriter codeWriter;
     private final ConstantWriter constantWriter;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -40,7 +40,7 @@
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.ConstantValue_attribute;
 import com.sun.tools.classfile.Descriptor;
-import com.sun.tools.classfile.DescriptorException;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
 import com.sun.tools.classfile.Exceptions_attribute;
 import com.sun.tools.classfile.Field;
 import com.sun.tools.classfile.Method;
@@ -157,21 +157,36 @@
             indent(-1);
         }
 
-        String name = getJavaName(classFile);
         AccessFlags flags = cf.access_flags;
-
         writeModifiers(flags.getClassModifiers());
 
-        if (classFile.access_flags.is(AccessFlags.ACC_MODULE) && name.endsWith(".module-info")) {
-            print("module ");
-            print(name.replace(".module-info", ""));
+        if (classFile.access_flags.is(AccessFlags.ACC_MODULE)) {
+            Attribute attr = classFile.attributes.get(Attribute.Module);
+            if (attr instanceof Module_attribute) {
+                Module_attribute modAttr = (Module_attribute) attr;
+                String name;
+                try {
+                    name = getJavaName(constant_pool.getUTF8Value(modAttr.module_name));
+                } catch (ConstantPoolException e) {
+                    name = report(e);
+                }
+                if ((modAttr.module_flags & Module_attribute.ACC_OPEN) != 0) {
+                    print("open ");
+                }
+                print("module ");
+                print(name);
+            } else {
+                // fallback for malformed class files
+                print("class ");
+                print(getJavaName(classFile));
+            }
         } else {
             if (classFile.isClass())
                 print("class ");
             else if (classFile.isInterface())
                 print("interface ");
 
-            print(name);
+            print(getJavaName(classFile));
         }
 
         Signature_attribute sigAttr = getSignature(cf.attributes);
@@ -210,7 +225,23 @@
             indent(+1);
             println("minor version: " + cf.minor_version);
             println("major version: " + cf.major_version);
-            writeList("flags: ", flags.getClassFlags(), "\n");
+            writeList(String.format("flags: (0x%04x) ", flags.flags), flags.getClassFlags(), "\n");
+            print("this_class: #" + cf.this_class);
+            if (cf.this_class != 0) {
+                tab();
+                print("// " + constantWriter.stringValue(cf.this_class));
+            }
+            println();
+            print("super_class: #" + cf.super_class);
+            if (cf.super_class != 0) {
+                tab();
+                print("// " + constantWriter.stringValue(cf.super_class));
+            }
+            println();
+            print("interfaces: " + cf.interfaces.length);
+            print(", fields: " + cf.fields.length);
+            print(", methods: " + cf.methods.length);
+            println(", attributes: " + cf.attributes.attrs.length);
             indent(-1);
             constantWriter.writeConstantPool();
         } else {
@@ -249,17 +280,20 @@
                 return builder.toString();
             }
 
+            @Override
             public StringBuilder visitSimpleType(SimpleType type, StringBuilder sb) {
                 sb.append(getJavaName(type.name));
                 return sb;
             }
 
+            @Override
             public StringBuilder visitArrayType(ArrayType type, StringBuilder sb) {
                 append(sb, type.elemType);
                 sb.append("[]");
                 return sb;
             }
 
+            @Override
             public StringBuilder visitMethodType(MethodType type, StringBuilder sb) {
                 appendIfNotEmpty(sb, "<", type.typeParamTypes, "> ");
                 append(sb, type.returnType);
@@ -268,6 +302,7 @@
                 return sb;
             }
 
+            @Override
             public StringBuilder visitClassSigType(ClassSigType type, StringBuilder sb) {
                 appendIfNotEmpty(sb, "<", type.typeParamTypes, ">");
                 if (isInterface) {
@@ -283,6 +318,7 @@
                 return sb;
             }
 
+            @Override
             public StringBuilder visitClassType(ClassType type, StringBuilder sb) {
                 if (type.outerType != null) {
                     append(sb, type.outerType);
@@ -293,6 +329,7 @@
                 return sb;
             }
 
+            @Override
             public StringBuilder visitTypeParamType(TypeParamType type, StringBuilder sb) {
                 sb.append(type.name);
                 String sep = " extends ";
@@ -312,6 +349,7 @@
                 return sb;
             }
 
+            @Override
             public StringBuilder visitWildcardType(WildcardType type, StringBuilder sb) {
                 switch (type.kind) {
                     case UNBOUNDED:
@@ -402,7 +440,7 @@
             println("descriptor: " + getValue(f.descriptor));
 
         if (options.verbose)
-            writeList("flags: ", flags.getFieldFlags(), "\n");
+            writeList(String.format("flags: (0x%04x) ", flags.flags), flags.getFieldFlags(), "\n");
 
         if (options.showAllAttrs) {
             for (Attribute attr: f.attributes)
@@ -459,16 +497,20 @@
         if (methodType != null) {
             print(new JavaTypePrinter(false).printTypeArgs(methodType.typeParamTypes));
         }
-        if (getName(m).equals("<init>")) {
-            print(getJavaName(classFile));
-            print(getJavaParameterTypes(d, flags));
-        } else if (getName(m).equals("<clinit>")) {
-            print("{}");
-        } else {
-            print(getJavaReturnType(d));
-            print(" ");
-            print(getName(m));
-            print(getJavaParameterTypes(d, flags));
+        switch (getName(m)) {
+            case "<init>":
+                print(getJavaName(classFile));
+                print(getJavaParameterTypes(d, flags));
+                break;
+            case "<clinit>":
+                print("{}");
+                break;
+            default:
+                print(getJavaReturnType(d));
+                print(" ");
+                print(getName(m));
+                print(getJavaParameterTypes(d, flags));
+                break;
         }
 
         Attribute e_attr = m.attributes.get(Attribute.Exceptions);
@@ -499,7 +541,7 @@
         }
 
         if (options.verbose) {
-            writeList("flags: ", flags.getMethodFlags(), "\n");
+            writeList(String.format("flags: (0x%04x) ", flags.flags), flags.getMethodFlags(), "\n");
         }
 
         Code_attribute code = null;
@@ -555,15 +597,18 @@
         Module_attribute m = (Module_attribute) attr;
         for (Module_attribute.RequiresEntry entry: m.requires) {
             print("requires");
-            if ((entry.requires_flags & Module_attribute.ACC_PUBLIC) != 0)
-                print(" public");
+            if ((entry.requires_flags & Module_attribute.ACC_STATIC_PHASE) != 0)
+                print(" static");
+            if ((entry.requires_flags & Module_attribute.ACC_TRANSITIVE) != 0)
+                print(" transitive");
             print(" ");
             print(getUTF8Value(entry.requires_index).replace('/', '.'));
             println(";");
         }
 
         for (Module_attribute.ExportsEntry entry: m.exports) {
-            print("exports ");
+            print("exports");
+            print(" ");
             print(getUTF8Value(entry.exports_index).replace('/', '.'));
             boolean first = true;
             for (int i: entry.exports_to_index) {
@@ -587,6 +632,32 @@
                 indent(-1);
         }
 
+        for (Module_attribute.OpensEntry entry: m.opens) {
+            print("opens");
+            print(" ");
+            print(getUTF8Value(entry.opens_index).replace('/', '.'));
+            boolean first = true;
+            for (int i: entry.opens_to_index) {
+                String mname;
+                try {
+                    mname = classFile.constant_pool.getUTF8Value(i).replace('/', '.');
+                } catch (ConstantPoolException e) {
+                    mname = report(e);
+                }
+                if (first) {
+                    println(" to");
+                    indent(+1);
+                    first = false;
+                } else {
+                    println(",");
+                }
+                print(mname);
+            }
+            println(";");
+            if (!first)
+                indent(-1);
+        }
+
         for (int entry: m.uses_index) {
             print("uses ");
             print(getClassName(entry).replace('/', '.'));
@@ -594,13 +665,22 @@
         }
 
         for (Module_attribute.ProvidesEntry entry: m.provides) {
-            print("provides ");
+            print("provides  ");
             print(getClassName(entry.provides_index).replace('/', '.'));
-            println(" with");
-            indent(+1);
-            print(getClassName(entry.with_index).replace('/', '.'));
+            boolean first = true;
+            for (int i: entry.with_index) {
+                if (first) {
+                    println(" with");
+                    indent(+1);
+                    first = false;
+                } else {
+                    println(",");
+                }
+                print(getClassName(i).replace('/', '.'));
+            }
             println(";");
-            indent(-1);
+            if (!first)
+                indent(-1);
         }
     }
 
@@ -679,7 +759,7 @@
             return getJavaName(d.getFieldType(constant_pool));
         } catch (ConstantPoolException e) {
             return report(e);
-        } catch (DescriptorException e) {
+        } catch (InvalidDescriptor e) {
             return report(e);
         }
     }
@@ -689,7 +769,7 @@
             return getJavaName(d.getReturnType(constant_pool));
         } catch (ConstantPoolException e) {
             return report(e);
-        } catch (DescriptorException e) {
+        } catch (InvalidDescriptor e) {
             return report(e);
         }
     }
@@ -699,7 +779,7 @@
             return getJavaName(adjustVarargs(flags, d.getParameterTypes(constant_pool)));
         } catch (ConstantPoolException e) {
             return report(e);
-        } catch (DescriptorException e) {
+        } catch (InvalidDescriptor e) {
             return report(e);
         }
     }
@@ -766,12 +846,16 @@
                     ConstantPool.CONSTANT_Integer_info info =
                             (ConstantPool.CONSTANT_Integer_info) cpInfo;
                     String t = d.getValue(constant_pool);
-                    if (t.equals("C")) { // character
-                        return getConstantCharValue((char) info.value);
-                    } else if (t.equals("Z")) { // boolean
-                        return String.valueOf(info.value == 1);
-                    } else { // other: assume integer
-                        return String.valueOf(info.value);
+                    switch (t) {
+                        case "C":
+                            // character
+                            return getConstantCharValue((char) info.value);
+                        case "Z":
+                            // boolean
+                            return String.valueOf(info.value == 1);
+                        default:
+                            // other: assume integer
+                            return String.valueOf(info.value);
                     }
                 }
 
@@ -823,10 +907,10 @@
         }
     }
 
-    private Options options;
-    private AttributeWriter attrWriter;
-    private CodeWriter codeWriter;
-    private ConstantWriter constantWriter;
+    private final Options options;
+    private final AttributeWriter attrWriter;
+    private final CodeWriter codeWriter;
+    private final ConstantWriter constantWriter;
     private ClassFile classFile;
     private URI uri;
     private long lastModified;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java	Thu Dec 01 09:02:42 2016 +0000
@@ -136,7 +136,7 @@
         Set<PackageElement> set = new HashSet<>();
         for (ModuleElement m : mods) {
             for (ModuleElement.Directive dir : m.getDirectives()) {
-                if (dir.getKind() == ModuleElement.DirectiveKind.EXPORTS) {
+                if (dir.getKind() == ModuleElement.DirectiveKind.EXPORTS) { //XXX
                     ModuleElement.ExportsDirective exp = (ModuleElement.ExportsDirective)dir;
                     if (exp.getTargetModules() == null) {
                         set.add(exp.getPackage());
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Thu Dec 01 09:02:42 2016 +0000
@@ -25,6 +25,7 @@
 
 package com.sun.tools.jdeps;
 
+import com.sun.tools.classfile.AccessFlags;
 import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.Dependencies.ClassFileError;
@@ -170,7 +171,9 @@
     protected Set<String> scan() {
         try {
             ClassFile cf = ClassFile.read(path);
-            return Collections.singleton(cf.getName());
+            String name = cf.access_flags.is(AccessFlags.ACC_MODULE)
+                ? "module-info" : cf.getName();
+            return Collections.singleton(name);
         } catch (ConstantPoolException|IOException e) {
             throw new ClassFileError(e);
         }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java	Thu Dec 01 09:02:42 2016 +0000
@@ -37,6 +37,7 @@
 
 import java.io.IOException;
 import java.io.UncheckedIOException;
+import java.util.Collections;
 import java.util.Deque;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -175,6 +176,9 @@
             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();
@@ -216,9 +220,13 @@
     {
         ClassFile cf = archive.reader().getClassFile(name);
         if (cf == null) {
-            throw new IllegalArgumentException(archive.getName() + " does not contain " + name);
+            throw new IllegalArgumentException(archive.getName() +
+                " does not contain " + name);
         }
 
+        if (cf.access_flags.is(AccessFlags.ACC_MODULE))
+            return Collections.emptySet();
+
         Set<Location> targets = new HashSet<>();
         String cn;
         try {
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java	Thu Dec 01 09:02:42 2016 +0000
@@ -29,11 +29,9 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Deque;
-import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedDeque;
@@ -263,7 +261,7 @@
 
     public static enum Info {
         REQUIRES,
-        REQUIRES_PUBLIC,
+        REQUIRES_TRANSITIVE,
         EXPORTED_API,
         MODULE_PRIVATE,
         QUALIFIED_EXPORTED_API,
@@ -288,7 +286,7 @@
         @Override
         public String toString() {
             StringBuilder sb = new StringBuilder();
-            if (info != Info.REQUIRES && info != Info.REQUIRES_PUBLIC)
+            if (info != Info.REQUIRES && info != Info.REQUIRES_TRANSITIVE)
                 sb.append(source).append("/");
 
             sb.append(name);
@@ -325,7 +323,7 @@
      * Returns a graph of module dependences.
      *
      * Each Node represents a module and each edge is a dependence.
-     * No analysis on "requires public".
+     * No analysis on "requires transitive".
      */
     public Graph<Node> moduleGraph() {
         Graph.Builder<Node> builder = new Graph.Builder<>();
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java	Thu Dec 01 09:02:42 2016 +0000
@@ -388,10 +388,10 @@
         }
 
         static void printEdges(PrintWriter out, Graph<String> graph,
-                               String node, Set<String> requiresPublic) {
+                               String node, Set<String> requiresTransitive) {
             graph.adjacentNodes(node).forEach(dn -> {
                 String attr = dn.equals("java.base") ? REQUIRES_BASE
-                        : (requiresPublic.contains(dn) ? REEXPORTS : REQUIRES);
+                        : (requiresTransitive.contains(dn) ? REEXPORTS : REQUIRES);
                 out.format("  \"%s\" -> \"%s\" [%s];%n", node, dn, attr);
             });
         }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Thu Dec 01 09:02:42 2016 +0000
@@ -38,6 +38,8 @@
 import java.io.UncheckedIOException;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Exports;
+import java.lang.module.ModuleDescriptor.Opens;
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
@@ -408,7 +410,7 @@
                             }
 
                             @Override
-                            public void close() throws IOException {
+                            public void close() {
                             }
                         };
                     }
@@ -421,12 +423,18 @@
         }
 
         private ModuleDescriptor dropHashes(ModuleDescriptor md) {
-            ModuleDescriptor.Builder builder = new ModuleDescriptor.Builder(md.name());
+            ModuleDescriptor.Builder builder = ModuleDescriptor.module(md.name());
             md.requires().forEach(builder::requires);
             md.exports().forEach(builder::exports);
-            md.provides().values().stream().forEach(builder::provides);
+            md.opens().forEach(builder::opens);
+            md.provides().stream().forEach(builder::provides);
             md.uses().stream().forEach(builder::uses);
-            builder.conceals(md.conceals());
+
+            Set<String> concealed = new HashSet<>(md.packages());
+            md.exports().stream().map(Exports::source).forEach(concealed::remove);
+            md.opens().stream().map(Opens::source).forEach(concealed::remove);
+            concealed.forEach(builder::contains);
+
             return builder.build();
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Thu Dec 01 09:02:42 2016 +0000
@@ -154,6 +154,7 @@
         ANALYZE_DEPS(""),
         GENERATE_DOT_FILE("-dotoutput", "--dot-output"),
         GENERATE_MODULE_INFO("--generate-module-info"),
+        GENERATE_OPEN_MODULE("--generate-open-module"),
         LIST_DEPS("--list-deps"),
         LIST_REDUCED_DEPS("--list-reduced-deps"),
         CHECK_MODULES("--check");
@@ -248,7 +249,15 @@
                 if (task.command != null) {
                     throw new BadArgs("err.command.set", task.command, opt);
                 }
-                task.command = task.genModuleInfo(Paths.get(arg));
+                task.command = task.genModuleInfo(Paths.get(arg), false);
+            }
+        },
+        new Option(true, CommandOption.GENERATE_OPEN_MODULE) {
+            void process(JdepsTask task, String opt, String arg) throws BadArgs {
+                if (task.command != null) {
+                    throw new BadArgs("err.command.set", task.command, opt);
+                }
+                task.command = task.genModuleInfo(Paths.get(arg), true);
             }
         },
         new Option(false, CommandOption.LIST_DEPS) {
@@ -596,11 +605,11 @@
         return new GenDotFile(dir);
     }
 
-    private GenModuleInfo genModuleInfo(Path dir) throws BadArgs {
+    private GenModuleInfo genModuleInfo(Path dir, boolean openModule) throws BadArgs {
         if (Files.exists(dir) && (!Files.isDirectory(dir) || !Files.isWritable(dir))) {
             throw new BadArgs("err.invalid.path", dir.toString());
         }
-        return new GenModuleInfo(dir);
+        return new GenModuleInfo(dir, openModule);
     }
 
     private ListModuleDeps listModuleDeps(boolean reduced) throws BadArgs {
@@ -823,9 +832,11 @@
 
     class GenModuleInfo extends Command {
         final Path dir;
-        GenModuleInfo(Path dir) {
+        final boolean openModule;
+        GenModuleInfo(Path dir, boolean openModule) {
             super(CommandOption.GENERATE_MODULE_INFO);
             this.dir = dir;
+            this.openModule = openModule;
         }
 
         @Override
@@ -866,7 +877,7 @@
             }
 
             ModuleInfoBuilder builder
-                 = new ModuleInfoBuilder(config, inputArgs, dir);
+                 = new ModuleInfoBuilder(config, inputArgs, dir, openModule);
             boolean ok = builder.run();
 
             if (!ok && !options.nowarning) {
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,6 +26,8 @@
 package com.sun.tools.jdeps;
 
 import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Exports;
+import java.lang.module.ModuleDescriptor.Opens;
 import java.net.URI;
 import java.util.Collections;
 import java.util.HashMap;
@@ -240,18 +242,24 @@
         private StrictModule(Module m, Map<String, Boolean> requires) {
             super(m.name(), m.location, m.descriptor, m.exports, m.isSystem, m.reader());
 
-            ModuleDescriptor.Builder builder = new ModuleDescriptor.Builder(m.name());
+            ModuleDescriptor.Builder builder = ModuleDescriptor.module(m.name());
             requires.keySet().forEach(mn -> {
                 if (requires.get(mn).equals(Boolean.TRUE)) {
-                    builder.requires(ModuleDescriptor.Requires.Modifier.PUBLIC, mn);
+                    builder.requires(Set.of(ModuleDescriptor.Requires.Modifier.TRANSITIVE), mn);
                 } else {
                     builder.requires(mn);
                 }
             });
             m.descriptor.exports().forEach(e -> builder.exports(e));
+            m.descriptor.opens().forEach(o -> builder.opens(o));
             m.descriptor.uses().forEach(s -> builder.uses(s));
-            m.descriptor.provides().values().forEach(p -> builder.provides(p));
-            builder.conceals(m.descriptor.conceals());
+            m.descriptor.provides().forEach(p -> builder.provides(p));
+
+            Set<String> concealed = new HashSet<>(m.descriptor.packages());
+            m.descriptor.exports().stream().map(Exports::source).forEach(concealed::remove);
+            m.descriptor.opens().stream().map(Opens::source).forEach(concealed::remove);
+            concealed.forEach(builder::contains);
+
             this.md = builder.build();
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java	Thu Dec 01 09:02:42 2016 +0000
@@ -87,8 +87,8 @@
 
     public boolean run() throws IOException {
         try {
-            // compute "requires public" dependences
-            modules.values().forEach(ModuleDeps::computeRequiresPublic);
+            // compute "requires transitive" dependences
+            modules.values().forEach(ModuleDeps::computeRequiresTransitive);
 
             modules.values().forEach(md -> {
                 // compute "requires" dependences
@@ -104,7 +104,7 @@
 
     class ModuleDeps {
         final Module root;
-        Set<Module> requiresPublic;
+        Set<Module> requiresTransitive;
         Set<Module> requires;
         Map<String, Set<String>> unusedQualifiedExports;
 
@@ -113,15 +113,15 @@
         }
 
         /**
-         * Compute 'requires public' dependences by analyzing API dependencies
+         * Compute 'requires transitive' dependences by analyzing API dependencies
          */
-        private void computeRequiresPublic() {
-            // record requires public
-            this.requiresPublic = computeRequires(true)
+        private void computeRequiresTransitive() {
+            // record requires transitive
+            this.requiresTransitive = computeRequires(true)
                 .filter(m -> !m.name().equals(JAVA_BASE))
                 .collect(toSet());
 
-            trace("requires public: %s%n", requiresPublic);
+            trace("requires transitive: %s%n", requiresTransitive);
         }
 
         private void computeRequires() {
@@ -144,24 +144,24 @@
         }
 
         ModuleDescriptor descriptor() {
-            return descriptor(requiresPublic, requires);
+            return descriptor(requiresTransitive, requires);
         }
 
-        private ModuleDescriptor descriptor(Set<Module> requiresPublic,
+        private ModuleDescriptor descriptor(Set<Module> requiresTransitive,
                                             Set<Module> requires) {
 
-            ModuleDescriptor.Builder builder = new ModuleDescriptor.Builder(root.name());
+            ModuleDescriptor.Builder builder = ModuleDescriptor.module(root.name());
 
             if (!root.name().equals(JAVA_BASE))
-                builder.requires(MANDATED, JAVA_BASE);
+                builder.requires(Set.of(MANDATED), JAVA_BASE);
 
-            requiresPublic.stream()
+            requiresTransitive.stream()
                 .filter(m -> !m.name().equals(JAVA_BASE))
                 .map(Module::name)
-                .forEach(mn -> builder.requires(PUBLIC, mn));
+                .forEach(mn -> builder.requires(Set.of(TRANSITIVE), mn));
 
             requires.stream()
-                .filter(m -> !requiresPublic.contains(m))
+                .filter(m -> !requiresTransitive.contains(m))
                 .filter(m -> !m.name().equals(JAVA_BASE))
                 .map(Module::name)
                 .forEach(mn -> builder.requires(mn));
@@ -172,10 +172,10 @@
         private Graph<Module> buildReducedGraph() {
             ModuleGraphBuilder rpBuilder = new ModuleGraphBuilder(configuration);
             rpBuilder.addModule(root);
-            requiresPublic.stream()
+            requiresTransitive.stream()
                           .forEach(m -> rpBuilder.addEdge(root, m));
 
-            // requires public graph
+            // requires transitive graph
             Graph<Module> rbg = rpBuilder.build().reduce();
 
             ModuleGraphBuilder gb = new ModuleGraphBuilder(configuration);
@@ -198,7 +198,7 @@
          */
         ModuleDescriptor reduced() {
             Graph<Module> g = buildReducedGraph();
-            return descriptor(requiresPublic, g.adjacentNodes(root));
+            return descriptor(requiresTransitive, g.adjacentNodes(root));
         }
 
         /**
@@ -309,16 +309,16 @@
     }
 
     private boolean matches(ModuleDescriptor md, ModuleDescriptor other) {
-        // build requires public from ModuleDescriptor
-        Set<ModuleDescriptor.Requires> reqPublic = md.requires().stream()
-            .filter(req -> req.modifiers().contains(PUBLIC))
+        // build requires transitive from ModuleDescriptor
+        Set<ModuleDescriptor.Requires> reqTransitive = md.requires().stream()
+            .filter(req -> req.modifiers().contains(TRANSITIVE))
             .collect(toSet());
-        Set<ModuleDescriptor.Requires> otherReqPublic = other.requires().stream()
-            .filter(req -> req.modifiers().contains(PUBLIC))
+        Set<ModuleDescriptor.Requires> otherReqTransitive = other.requires().stream()
+            .filter(req -> req.modifiers().contains(TRANSITIVE))
             .collect(toSet());
 
-        if (!reqPublic.equals(otherReqPublic)) {
-            trace("mismatch requires public: %s%n", reqPublic);
+        if (!reqTransitive.equals(otherReqTransitive)) {
+            trace("mismatch requires transitive: %s%n", reqTransitive);
             return false;
         }
 
@@ -365,12 +365,12 @@
                 .sorted(Comparator.comparing(ModuleDescriptor::name))
                 .forEach(md -> {
                     String mn = md.name();
-                    Set<String> requiresPublic = md.requires().stream()
-                        .filter(d -> d.modifiers().contains(PUBLIC))
+                    Set<String> requiresTransitive = md.requires().stream()
+                        .filter(d -> d.modifiers().contains(TRANSITIVE))
                         .map(d -> d.name())
                         .collect(toSet());
 
-                    DotGraph.printEdges(out, graph, mn, requiresPublic);
+                    DotGraph.printEdges(out, graph, mn, requiresTransitive);
                 });
 
             out.println("}");
@@ -380,20 +380,20 @@
     /**
      * Returns a Graph of the given Configuration after transitive reduction.
      *
-     * Transitive reduction of requires public edge and requires edge have
-     * to be applied separately to prevent the requires public edges
+     * Transitive reduction of requires transitive edge and requires edge have
+     * to be applied separately to prevent the requires transitive edges
      * (e.g. U -> V) from being reduced by a path (U -> X -> Y -> V)
      * in which  V would not be re-exported from U.
      */
     private Graph<String> gengraph(Set<Module> modules) {
-        // build a Graph containing only requires public edges
+        // build a Graph containing only requires transitive edges
         // with transitive reduction.
         Graph.Builder<String> rpgbuilder = new Graph.Builder<>();
         for (Module module : modules) {
             ModuleDescriptor md = module.descriptor();
             String mn = md.name();
             md.requires().stream()
-                    .filter(d -> d.modifiers().contains(PUBLIC))
+                    .filter(d -> d.modifiers().contains(TRANSITIVE))
                     .map(d -> d.name())
                     .forEach(d -> rpgbuilder.addEdge(mn, d));
         }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Thu Dec 01 09:02:42 2016 +0000
@@ -178,7 +178,7 @@
         RootModule(String name) {
             super(name);
 
-            ModuleDescriptor.Builder builder = new ModuleDescriptor.Builder(name);
+            ModuleDescriptor.Builder builder = ModuleDescriptor.module(name);
             this.descriptor = builder.build();
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleGraphBuilder.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleGraphBuilder.java	Thu Dec 01 09:02:42 2016 +0000
@@ -98,7 +98,7 @@
             });
         });
 
-        // read requires public from ModuleDescriptor
+        // read requires transitive from ModuleDescriptor
         Module source;
         while ((source = deque.poll()) != null) {
             if (visited.contains(source))
@@ -107,7 +107,7 @@
             visited.add(source);
             builder.addNode(source);
             Module from = source;
-            requiresPublic(from).forEach(m -> {
+            requiresTransitive(from).forEach(m -> {
                 deque.add(m);
                 builder.addEdge(from, m);
             });
@@ -116,13 +116,13 @@
     }
 
     /*
-     * Returns a stream of modules upon which the given module `requires public`
+     * Returns a stream of modules upon which the given module `requires transitive`
      */
-    public Stream<Module> requiresPublic(Module m) {
-        // find requires public
+    public Stream<Module> requiresTransitive(Module m) {
+        // find requires transitive
         return m.descriptor()
                 .requires().stream()
-                .filter(req -> req.modifiers().contains(PUBLIC))
+                .filter(req -> req.modifiers().contains(TRANSITIVE))
                 .map(ModuleDescriptor.Requires::name)
                 .map(config::findModule)
                 .flatMap(Optional::stream);
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java	Thu Dec 01 09:02:42 2016 +0000
@@ -47,13 +47,14 @@
 import java.util.Optional;
 import java.util.Set;
 import java.util.function.Function;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import static java.util.stream.Collectors.*;
 
 
 public class ModuleInfoBuilder {
     final JdepsConfiguration configuration;
     final Path outputdir;
+    final boolean open;
 
     final DependencyFinder dependencyFinder;
     final Analyzer analyzer;
@@ -63,9 +64,11 @@
     final Map<Module, Module> automaticToExplicitModule;
     public ModuleInfoBuilder(JdepsConfiguration configuration,
                              List<String> args,
-                             Path outputdir) {
+                             Path outputdir,
+                             boolean open) {
         this.configuration = configuration;
         this.outputdir = outputdir;
+        this.open = open;
 
         this.dependencyFinder = new DependencyFinder(configuration, DEFAULT_FILTER);
         this.analyzer = new Analyzer(configuration, Type.CLASS, DEFAULT_FILTER);
@@ -73,13 +76,13 @@
         // add targets to modulepath if it has module-info.class
         List<Path> paths = args.stream()
             .map(fn -> Paths.get(fn))
-            .collect(Collectors.toList());
+            .collect(toList());
 
         // automatic module to convert to explicit module
         this.automaticToExplicitModule = ModuleFinder.of(paths.toArray(new Path[0]))
                 .findAll().stream()
                 .map(configuration::toModule)
-                .collect(Collectors.toMap(Function.identity(), Function.identity()));
+                .collect(toMap(Function.identity(), Function.identity()));
 
         Optional<Module> om = automaticToExplicitModule.keySet().stream()
                                     .filter(m -> !m.descriptor().isAutomatic())
@@ -96,7 +99,7 @@
     public boolean run() throws IOException {
         try {
             // pass 1: find API dependencies
-            Map<Archive, Set<Archive>> requiresPublic = computeRequiresPublic();
+            Map<Archive, Set<Archive>> requiresTransitive = computeRequiresTransitive();
 
             // pass 2: analyze all class dependences
             dependencyFinder.parse(automaticModules().stream());
@@ -105,13 +108,13 @@
 
             boolean missingDeps = false;
             for (Module m : automaticModules()) {
-                Set<Archive> apiDeps = requiresPublic.containsKey(m)
-                                            ? requiresPublic.get(m)
+                Set<Archive> apiDeps = requiresTransitive.containsKey(m)
+                                            ? requiresTransitive.get(m)
                                             : Collections.emptySet();
 
                 Path file = outputdir.resolve(m.name()).resolve("module-info.java");
 
-                // computes requires and requires public
+                // computes requires and requires transitive
                 Module explicitModule = toExplicitModule(m, apiDeps);
                 if (explicitModule != null) {
                     automaticToExplicitModule.put(m, explicitModule);
@@ -136,7 +139,7 @@
         return m == NOT_FOUND || m == REMOVED_JDK_INTERNALS;
     }
 
-    private Module toExplicitModule(Module module, Set<Archive> requiresPublic)
+    private Module toExplicitModule(Module module, Set<Archive> requiresTransitive)
         throws IOException
     {
         // done analysis
@@ -148,7 +151,7 @@
         }
 
         Map<String, Boolean> requires = new HashMap<>();
-        requiresPublic.stream()
+        requiresTransitive.stream()
             .map(Archive::getModule)
             .forEach(m -> requires.put(m.name(), Boolean.TRUE));
 
@@ -183,53 +186,60 @@
             });
     }
 
-    void writeModuleInfo(Path file, ModuleDescriptor descriptor) {
+    void writeModuleInfo(Path file, ModuleDescriptor md) {
         try {
             Files.createDirectories(file.getParent());
             try (PrintWriter pw = new PrintWriter(Files.newOutputStream(file))) {
-                printModuleInfo(pw, descriptor);
+                printModuleInfo(pw, md);
             }
         } catch (IOException e) {
             throw new UncheckedIOException(e);
         }
     }
 
-    private void printModuleInfo(PrintWriter writer, ModuleDescriptor descriptor) {
-        writer.format("module %s {%n", descriptor.name());
+    private void printModuleInfo(PrintWriter writer, ModuleDescriptor md) {
+        writer.format("%smodule %s {%n", open ? "open " : "", md.name());
 
         Map<String, Module> modules = configuration.getModules();
         // first print the JDK modules
-        descriptor.requires().stream()
-                  .filter(req -> !req.name().equals("java.base"))   // implicit requires
-                  .sorted(Comparator.comparing(Requires::name))
-                  .forEach(req -> writer.format("    requires %s;%n", req));
+        md.requires().stream()
+          .filter(req -> !req.name().equals("java.base"))   // implicit requires
+          .sorted(Comparator.comparing(Requires::name))
+          .forEach(req -> writer.format("    requires %s;%n", req));
 
-        descriptor.exports().stream()
-                  .peek(exp -> {
-                      if (exp.targets().size() > 0)
-                          throw new InternalError(descriptor.name() + " qualified exports: " + exp);
-                  })
-                  .sorted(Comparator.comparing(Exports::source))
-                  .forEach(exp -> writer.format("    exports %s;%n", exp.source()));
+        if (!open) {
+            md.exports().stream()
+              .peek(exp -> {
+                 if (exp.targets().size() > 0)
+                    throw new InternalError(md.name() + " qualified exports: " + exp);
+              })
+              .sorted(Comparator.comparing(Exports::source))
+              .forEach(exp -> writer.format("    exports %s;%n", exp.source()));
+        }
 
-        descriptor.provides().values().stream()
-                    .sorted(Comparator.comparing(Provides::service))
-                    .forEach(p -> p.providers().stream()
-                        .sorted()
-                        .forEach(impl -> writer.format("    provides %s with %s;%n", p.service(), impl)));
+        md.provides().stream()
+          .sorted(Comparator.comparing(Provides::service))
+          .map(p -> p.providers().stream()
+                     .map(impl -> "        " + impl.replace('$', '.'))
+                     .collect(joining(",\n",
+                                      String.format("    provides %s with%n",
+                                                    p.service().replace('$', '.')),
+                                      ";")))
+          .forEach(writer::println);
 
         writer.println("}");
     }
 
-
     private Set<Module> automaticModules() {
         return automaticToExplicitModule.keySet();
     }
 
     /**
-     * Compute 'requires public' dependences by analyzing API dependencies
+     * Compute 'requires transitive' dependences by analyzing API dependencies
      */
-    private Map<Archive, Set<Archive>> computeRequiresPublic() throws IOException {
+    private Map<Archive, Set<Archive>> computeRequiresTransitive()
+        throws IOException
+    {
         // parse the input modules
         dependencyFinder.parseExportedAPIs(automaticModules().stream());
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -125,6 +125,13 @@
 \  --generate-module-info <dir>  Generate module-info.java under the specified\n\
 \                                directory. The specified JAR files will be\n\
 \                                analyzed. This option cannot be used with\n\
+\                                --dot-output or --class-path. Use \n\
+\                                --generate-open-module option for open modules.
+
+main.opt.generate-open-module=\
+\  --generate-open-module <dir>  Generate module-info.java for the specified\n\
+\                                JAR files under the specified directory as\n\
+\                                open modules. This option cannot be used with\n\
 \                                --dot-output or --class-path.
 
 main.opt.check=\
--- a/langtools/src/jdk.jdeps/share/classes/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -33,9 +33,7 @@
     exports com.sun.tools.classfile to
         jdk.jlink;
 
-    provides java.util.spi.ToolProvider
-        with com.sun.tools.javap.Main.JavapToolProvider;
-
-    provides java.util.spi.ToolProvider
-        with com.sun.tools.jdeps.Main.JDepsToolProvider;
+    provides java.util.spi.ToolProvider with
+        com.sun.tools.javap.Main.JavapToolProvider,
+        com.sun.tools.jdeps.Main.JDepsToolProvider;
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties	Thu Dec 01 09:02:42 2016 +0000
@@ -126,7 +126,7 @@
 
 jshell.console.see.more = <\u8A73\u7D30\u306F\u3001\u30BF\u30D6\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044>
 jshell.console.do.nothing = \u4F55\u3082\u3057\u306A\u3044
-jshell.console.choice = \u9078\u629E: 
+jshell.console.choice = \u9078\u629E:
 jshell.console.create.variable = \u5909\u6570\u306E\u4F5C\u6210
 jshell.console.resolvable = \n\u8B58\u5225\u5B50\u306F\u3053\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u89E3\u6C7A\u3067\u304D\u307E\u3059\u3002
 jshell.console.no.candidate = \n\u30A4\u30F3\u30DD\u30FC\u30C8\u3059\u308B\u5019\u88DC\u306E\u5B8C\u5168\u4FEE\u98FE\u3055\u308C\u305F\u540D\u524D\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
--- a/langtools/src/jdk.jshell/share/classes/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -29,7 +29,7 @@
  * Read-Eval-Print Loops (REPLs).
  */
 module jdk.jshell {
-    requires public java.compiler;
+    requires transitive java.compiler;
     requires java.prefs;
     requires jdk.compiler;
     requires jdk.internal.le;
--- a/langtools/test/TEST.ROOT	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/TEST.ROOT	Thu Dec 01 09:02:42 2016 +0000
@@ -14,8 +14,8 @@
 # Group definitions
 groups=TEST.groups
 
-# Tests using jtreg 4.2 b03 features
-requiredVersion=4.2 b03
+# Tests using jtreg 4.2 b04 features
+requiredVersion=4.2 b04
 
 # Use new module options
 useNewOptions=true
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Thu Dec 01 09:02:42 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
+ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -181,6 +181,34 @@
         checkModuleFilesAndLinks(true);
     }
 
+    /**
+     * Test generated module pages for a deprecated module.
+     */
+    @Test
+    void testModuleDeprecation() {
+        javadoc("-d", "out-moduledepr",
+                "-tag", "regular:a:Regular Tag:",
+                "-tag", "moduletag:s:Module Tag:",
+                "--module-source-path", testSrc,
+                "--module", "module1,module2,moduletags",
+                "testpkgmdl1", "testpkgmdl2", "testpkgmdltags");
+        checkExit(Exit.OK);
+        checkModuleDeprecation(true);
+    }
+
+    /**
+     * Test annotations on modules.
+     */
+    @Test
+    void testModuleAnnotation() {
+        javadoc("-d", "out-moduleanno",
+                "--module-source-path", testSrc,
+                "--module", "module1,module2",
+                "testpkgmdl1", "testpkgmdl2");
+        checkExit(Exit.OK);
+        checkModuleAnnotation();
+    }
+
     void checkDescription(boolean found) {
         checkOutput("module1-summary.html", found,
                 "<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -218,6 +246,9 @@
     void checkHtml5Description(boolean found) {
         checkOutput("module1-summary.html", found,
                 "<section role=\"region\">\n"
+                + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</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"
@@ -556,4 +587,37 @@
                 + "<dd>&nbsp;</dd>\n"
                 + "</dl>");
 }
+
+    void checkModuleDeprecation(boolean found) {
+        checkOutput("module1-summary.html", found,
+                "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</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=\"#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"
+                + "<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,
+                "<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,
+                "<p>@Deprecated\n"
+                + "</p>",
+                "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span></div>");
+    }
+
+    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"
+                + "</p>");
+        checkOutput("module2-summary.html", false,
+                "@AnnotationTypeUndocumented");
 }
+}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module1/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/module1/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -25,7 +25,10 @@
 
 /**
   * 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;
 
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/module2/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -25,7 +25,11 @@
 
 /**
   * 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;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationType.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+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();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationTypeUndocumented.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 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/moduletags/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -37,6 +37,7 @@
   * @moduletag Just a simple module tag.
   * @version 1.0
   */
+@Deprecated
 module moduletags {
     requires module2;
 
--- a/langtools/test/jdk/javadoc/tool/modules/Modules.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/javadoc/tool/modules/Modules.java	Thu Dec 01 09:02:42 2016 +0000
@@ -393,14 +393,14 @@
      * Module M : test module, with variable requires
      *
      * Module N :
-     *     requires public O  --->   Module O:
-     *                                 requires J   ---->   Module J:
-     *                                 exports openO          exports openJ
+     *     requires transitive O  --->   Module O:
+     *                                   requires J   ---->   Module J:
+     *                                   exports openO          exports openJ
      *
      *
      * Module L :
-     *     requires public P  --->   Module P:
-     *                                 exports openP
+     *     requires transitive P  --->   Module P:
+     *                                   exports openP
      *
      *
      */
@@ -431,14 +431,14 @@
     }
 
     @Test
-    public void testExpandRequiresPublic(Path base) throws Exception {
+    public void testExpandRequiresTransitive(Path base) throws Exception {
         Path src = base.resolve("src");
 
         createAuxiliaryModules(src);
 
         new ModuleBuilder(tb, "M")
                 .comment("The M module.")
-                .requiresPublic("N", src)
+                .requiresTransitive("N", src)
                 .requires("L", src)
                 .exports("p")
                 .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
@@ -446,7 +446,7 @@
 
         execTask("--module-source-path", src.toString(),
                 "--module", "M",
-                "--expand-requires", "public");
+                "--expand-requires", "transitive");
 
         checkModulesSpecified("M", "N", "O");
         checkModulesIncluded("M", "N", "O");
@@ -462,7 +462,7 @@
 
         new ModuleBuilder(tb, "M")
                 .comment("The M module.")
-                .requiresPublic("N", src)
+                .requiresTransitive("N", src)
                 .requires("L", src)
                 .requires("O", src)
                 .exports("p")
@@ -490,7 +490,7 @@
 
         new ModuleBuilder(tb, "M")
                 .comment("The M module.")
-                .requiresPublic("N", src)
+                .requiresTransitive("N", src)
                 .requires("L", src)
                 .requires("O", src)
                 .exports("p")
@@ -512,7 +512,7 @@
 
         new ModuleBuilder(tb, "M")
                 .comment("The M module.")
-                .requiresPublic("N", src)
+                .requiresTransitive("N", src)
                 .requires("L", src)
                 .requires("O", src)
                 .exports("p")
@@ -538,7 +538,7 @@
         new ModuleBuilder(tb, "L")
                 .comment("The L module.")
                 .exports("openL")
-                .requiresPublic("P")
+                . requiresTransitive("P")
                 .classes("package openL; /** Class L open */ public class L { }")
                 .classes("package closedL;  /** Class L closed */ public class L { }")
                 .write(src);
@@ -546,7 +546,7 @@
         new ModuleBuilder(tb, "N")
                 .comment("The N module.")
                 .exports("openN")
-                .requiresPublic("O")
+                .requiresTransitive("O")
                 .classes("package openN; /** Class N open */ public class N  { }")
                 .classes("package closedN; /** Class N closed */ public class N { }")
                 .write(src);
--- a/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -29,6 +29,7 @@
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
+ *          jdk.jshell/jdk.jshell:open
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
  * @run testng CompletionSuggestionTest
--- a/langtools/test/jdk/jshell/ComputeFQNsTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/jshell/ComputeFQNsTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,6 +28,7 @@
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jshell/jdk.jshell:open
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
  * @run testng ComputeFQNsTest
--- a/langtools/test/jdk/jshell/HistoryTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/jshell/HistoryTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8166744
  * @summary Test Completion
  * @modules jdk.internal.le/jdk.internal.jline.extra
- *          jdk.jshell/jdk.internal.jshell.tool
+ *          jdk.jshell/jdk.internal.jshell.tool:+open
  * @build HistoryTest
  * @run testng HistoryTest
  */
--- a/langtools/test/jdk/jshell/JavadocTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/jshell/JavadocTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,7 +28,7 @@
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jshell
+ *          jdk.jshell/jdk.jshell:open
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
  * @run testng JavadocTest
--- a/langtools/test/jdk/jshell/PipeInputStreamTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/jdk/jshell/PipeInputStreamTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -25,7 +25,7 @@
  * @test 8167461
  * @summary Verify PipeInputStream works.
  * @modules jdk.compiler/com.sun.tools.javac.util
- *          jdk.jshell
+ *          jdk.jshell/jdk.jshell.execution:open
  * @run testng PipeInputStreamTest
  */
 
--- a/langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1188,7 +1188,7 @@
         }
 
         @Override
-        public Void visitConcealedPackages(ConcealedPackages_attribute attr, T p) {
+        public Void visitModulePackages(ModulePackages_attribute attr, T p) {
             return null;
         }
 
@@ -1238,7 +1238,7 @@
         }
 
         @Override
-        public Void visitHashes(Hashes_attribute attr, T p) {
+        public Void visitModuleHashes(ModuleHashes_attribute attr, T p) {
             return null;
         }
 
@@ -1263,7 +1263,7 @@
         }
 
         @Override
-        public Void visitMainClass(MainClass_attribute attr, T p) {
+        public Void visitModuleMainClass(ModuleMainClass_attribute attr, T p) {
             return null;
         }
 
@@ -1343,12 +1343,12 @@
         }
 
         @Override
-        public Void visitTargetPlatform(TargetPlatform_attribute attr, T p) {
+        public Void visitModuleTarget(ModuleTarget_attribute attr, T p) {
             return null;
         }
 
         @Override
-        public Void visitVersion(Version_attribute attr, T p) {
+        public Void visitModuleVersion(ModuleVersion_attribute attr, T p) {
             return null;
         }
 
--- a/langtools/test/tools/javac/6304921/TestLog.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/6304921/TestLog.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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
@@ -28,7 +28,7 @@
  * @modules jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.parser
  *          jdk.compiler/com.sun.tools.javac.tree
- *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.compiler/com.sun.tools.javac.util:+open
  */
 import java.lang.reflect.Field;
 import java.io.InputStream;
--- a/langtools/test/tools/javac/6410653/T6410653.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/6410653/T6410653.java	Thu Dec 01 09:02:42 2016 +0000
@@ -27,7 +27,7 @@
  * @summary REGRESSION: javac crashes if -d or -s argument is a file
  * @author  Peter von der Ah\u00e9
  * @modules java.compiler
- *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.compiler/com.sun.tools.javac.util:open
  */
 
 import java.lang.reflect.Field;
--- a/langtools/test/tools/javac/MethodParameters/AnnotationTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters AnnotationTest.java
  * @run main MethodParametersTester AnnotationTest AnnotationTest.out
  */
--- a/langtools/test/tools/javac/MethodParameters/AnonymousClass.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters AnonymousClass.java
  * @run main MethodParametersTester AnonymousClass AnonymousClass.out
  */
--- a/langtools/test/tools/javac/MethodParameters/AttributeVisitor.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/AttributeVisitor.java	Thu Dec 01 09:02:42 2016 +0000
@@ -34,19 +34,21 @@
     public R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p) { return null; }
     public R visitCode(Code_attribute attr, P p) { return null; }
     public R visitCompilationID(CompilationID_attribute attr, P p) { return null; }
-    public R visitConcealedPackages(ConcealedPackages_attribute attr, P p) { return null; }
     public R visitConstantValue(ConstantValue_attribute attr, P p) { return null; }
     public R visitDeprecated(Deprecated_attribute attr, P p) { return null; }
     public R visitEnclosingMethod(EnclosingMethod_attribute attr, P p) { return null; }
     public R visitExceptions(Exceptions_attribute attr, P p) { return null; }
-    public R visitHashes(Hashes_attribute attr, P p) { return null; }
     public R visitInnerClasses(InnerClasses_attribute attr, P p) { return null; }
     public R visitLineNumberTable(LineNumberTable_attribute attr, P p) { return null; }
     public R visitLocalVariableTable(LocalVariableTable_attribute attr, P p) { return null; }
     public R visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, P p) { return null; }
-    public R visitMainClass(MainClass_attribute attr, P p) { return null; }
     public R visitMethodParameters(MethodParameters_attribute attr, P p) { return null; }
     public R visitModule(Module_attribute attr, P p) { return null; }
+    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 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; }
@@ -60,6 +62,4 @@
     public R visitStackMap(StackMap_attribute attr, P p) { return null; }
     public R visitStackMapTable(StackMapTable_attribute attr, P p) { return null; }
     public R visitSynthetic(Synthetic_attribute attr, P p) { return null; }
-    public R visitTargetPlatform(TargetPlatform_attribute attr, P p) { return null; }
-    public R visitVersion(Version_attribute attr, P p) { return null; }
 }
--- a/langtools/test/tools/javac/MethodParameters/Constructors.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters Constructors.java
  * @run main MethodParametersTester Constructors Constructors.out
  */
--- a/langtools/test/tools/javac/MethodParameters/EnumTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582 8008658
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters EnumTest.java
  * @run main MethodParametersTester EnumTest EnumTest.out
  */
--- a/langtools/test/tools/javac/MethodParameters/InstanceMethods.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters InstanceMethods.java
  * @run main MethodParametersTester InstanceMethods InstanceMethods.out
  */
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582 8037546 8138729
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters LambdaTest.java
  * @run main MethodParametersTester LambdaTest LambdaTest.out
  */
--- a/langtools/test/tools/javac/MethodParameters/LocalClassTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582 8008658
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters LocalClassTest.java
  * @run main MethodParametersTester LocalClassTest LocalClassTest.out
  */
--- a/langtools/test/tools/javac/MethodParameters/MemberClassTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582 8008658
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters MemberClassTest.java
  * @run main MethodParametersTester MemberClassTest MemberClassTest.out
  */
--- a/langtools/test/tools/javac/MethodParameters/StaticMethods.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters StaticMethods.java
  * @run main MethodParametersTester StaticMethods StaticMethods.out
  */
--- a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java	Thu Dec 01 09:02:42 2016 +0000
@@ -26,7 +26,7 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build MethodParametersTester
+ * @build MethodParametersTester ClassFileVisitor ReflectionVisitor
  * @compile -parameters UncommonParamNames.java
  * @run main MethodParametersTester UncommonParamNames UncommonParamNames.out
  */
--- a/langtools/test/tools/javac/T6435291/T6435291.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/T6435291/T6435291.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/langtools/test/tools/javac/api/6400303/T6400303.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/api/6400303/T6400303.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/langtools/test/tools/javac/api/TestResolveIdent.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/api/TestResolveIdent.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -24,8 +24,9 @@
 /*
  * @test
  * @summary Module attribute tests
- * @bug 8080878
- * @modules jdk.compiler/com.sun.tools.javac.api
+ * @bug 8080878 8161906 8162713
+ * @modules java.compiler
+ *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
@@ -56,7 +57,7 @@
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
                 .exports("pack")
                 .write(base);
-        tb.writeJavaFiles(base, "package pack; public class C extends java.util.ArrayList{}");
+        tb.writeJavaFiles(base, "package pack; public class C extends java.util.ArrayList{ }");
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
     }
@@ -67,11 +68,15 @@
                 .exports("pack")
                 .exports("pack2")
                 .exports("pack3")
+                .exports("pack4")
+                .exports("pack5")
                 .write(base);
         tb.writeJavaFiles(base,
-                "package pack; public class A {}",
-                "package pack2; public class B {}",
-                "package pack3; public class C {}");
+                "package pack; public class A { }",
+                "package pack2; public class B { }",
+                "package pack3; public class C { }",
+                "package pack4; public class C { }",
+                "package pack5; public class C { }");
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
     }
@@ -81,7 +86,17 @@
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
                 .exportsTo("pack", "jdk.compiler")
                 .write(base);
-        tb.writeJavaFiles(base, "package pack; public class A {}");
+        tb.writeJavaFiles(base, "package pack; public class A { }");
+        compile(base);
+        testModuleAttribute(base, moduleDescriptor);
+    }
+
+    @Test
+    public void testQualifiedDynamicExports(Path base) throws Exception {
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+                .exportsTo("pack", "jdk.compiler")
+                .write(base);
+        tb.writeJavaFiles(base, "package pack; public class A { }");
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
     }
@@ -89,14 +104,18 @@
     @Test
     public void testSeveralQualifiedExports(Path base) throws Exception {
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
-                .exportsTo("pack", "jdk.compiler, java.xml")
-                .exportsTo("pack2", "java.xml")
+                .exportsTo("pack", "jdk.compiler, jdk.jdeps")
+                .exportsTo("pack2", "jdk.jdeps")
                 .exportsTo("pack3", "jdk.compiler")
+                .exportsTo("pack4", "jdk.compiler, jdk.jdeps")
+                .exportsTo("pack5", "jdk.compiler")
                 .write(base);
         tb.writeJavaFiles(base,
                 "package pack; public class A {}",
                 "package pack2; public class B {}",
-                "package pack3; public class C {}");
+                "package pack3; public class C {}",
+                "package pack4; public class C {}",
+                "package pack5; public class C {}");
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
     }
@@ -111,9 +130,18 @@
     }
 
     @Test
-    public void testRequiresPublic(Path base) throws Exception {
+    public void testRequiresTransitive(Path base) throws Exception {
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
-                .requiresPublic("java.xml")
+                .requires("jdk.jdeps", RequiresFlag.TRANSITIVE)
+                .write(base);
+        compile(base);
+        testModuleAttribute(base, moduleDescriptor);
+    }
+
+    @Test
+    public void testRequiresStatic(Path base) throws Exception {
+        ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
+                .requires("jdk.jdeps", RequiresFlag.STATIC)
                 .write(base);
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
@@ -122,13 +150,20 @@
     @Test
     public void testSeveralRequires(Path base) throws Exception {
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
-                .requiresPublic("java.xml")
-                .requires("java.compiler")
+                .requires("jdk.jdeps", RequiresFlag.TRANSITIVE)
                 .requires("jdk.compiler")
-                .requiresPublic("jdk.scripting.nashorn")
-                .write(base);
-        compile(base);
-        testModuleAttribute(base, moduleDescriptor);
+                .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 { }");
+        compile(base, "--module-source-path", base.toString(),
+                "-d", base.toString());
+        testModuleAttribute(base.resolve("m1"), moduleDescriptor);
     }
 
     @Test
@@ -136,7 +171,7 @@
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
                 .provides("java.util.Collection", "pack2.D")
                 .write(base);
-        tb.writeJavaFiles(base, "package pack2; public class D extends java.util.ArrayList{}");
+        tb.writeJavaFiles(base, "package pack2; public class D extends java.util.ArrayList{ }");
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
     }
@@ -146,15 +181,11 @@
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
                 .provides("java.util.Collection", "pack2.D")
                 .provides("java.util.List", "pack2.D")
-                .requires("java.logging")
-                .provides("java.util.logging.Logger", "pack2.C")
+                .requires("jdk.compiler")
+                .provides("com.sun.tools.javac.Main", "pack2.C")
                 .write(base);
-        tb.writeJavaFiles(base, "package pack2; public class D extends java.util.ArrayList{}",
-                "package pack2; public class C extends java.util.logging.Logger{ " +
-                        "public C() { super(\"\",\"\"); } \n" +
-                        "C(String a,String b){" +
-                        "    super(a,b);" +
-                        "}}");
+        tb.writeJavaFiles(base, "package pack2; public class D extends java.util.ArrayList{ }",
+                "package pack2; public class C extends com.sun.tools.javac.Main{ }");
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
     }
@@ -173,8 +204,8 @@
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
                 .uses("java.util.List")
                 .uses("java.util.Collection")
-                .requires("java.logging")
-                .uses("java.util.logging.Logger")
+                .requires("jdk.compiler")
+                .uses("javax.tools.JavaCompiler")
                 .write(base);
         compile(base);
         testModuleAttribute(base, moduleDescriptor);
@@ -182,26 +213,44 @@
 
     @Test
     public void testComplex(Path base) throws Exception {
+        Path m1 = base.resolve("m1");
         ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1")
                 .exports("pack1")
-                .exportsTo("packTo1", "java.xml")
+                .exports("pack3")
+                .exportsTo("packTo1", "m2")
+                .exportsTo("packTo3", "m3")
                 .requires("jdk.compiler")
-                .requiresPublic("java.xml")
-                .provides("java.util.List", "pack1.C")
+                .requires("m2", RequiresFlag.TRANSITIVE)
+                .requires("m3", RequiresFlag.STATIC)
+                .requires("m4", RequiresFlag.TRANSITIVE, RequiresFlag.STATIC)
+                .provides("java.util.List", "pack1.C", "pack2.D")
                 .uses("java.util.List")
                 .uses("java.nio.file.Path")
-                .provides("java.util.List", "pack2.D")
-                .requiresPublic("java.desktop")
+                .requires("jdk.jdeps", RequiresFlag.STATIC, RequiresFlag.TRANSITIVE)
+                .requires("m5", RequiresFlag.STATIC)
+                .requires("m6", RequiresFlag.TRANSITIVE)
                 .requires("java.compiler")
+                .exportsTo("packTo4", "java.compiler")
                 .exportsTo("packTo2", "java.compiler")
+                .exports("pack4")
                 .exports("pack2")
-                .write(base);
-        tb.writeJavaFiles(base, "package pack1; public class C extends java.util.ArrayList{}",
-                "package pack2; public class D extends java.util.ArrayList{}");
-        tb.writeJavaFiles(base,
+                .write(m1);
+        tb.writeJavaFiles(m1, "package pack1; public class C extends java.util.ArrayList{ }",
+                "package pack2; public class D extends java.util.ArrayList{ }",
+                "package pack3; public class D extends java.util.ArrayList{ }",
+                "package pack4; public class D extends java.util.ArrayList{ }");
+        tb.writeJavaFiles(m1,
                 "package packTo1; public class T1 {}",
-                "package packTo2; public class T2 {}");
-        compile(base);
-        testModuleAttribute(base, moduleDescriptor);
+                "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 { }");
+        compile(base, "--module-source-path", base.toString(),
+                "-d", base.toString());
+        testModuleAttribute(m1, moduleDescriptor);
     }
 }
--- a/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java	Thu Dec 01 09:02:42 2016 +0000
@@ -38,6 +38,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
@@ -86,7 +87,8 @@
         List<Pair<String, Integer>> actualRequires = new ArrayList<>();
         for (Module_attribute.RequiresEntry require : module.requires) {
             actualRequires.add(Pair.of(
-                    require.getRequires(constantPool), require.requires_flags));
+                    require.getRequires(constantPool).replace('/', '.'),
+                    require.requires_flags));
         }
         tr.checkContains(actualRequires, moduleDescriptor.requires, "Lists of requires don't match");
     }
@@ -96,11 +98,13 @@
         for (Module_attribute.ExportsEntry export : module.exports) {
             String pkg = constantPool.getUTF8Value(export.exports_index);
             if (tr.checkTrue(moduleDescriptor.exports.containsKey(pkg), "Unexpected export " + pkg)) {
-                List<String> expectedTo = moduleDescriptor.exports.get(pkg);
+                Export expectedExport = moduleDescriptor.exports.get(pkg);
+                tr.checkEquals(expectedExport.mask, export.exports_flags, "Wrong export flags");
+                List<String> expectedTo = expectedExport.to;
                 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));
+                    actualTo.add(constantPool.getUTF8Value(toIdx).replace('/', '.'));
                 }
                 tr.checkContains(actualTo, expectedTo, "Lists of \"exports to\" don't match.");
             }
@@ -118,14 +122,24 @@
     }
 
     private void testProvides(ModuleDescriptor moduleDescriptor, Module_attribute module, ConstantPool constantPool) throws ConstantPoolException {
-        tr.checkEquals(module.provides_count, moduleDescriptor.provides.size(), "Wrong amount of provides.");
-        List<Pair<String, String>> actualProvides = new ArrayList<>();
+        int moduleProvidesCount = Arrays.asList(module.provides).stream()
+                .mapToInt(e -> e.with_index.length)
+                .sum();
+        int moduleDescriptorProvidesCount = moduleDescriptor.provides.values().stream()
+                .mapToInt(impls -> impls.size())
+                .sum();
+        tr.checkEquals(moduleProvidesCount, moduleDescriptorProvidesCount, "Wrong amount of provides.");
+        Map<String, List<String>> actualProvides = new HashMap<>();
         for (Module_attribute.ProvidesEntry provide : module.provides) {
             String provides = constantPool.getClassInfo(provide.provides_index).getBaseName().replace('/', '.');
-            String with = constantPool.getClassInfo(provide.with_index).getBaseName().replace('/', '.');
-            actualProvides.add(Pair.of(provides, with));
+            List<String> impls = new ArrayList<>();
+            for (int i = 0; i < provide.with_count; i++) {
+                String with = constantPool.getClassInfo(provide.with_index[i]).getBaseName().replace('/', '.');
+                impls.add(with);
+            }
+            actualProvides.put(provides, impls);
         }
-        tr.checkContains(actualProvides, moduleDescriptor.provides, "Lists of provides don't match");
+        tr.checkContains(actualProvides.entrySet(), moduleDescriptor.provides.entrySet(), "Lists of provides don't match");
     }
 
     protected void compile(Path base, String... options) throws IOException {
@@ -145,7 +159,57 @@
     @interface Test {
     }
 
-    class ModuleDescriptor {
+    interface Mask {
+        int getMask();
+    }
+
+    public enum RequiresFlag implements Mask {
+        TRANSITIVE("transitive", Module_attribute.ACC_TRANSITIVE),
+        STATIC("static", Module_attribute.ACC_STATIC_PHASE);
+
+        private final String token;
+        private final int mask;
+
+        RequiresFlag(String token, int mask) {
+            this.token = token;
+            this.mask = mask;
+        }
+
+        @Override
+        public int getMask() {
+            return mask;
+        }
+    }
+
+    public enum ExportFlag implements Mask {
+        SYNTHETIC("", Module_attribute.ACC_SYNTHETIC);
+
+        private final String token;
+        private final int mask;
+
+        ExportFlag(String token, int mask) {
+            this.token = token;
+            this.mask = mask;
+        }
+
+        @Override
+        public int getMask() {
+            return mask;
+        }
+    }
+
+    private class Export {
+        String pkg;
+        int mask;
+        List<String> to = new ArrayList<>();
+
+        public Export(String pkg, int mask) {
+            this.pkg = pkg;
+            this.mask = mask;
+        }
+    }
+
+    protected class ModuleDescriptor {
 
         private final String name;
         //pair is name of module and flag(public,mandated,synthetic)
@@ -155,10 +219,10 @@
             requires.add(new Pair<>("java.base", Module_attribute.ACC_MANDATED));
         }
 
-        private final Map<String, List<String>> exports = new HashMap<>();
+        private final Map<String, Export> exports = new HashMap<>();
 
         //List of service and implementation
-        private final List<Pair<String, String>> provides = new ArrayList<>();
+        private final Map<String, List<String>> provides = new LinkedHashMap<>();
         private final List<String> uses = new ArrayList<>();
 
         private static final String LINE_END = ";\n";
@@ -170,43 +234,58 @@
             content.append(name).append('{').append('\n');
         }
 
-        public ModuleDescriptor requires(String... requires) {
-            for (String require : requires) {
-                this.requires.add(Pair.of(require, 0));
-                content.append("    requires ").append(require).append(LINE_END);
-            }
+        public ModuleDescriptor requires(String module) {
+            this.requires.add(Pair.of(module, 0));
+            content.append("    requires ").append(module).append(LINE_END);
+
             return this;
         }
 
-        public ModuleDescriptor requiresPublic(String... requiresPublic) {
-            for (String require : requiresPublic) {
-                this.requires.add(new Pair<>(require, Module_attribute.ACC_PUBLIC));
-                content.append("    requires public ").append(require).append(LINE_END);
+        public ModuleDescriptor requires(String module, RequiresFlag... flags) {
+            this.requires.add(new Pair<>(module, computeMask(flags)));
+
+            content.append("    requires ");
+            for (RequiresFlag flag : flags) {
+                content.append(flag.token).append(" ");
             }
+            content.append(module).append(LINE_END);
+
             return this;
         }
 
-        public ModuleDescriptor exports(String... exports) {
-            for (String export : exports) {
-                this.exports.putIfAbsent(export, new ArrayList<>());
-                content.append("    exports ").append(export).append(LINE_END);
+        public ModuleDescriptor exports(String pkg, ExportFlag... flags) {
+            this.exports.putIfAbsent(pkg, new Export(pkg, computeMask(flags)));
+            content.append("    exports ");
+            for (ExportFlag flag : flags) {
+                content.append(flag.token).append(" ");
             }
+            content.append(pkg).append(LINE_END);
             return this;
         }
 
-        public ModuleDescriptor exportsTo(String exports, String to) {
+        public ModuleDescriptor exportsTo(String pkg, String to, ExportFlag... flags) {
             List<String> tos = Pattern.compile(",")
                     .splitAsStream(to)
                     .map(String::trim)
                     .collect(Collectors.toList());
-            this.exports.computeIfAbsent(exports, k -> new ArrayList<>()).addAll(tos);
-            content.append("    exports ").append(exports).append(" to ").append(to).append(LINE_END);
+            this.exports.computeIfAbsent(pkg, k -> new Export(pkg, computeMask(flags)))
+                    .to.addAll(tos);
+
+            content.append("    exports ");
+            for (ExportFlag flag : flags) {
+                content.append(flag.token).append(" ");
+            }
+            content.append(pkg).append(" to ").append(to).append(LINE_END);
             return this;
         }
 
-        public ModuleDescriptor provides(String provides, String with) {
-            this.provides.add(Pair.of(provides, with));
-            content.append("    provides ").append(provides).append(" with ").append(with).append(LINE_END);
+        public ModuleDescriptor provides(String provides, String... with) {
+            this.provides.put(provides, Arrays.asList(with));
+            content.append("    provides ")
+                    .append(provides)
+                    .append(" with ")
+                    .append(String.join(",", with))
+                    .append(LINE_END);
             return this;
         }
 
@@ -225,5 +304,12 @@
             tb.writeJavaFiles(path, src);
             return this;
         }
+
+        private int computeMask(Mask[] masks) {
+            return Arrays.stream(masks)
+                    .map(Mask::getMask)
+                    .reduce((a, b) -> a | b)
+                    .orElseGet(() -> 0);
+        }
     }
 }
--- a/langtools/test/tools/javac/defaultMethods/BadClassfile.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/defaultMethods/BadClassfile.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Thu Dec 01 09:02:42 2016 +0000
@@ -69,6 +69,8 @@
 compiler.misc.module.name.mismatch
 compiler.misc.no.unique.minimal.instance.exists
 compiler.misc.no.unique.maximal.instance.exists         # cannot happen?
+compiler.err.module.non.zero.opens                      # bad class file
+compiler.misc.module.non.zero.opens                     # bad class file
 compiler.misc.resume.abort                              # prompt for a response
 compiler.misc.source.unavailable                        # DiagnosticSource
 compiler.misc.token.bad-symbol
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/AddOpensIgnored.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,28 @@
+/*
+ * 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
+ * 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.addopens.ignored
+// options: --add-opens anything
+
+class Dummy { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingExports/exported/Class.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 Class {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingExports/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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.err.conflicting.exports
+
+module ConflictingExports {
+     exports exported;
+     exports exported;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingExportsToModule/exported/Class.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 Class {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingExportsToModule/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ */
+
+// key: compiler.err.conflicting.exports.to.module
+
+module ConflictingExports {
+     exports exported to java.base, java.base;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingOpens/exported/Class.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 opened;
+
+public class Class {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingOpens/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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.err.conflicting.opens
+
+module ConflictingOpens {
+     opens opened;
+     opens opened;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingOpensToModule/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ */
+
+// key: compiler.err.conflicting.opens.to.module
+
+module ConflictingOpens {
+     opens opened to java.base, java.base;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConflictingOpensToModule/opened/Class.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 opened;
+
+public class Class {
+}
--- a/langtools/test/tools/javac/diags/examples/DuplicateExports/exported/Class.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 Class {
-}
--- a/langtools/test/tools/javac/diags/examples/DuplicateExports/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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.
- *
- * 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.err.duplicate.exports
-
-module DuplicateExports {
-     exports exported;
-     exports exported;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ExpectedModule.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ */
+
+// key: compiler.err.expected.module
+
+open class ExpectedModule { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/HasBeenDeprecatedModule.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.has.been.deprecated.module
+//options: -Xlint:deprecation
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m1/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 m1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m2/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 m2 {
+    requires m1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/HasBeenDeprecatedRemovalModule.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ */
+
+//key: compiler.warn.has.been.deprecated.for.removal.module
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m1/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 m1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m2/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 m2 {
+    requires m1;
+}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/LeaksNotAccessibleNotRequiredPublic.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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.
- */
-
-// key: compiler.warn.leaks.not.accessible.not.required.public
-// options: -Xlint:exports
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m1/api1/Api1.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m1/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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;
-}
--- a/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m2/api2/Api2.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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/LeaksNotAccessibleNotRequiredPublic/modulesourcepath/m2/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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/LeaksNotAccessibleNotRequiredTransitive.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.leaks.not.accessible.not.required.transitive
+// options: -Xlint:exports
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/api1/Api1.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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/m1/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 m1 {
+     exports api1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/api2/Api2.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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/m2/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 m2 {
+     requires m1;
+     exports api2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoOpensUnlessStrong/exported/Class.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 Class {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoOpensUnlessStrong/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ */
+
+// key: compiler.err.no.opens.unless.strong
+
+open module ConflictingExports {
+     opens exported;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoPkgInModuleInfoJava/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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.err.no.pkg.in.module-info.java
+
+package p;
+
+module m {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ */
+
+// key: compiler.err.service.implementation.provider.return.must.be.subtype.of.service.interface
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf/modulesourcepath/m/impl/Impl.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 impl;
+
+public class Impl {
+    public static Impl provider() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplProviderReturnMustBeSubtypeOfServiceIntf/modulesourcepath/m/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 {
+    provides java.lang.String with impl.Impl;
+}
--- a/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -83,10 +83,13 @@
         // need to ensure there is an empty java.base to avoid different error message
         Files.createDirectories(Paths.get("modules/java.base"));
         new JavacTask(tb)
-                .sources("module java.base { }")
+                .sources("module java.base { }",
+                         "package java.lang; public class Object {}")
                 .outdir("modules/java.base")
                 .run();
 
+        Files.delete(Paths.get("modules", "java.base", "java", "lang", "Object.class"));
+
         // ideally we'd have a better message for this case
         String[] mpOpts = { "--system", "none", "--module-path", "modules" };
         test(mpOpts, compilerErrorMessage);
--- a/langtools/test/tools/javac/modules/AnnotationProcessing.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/AnnotationProcessing.java	Thu Dec 01 09:02:42 2016 +0000
@@ -245,7 +245,7 @@
             List<? extends ProvidesDirective> provides = ElementFilter.providesIn(modle.getDirectives());
             assertEquals(1, provides.size());
             assertEquals("api.Api", provides.iterator().next().getService().getQualifiedName().toString());
-            assertEquals("impl.Impl", provides.iterator().next().getImplementation().getQualifiedName().toString());
+            assertEquals("impl.Impl", provides.iterator().next().getImplementations().get(0).getQualifiedName().toString());
 
             return false;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/AnnotationsOnModules.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,405 @@
+/*
+ * 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
+ * @summary Test --add-modules and --limit-modules; also test the "enabled" modules.
+ * @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
+ * @run main AnnotationsOnModules
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedOptions;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.TypeElement;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
+import toolbox.JavacTask;
+import toolbox.Task.OutputKind;
+
+public class AnnotationsOnModules extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        AnnotationsOnModules t = new AnnotationsOnModules();
+        t.runTests();
+    }
+
+    @Test
+    public void testSimpleAnnotation(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1");
+
+        tb.writeJavaFiles(m1,
+                          "@Deprecated module m1 { }");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", moduleSrc.toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll();
+
+        ClassFile cf = ClassFile.read(modulePath.resolve("m1").resolve("module-info.class"));
+        RuntimeVisibleAnnotations_attribute annotations = (RuntimeVisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeVisibleAnnotations);
+
+        if (annotations == null || annotations.annotations.length != 1) {
+            throw new AssertionError("Annotations not correct!");
+        }
+    }
+
+    @Test
+    public void testAnnotationWithImport(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1");
+
+        tb.writeJavaFiles(m1,
+                          "import m1.A; @A module m1 { }",
+                          "package m1; 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", moduleSrc.toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll();
+
+        ClassFile cf = ClassFile.read(modulePath.resolve("m1").resolve("module-info.class"));
+        RuntimeInvisibleAnnotations_attribute annotations = (RuntimeInvisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeInvisibleAnnotations);
+
+        if (annotations == null || annotations.annotations.length != 1) {
+            throw new AssertionError("Annotations not correct!");
+        }
+    }
+
+    @Test
+    public void testModuleInfoAnnotationsInAPI(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1");
+
+        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(); }");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", moduleSrc.toString(),
+                         "-processor", AP.class.getName())
+                .outdir(modulePath)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll();
+
+        Path src = base.resolve("src");
+
+        tb.writeJavaFiles(src,
+                          "class T {}");
+
+        Path out = base.resolve("out");
+
+        Files.createDirectories(out);
+
+        new JavacTask(tb)
+                .options("--module-path", modulePath.toString(),
+                         "--add-modules", "m1",
+                         "-processor", AP.class.getName())
+                .outdir(out)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        new JavacTask(tb)
+                .options("--module-path", modulePath.toString() + File.pathSeparator + out.toString(),
+                         "--add-modules", "m1",
+                         "-processor", AP.class.getName(),
+                         "-proc:only")
+                .classes("m1/m1.A")
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class AP extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            ModuleElement m1 = processingEnv.getElementUtils().getModuleElement("m1");
+            Set<String> actualAnnotations = new HashSet<>();
+            Set<String> expectedAnnotations =
+                    new HashSet<>(Arrays.asList("@m1.A", "@java.lang.Deprecated", "@m1.C({@m1.E, @m1.E})"));
+
+            for (AnnotationMirror am : m1.getAnnotationMirrors()) {
+                actualAnnotations.add(am.toString());
+            }
+
+            if (!expectedAnnotations.equals(actualAnnotations)) {
+                throw new AssertionError("Incorrect annotations: " + actualAnnotations);
+            }
+
+            return false;
+        }
+
+    }
+
+    @Test
+    public void testModuleDeprecation(Path base) throws Exception {
+        Path moduleSrc = base.resolve("module-src");
+        Path m1 = moduleSrc.resolve("m1");
+
+        tb.writeJavaFiles(m1,
+                          "@Deprecated module m1 { }");
+
+        Path m2 = moduleSrc.resolve("m2");
+
+        tb.writeJavaFiles(m2,
+                          "@Deprecated module m2 { }");
+
+        Path m3 = moduleSrc.resolve("m3");
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        List<String> actual;
+        List<String> expected;
+
+        for (String suppress : new String[] {"", "@Deprecated ", "@SuppressWarnings(\"deprecation\") "}) {
+            tb.writeJavaFiles(m3,
+                              suppress + "module m3 {\n" +
+                              "    requires m1;\n" +
+                              "    exports api to m1, m2;\n" +
+                              "}",
+                              "package api; public class Api { }");
+            System.err.println("compile m3");
+            actual = new JavacTask(tb)
+                    .options("--module-source-path", moduleSrc.toString(),
+                             "-XDrawDiagnostics")
+                    .outdir(modulePath)
+                    .files(findJavaFiles(moduleSrc))
+                    .run()
+                    .writeAll()
+                    .getOutputLines(OutputKind.DIRECT);
+
+            if (suppress.isEmpty()) {
+                expected = Arrays.asList(
+                        "- compiler.note.deprecated.filename: module-info.java",
+                        "- compiler.note.deprecated.recompile");
+            } else {
+                expected = Arrays.asList("");
+            }
+
+            if (!expected.equals(actual)) {
+                throw new AssertionError("Unexpected output: " + actual + "; suppress: " + suppress);
+            }
+
+            System.err.println("compile m3 with -Xlint:-deprecation");
+            actual = new JavacTask(tb)
+                    .options("--module-source-path", moduleSrc.toString(),
+                             "-XDrawDiagnostics",
+                             "-Xlint:deprecation")
+                    .outdir(modulePath)
+                    .files(findJavaFiles(moduleSrc))
+                    .run()
+                    .writeAll()
+                    .getOutputLines(OutputKind.DIRECT);
+
+            if (suppress.isEmpty()) {
+                expected = Arrays.asList(
+                        "module-info.java:2:14: compiler.warn.has.been.deprecated.module: m1",
+                        "1 warning");
+            } else {
+                expected = Arrays.asList("");
+            }
+
+            if (!expected.equals(actual)) {
+                throw new AssertionError("Unexpected output: " + actual + "; suppress: " + suppress);
+            }
+
+            //load the deprecated module-infos from classfile:
+            System.err.println("compile m3 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")))
+                    .run()
+                    .writeAll()
+                    .getOutputLines(OutputKind.DIRECT);
+
+            if (!expected.equals(actual)) {
+                throw new AssertionError("Unexpected output: " + actual + "; suppress: " + suppress);
+            }
+        }
+    }
+
+    @Test
+    public void testAttributeValues(Path base) throws Exception {
+        class TestCase {
+            public final String extraDecl;
+            public final String decl;
+            public final String use;
+            public final String expectedAnnotations;
+
+            public TestCase(String extraDecl, String decl, String use, String expectedAnnotations) {
+                this.extraDecl = extraDecl;
+                this.decl = decl;
+                this.use = use;
+                this.expectedAnnotations = expectedAnnotations;
+            }
+        }
+
+        TestCase[] testCases = new TestCase[] {
+            new TestCase("package test; public enum E {A, B;}",
+                         "public E value();",
+                         "test.E.A",
+                         "@test.A(test.E.A)"),
+            new TestCase("package test; public enum E {A, B;}",
+                         "public E[] value();",
+                         "{test.E.A, test.E.B}",
+                         "@test.A({test.E.A, test.E.B})"),
+            new TestCase("package test; public class Extra {}",
+                         "public Class value();",
+                         "test.Extra.class",
+                         "@test.A(test.Extra.class)"),
+            new TestCase("package test; public class Extra {}",
+                         "public Class[] value();",
+                         "{test.Extra.class, String.class}",
+                         "@test.A({test.Extra.class, java.lang.String.class})"),
+            new TestCase("package test; public @interface Extra { public Class value(); }",
+                         "public test.Extra value();",
+                         "@test.Extra(String.class)",
+                         "@test.A(@test.Extra(java.lang.String.class))"),
+            new TestCase("package test; public @interface Extra { public Class value(); }",
+                         "public test.Extra[] value();",
+                         "{@test.Extra(String.class), @test.Extra(Integer.class)}",
+                         "@test.A({@test.Extra(java.lang.String.class), @test.Extra(java.lang.Integer.class)})"),
+            new TestCase("package test; public class Any { }",
+                         "public int value();",
+                         "1",
+                         "@test.A(1)"),
+            new TestCase("package test; public class Any { }",
+                         "public int[] value();",
+                         "{1, 2}",
+                         "@test.A({1, 2})"),
+        };
+
+        Path extraSrc = base.resolve("extra-src");
+        tb.writeJavaFiles(extraSrc,
+                          "class Any {}");
+
+        int count = 0;
+
+        for (TestCase tc : testCases) {
+            Path testBase = base.resolve(String.valueOf(count));
+            Path moduleSrc = testBase.resolve("module-src");
+            Path m = moduleSrc.resolve("m");
+
+            tb.writeJavaFiles(m,
+                              "@test.A(" + tc.use + ") module m { }",
+                              "package test; @java.lang.annotation.Target(java.lang.annotation.ElementType.MODULE) public @interface A { " + tc.decl + "}",
+                              tc.extraDecl);
+
+            Path modulePath = testBase.resolve("module-path");
+
+            Files.createDirectories(modulePath);
+
+            new JavacTask(tb)
+                .options("--module-source-path", moduleSrc.toString())
+                .outdir(modulePath)
+                .files(findJavaFiles(moduleSrc))
+                .run()
+                .writeAll();
+
+            Path classes = testBase.resolve("classes");
+
+            Files.createDirectories(classes);
+
+            new JavacTask(tb)
+                .options("--module-path", modulePath.toString(),
+                         "--add-modules", "m",
+                         "-processorpath", System.getProperty("test.classes"),
+                         "-processor", ProxyTypeValidator.class.getName(),
+                         "-A" + OPT_EXPECTED_ANNOTATIONS + "=" + tc.expectedAnnotations)
+                .outdir(classes)
+                .files(findJavaFiles(extraSrc))
+                .run()
+                .writeAll();
+        }
+    }
+
+    private static final String OPT_EXPECTED_ANNOTATIONS = "expectedAnnotations";
+
+    @SupportedAnnotationTypes("*")
+    @SupportedOptions(OPT_EXPECTED_ANNOTATIONS)
+    public static final class ProxyTypeValidator extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            ModuleElement m = processingEnv.getElementUtils().getModuleElement("m");
+            String actualTypes = m.getAnnotationMirrors()
+                                  .stream()
+                                  .map(am -> am.toString())
+                                  .collect(Collectors.joining(", "));
+            if (!Objects.equals(actualTypes, processingEnv.getOptions().get(OPT_EXPECTED_ANNOTATIONS))) {
+                throw new IllegalStateException("Expected annotations not found, actual: " + actualTypes);
+            }
+            return false;
+        }
+
+    }
+
+}
--- a/langtools/test/tools/javac/modules/AutomaticModules.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/AutomaticModules.java	Thu Dec 01 09:02:42 2016 +0000
@@ -193,7 +193,7 @@
         Files.createDirectories(depClasses);
 
         tb.writeJavaFiles(depSrc,
-                          "module m1 { requires public automatic; }",
+                          "module m1 { requires transitive automatic; }",
                           "package dep; public class Dep { api.Api api; }");
 
         new JavacTask(tb)
@@ -261,7 +261,7 @@
         Path moduleSrc = base.resolve("module-src");
 
         tb.writeJavaFiles(moduleSrc.resolve("m1"),
-                          "module m1 { requires automaticA; }",
+                          "module m1 { requires static automaticA; }",
                           "package impl; public class Impl { apiA.Api a; apiB.Api b; m2.M2 m;}");
 
         tb.writeJavaFiles(moduleSrc.resolve("m2"),
@@ -308,4 +308,54 @@
             throw new Exception("expected output not found: " + log);
         }
     }
+
+    @Test
+    public void testDropTrailingVersion(Path base) throws Exception {
+        Path legacySrc = base.resolve("legacy-src");
+        tb.writeJavaFiles(legacySrc,
+                          "package api; public class Api {}");
+        Path legacyClasses = base.resolve("legacy-classes");
+        Files.createDirectories(legacyClasses);
+
+        String log = new JavacTask(tb)
+                .options()
+                .outdir(legacyClasses)
+                .files(findJavaFiles(legacySrc))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty()) {
+            throw new Exception("unexpected output: " + log);
+        }
+
+        Path modulePath = base.resolve("module-path");
+
+        Files.createDirectories(modulePath);
+
+        Path jar = modulePath.resolve("test1.jar");
+
+        new JarTask(tb, jar)
+          .baseDir(legacyClasses)
+          .files("api/Api.class")
+          .run();
+
+        Path moduleSrc = base.resolve("module-src");
+        Path m = moduleSrc.resolve("m");
+
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        tb.writeJavaFiles(m,
+                          "module m { requires test; }",
+                          "package impl; public class Impl { public void e(api.Api api) { } }");
+
+        new JavacTask(tb)
+                .options("--module-source-path", moduleSrc.toString(), "--module-path", modulePath.toString())
+                .outdir(classes)
+                .files(findJavaFiles(moduleSrc))
+                .run()
+                .writeAll();
+    }
 }
--- a/langtools/test/tools/javac/modules/EdgeCases.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/EdgeCases.java	Thu Dec 01 09:02:42 2016 +0000
@@ -206,7 +206,7 @@
 
         Files.createDirectories(modulePath);
 
-        Path automaticJar = modulePath.resolve("m1-1.0.jar");
+        Path automaticJar = modulePath.resolve("a-1.0.jar");
 
         new JarTask(tb, automaticJar)
           .baseDir(automaticClasses)
@@ -216,11 +216,11 @@
         Path src = base.resolve("src");
         Path src_m2 = src.resolve("m2");
         tb.writeJavaFiles(src_m2,
-                          "module m2 { requires m1; exports api2; }",
+                          "module m2 { requires a; exports api2; }",
                           "package api2; public class Api2 { public static api1.Api1 get() { return null; } }");
         Path src_m3 = src.resolve("m3");
         tb.writeJavaFiles(src_m3,
-                          "module m3 { requires m1; requires m2; }",
+                          "module m3 { requires a; requires m2; }",
                           "package test; public class Test { { api2.Api2.get(); api1.Api1 a1; } }");
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
@@ -459,4 +459,29 @@
 
         syms.java_base.getDirectives();
     }
+
+    @Test
+    public void testPackageInModuleInfo(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Files.createDirectories(src);
+        tb.writeJavaFiles(src, "package p; module foo { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+            .options("-XDrawDiagnostics", "-XDshould-stop.ifError=FLOW")
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run(Expect.FAIL)
+            .writeAll()
+            .getOutputLines(OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "module-info.java:1:1: compiler.err.no.pkg.in.module-info.java",
+                "1 error");
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+    }
 }
--- a/langtools/test/tools/javac/modules/ExportsUnexported.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/ExportsUnexported.java	Thu Dec 01 09:02:42 2016 +0000
@@ -169,7 +169,7 @@
                           "    exports api;\n" +
                           "    exports qapi1 to qual1;\n" +
                           "    exports qapi2 to qual1, qual2;\n" +
-                          "    requires public lib1;\n" +
+                          "    requires transitive lib1;\n" +
                           "    requires lib2;\n" +
                           "}\n",
                           "package api;\n" +
@@ -209,7 +209,7 @@
                 .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
-            "Api.java:4:16: compiler.warn.leaks.not.accessible.not.required.public: kindname.class, lib2.Lib2, lib2",
+            "Api.java:4:16: compiler.warn.leaks.not.accessible.not.required.transitive: kindname.class, lib2.Lib2, lib2",
             "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/GraphsTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/GraphsTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -55,19 +55,19 @@
 
     /**
      * Tests diamond graph with an automatic module added in.
-     * +-------------+          +--------------------+         +------------------+
-     * | module M    |          | module N           |         | module O         |
-     * |             | ----->   |                    | --->    |                  |  --> J.jar
-     * | require N   |          | requires public  O |         |                  |
-     * | require L   |          |                    |         +------------------+
-     * +-------------+          +--------------------+                  ^
+     * +-------------+          +-----------------------+         +------------------+
+     * | module M    |          | module N              |         | module O         |
+     * |             | ----->   |                       | --->    |                  |  --> J.jar
+     * | require N   |          | requires transitive O |         |                  |
+     * | require L   |          |                       |         +------------------+
+     * +-------------+          +-----------------------+                  ^
      *       |                                                          |
-     *       |                  +--------------------+                  |
-     *       ------------------>| module L           |                  |
-     *                          |                    |------------------
-     *                          | requires public O  |
-     *                          |                    |
-     *                          +--------------------+
+     *       |                  +-----------------------+                  |
+     *       ------------------>| module L              |                  |
+     *                          |                       |------------------
+     *                          | requires transitive O |
+     *                          |                       |
+     *                          +-----------------------+
      *
      */
     @Test
@@ -92,18 +92,18 @@
 
         new ModuleBuilder(tb, "O")
                 .exports("openO")
-                .requiresPublic("J", jarModules)
+                .requiresTransitive("J", jarModules)
                 .classes("package openO; public class O { openJ.J j; }")
                 .classes("package closedO; public class O { }")
                 .build(modSrc, modules);
         new ModuleBuilder(tb, "N")
-                .requiresPublic("O", modules, jarModules)
+                .requiresTransitive("O", modules, jarModules)
                 .exports("openN")
                 .classes("package openN; public class N { }")
                 .classes("package closedN; public class N { }")
                 .build(modSrc, modules);
         new ModuleBuilder(tb, "L")
-                .requiresPublic("O", modules, jarModules)
+                .requiresTransitive("O", modules, jarModules)
                 .exports("openL")
                 .classes("package openL; public class L { }")
                 .classes("package closedL; public class L { }")
@@ -171,18 +171,18 @@
     /**
      * Tests graph where module M reexport package of N, but N export the package only to M.
      *
-    +-------------+        +--------------------+        +---------------+
-    | module L    |        | module M           |        | module N      |
-    |             | -----> |                    | -----> |               |
-    |  requires M |        |  requires public N |        | exports P to M|
-    +-------------+        |                    |        +---------------+
-                           +--------------------+
+    +-------------+        +------------------------+        +---------------+
+    | module L    |        | module M               |        | module N      |
+    |             | -----> |                        | -----> |               |
+    |  requires M |        |  requires transitive N |        | exports P to M|
+    +-------------+        |                        |        +---------------+
+                           +------------------------+
     */
     @Test
     public void reexportOfQualifiedExport(Path base) throws Exception {
         Path modSrc = base.resolve("modSrc");
         new ModuleBuilder(tb, "M")
-                .requiresPublic("N")
+                .requiresTransitive("N")
                 .write(modSrc);
         new ModuleBuilder(tb, "N")
                 .exportsTo("pack", "M")
--- a/langtools/test/tools/javac/modules/InvalidModuleDirective/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/InvalidModuleDirective/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -8,8 +8,8 @@
 module java.transaction {
   requires java.base;
   resuires javax.interceptor.javax.interceptor.api;
-  requires public javax.enterprise.cdi.api;
-  requires public java.sql;
-  requires public java.rmi;
+  requires transitive javax.enterprise.cdi.api;
+  requires transitive java.sql;
+  requires transitive java.rmi;
   export javax.transaction;
 }
--- a/langtools/test/tools/javac/modules/ModuleInfoTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/ModuleInfoTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8158123
+ * @bug 8158123 8161906 8162713
  * @summary tests for module declarations
  * @library /tools/lib
  * @modules
@@ -34,6 +34,7 @@
  * @run main ModuleInfoTest
  */
 
+import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Arrays;
@@ -203,12 +204,12 @@
      * Verify that a multi-module loop is detected.
      */
     @Test
-    public void testRequiresPublicLoop(Path base) throws Exception {
+    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 public m3; }");
+        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; }");
 
@@ -223,7 +224,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:29: compiler.err.cyclic.requires: m3"))
+        if (!log.contains("module-info.java:1:33: compiler.err.cyclic.requires: m3"))
             throw new Exception("expected output not found");
     }
 
@@ -254,36 +255,15 @@
     }
 
     /**
-     * Verify that duplicate exported packages are detected.
+     * Verify that duplicate requires are detected.
      */
     @Test
-    public void testDuplicateExports_packages(Path base) throws Exception {
+    public void testDuplicateRequiresTransitiveStatic(Path base) throws Exception {
         Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "module m1 { exports p; exports p; }");
-
-        Path classes = base.resolve("classes");
-        Files.createDirectories(classes);
-
-        String log = new JavacTask(tb)
-                .options("-XDrawDiagnostics")
-                .outdir(classes)
-                .files(findJavaFiles(src))
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!log.contains("module-info.java:1:32: compiler.err.duplicate.exports: p"))
-            throw new Exception("expected output not found");
-    }
-
-    /**
-     * Verify that duplicate exported packages are detected.
-     */
-    @Test
-    public void testDuplicateExports_packages2(Path base) throws Exception {
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src.resolve("m1"), "module m1 { exports p; exports p to m2; }");
-        tb.writeJavaFiles(src.resolve("m2"), "module m2 { }");
+        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 classes = base.resolve("classes");
         Files.createDirectories(classes);
@@ -296,15 +276,115 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:32: compiler.err.duplicate.exports: p"))
+        if (!log.contains("module-info.java:1:53: compiler.err.duplicate.requires: m1"))
             throw new Exception("expected output not found");
     }
 
     /**
+     * Verify that duplicate exported packages are detected correctly.
+     */
+    @Test
+    public void testConflictingExports_packages(Path base) throws Exception {
+        verifyConflictingExports_packages(base,
+                                          "exports p; exports q;",
+                                          null);
+        verifyConflictingExports_packages(base,
+                                          "exports p; exports p;",
+                                          "module-info.java:1:32: 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");
+        verifyConflictingExports_packages(base,
+                                          "exports p; opens p to m2;",
+                                          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");
+        verifyConflictingExports_packages(base,
+                                          "opens p; exports p to m2;",
+                                          null);
+        verifyConflictingExports_packages(base,
+                                          "opens p; opens p to m2;",
+                                          "module-info.java:1:28: compiler.err.conflicting.opens: p");
+        verifyConflictingExports_packages(base,
+                                          "exports p to m2; exports p;",
+                                          "module-info.java:1:38: compiler.err.conflicting.exports: p");
+        verifyConflictingExports_packages(base,
+                                          "exports p to m2; 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");
+        verifyConflictingExports_packages(base,
+                                          "exports p to m2; opens p to m2;",
+                                          null);
+        verifyConflictingExports_packages(base,
+                                          "opens p to m2; exports p;",
+                                          null);
+        verifyConflictingExports_packages(base,
+                                          "opens p to m2; opens p;",
+                                          "module-info.java:1:34: compiler.err.conflicting.opens: p");
+        verifyConflictingExports_packages(base,
+                                          "opens p to m2; exports p to m2;",
+                                          null);
+        verifyConflictingExports_packages(base,
+                                          "opens p to m2; opens p to m2;",
+                                          "module-info.java:1:34: 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");
+        verifyConflictingExports_packages(base,
+                                          "exports p to m2; opens p to m3;",
+                                          null);
+        verifyConflictingExports_packages(base,
+                                          "opens p to m2; exports p to m3;",
+                                          null);
+        verifyConflictingExports_packages(base,
+                                          "opens p to m2; opens p to m3;",
+                                          "module-info.java:1:34: compiler.err.conflicting.opens: p");
+    }
+
+    private void verifyConflictingExports_packages(Path base, String code, String expected) throws Exception {
+        Files.createDirectories(base);
+        tb.cleanDirectory(base);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src.resolve("m1"),
+                          "module m1 { " + 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; }");
+
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(expected != null ? Task.Expect.FAIL : Task.Expect.SUCCESS)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (expected != null && !log.contains(expected))
+            throw new Exception("expected output not found, actual output: " + log);
+    }
+
+    /**
      * Verify that duplicate exported packages are detected.
      */
     @Test
-    public void testDuplicateExports_modules(Path base) throws Exception {
+    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 { }");
@@ -322,7 +402,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:30: compiler.err.duplicate.exports: m1"))
+        if (!log.contains("module-info.java:1:30: compiler.err.conflicting.exports.to.module: m1"))
             throw new Exception("expected output not found");
     }
 
@@ -363,8 +443,12 @@
                     .writeAll()
                     .getOutput(Task.OutputKind.DIRECT);
 
-            if (!log.matches("(?s)^module\\-info\\.java:\\d+:\\d+: compiler\\.err\\.expected: token\\.identifier.*"))
-                throw new Exception("expected output not found");
+            String expect_prefix = "(?s)^module\\-info\\.java:\\d+:\\d+: ";
+            String expect_message = "compiler\\.err\\.expected: token\\.identifier";
+            String expect_suffix = ".*";
+            String expect = expect_prefix + expect_message + expect_suffix;
+            if (!log.matches(expect))
+                throw new Exception("expected output not found for: " + moduleInfo + "; actual: " + log);
         }
     }
 }
--- a/langtools/test/tools/javac/modules/ModuleInfoTreeAccess.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/ModuleInfoTreeAccess.java	Thu Dec 01 09:02:42 2016 +0000
@@ -85,4 +85,29 @@
             assertNotNull("docCommentTree", docCommentTree);
         }
     }
+
+    @Test
+    public void testTreePathForModuleDeclWithImport(Path base) throws Exception {
+        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 {}");
+
+            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");
+
+            TreePath path = trees.getPath(mdle);
+            assertNotNull("path", path);
+
+            ModuleElement mdle1 = (ModuleElement) trees.getElement(path);
+            assertNotNull("mdle1", mdle1);
+
+            DocCommentTree docCommentTree = trees.getDocCommentTree(mdle);
+            assertNotNull("docCommentTree", docCommentTree);
+        }
+    }
 }
--- a/langtools/test/tools/javac/modules/ModulePathTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/ModulePathTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -178,7 +178,7 @@
                 .run()
                 .writeAll();
 
-        Path moduleJar = base.resolve("m1.jar");
+        Path moduleJar = base.resolve("a.jar");
         new JarTask(tb, moduleJar)
           .baseDir(jarClasses)
           .files("p/CC.class")
@@ -191,7 +191,7 @@
 
         new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes)
-                .options("--module-path", moduleJar.toString(), "--add-modules", "m1")
+                .options("--module-path", moduleJar.toString(), "--add-modules", "a")
                 .files(findJavaFiles(src))
                 .run()
                 .writeAll();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/OpenModulesTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,287 @@
+/*
+ * 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
+ * @summary tests for multi-module mode compilation
+ * @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.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
+ * @run main OpenModulesTest
+ */
+
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+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 toolbox.JavacTask;
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.Task.Expect;
+import toolbox.Task.OutputKind;
+
+public class OpenModulesTest extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        new OpenModulesTest().runTests();
+    }
+
+    @Test
+    public void testStrongModule(Path base) throws Exception {
+        Path m1 = base.resolve("m1");
+        tb.writeJavaFiles(m1,
+                          "module m1 { 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");
+        tb.createDirectories(m1Classes);
+
+        String log = new JavacTask(tb)
+                .outdir(m1Classes)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found: " + log);
+
+        String decompiled = new JavapTask(tb)
+                .options("--system", "none", "-bootclasspath", "")
+                .classes(m1Classes.resolve("module-info.class").toString())
+                .run()
+                .writeAll()
+                .getOutput(OutputKind.DIRECT)
+                .replace(System.getProperty("line.separator"), "\n");
+
+        String expected = "module m1 {\n" +
+                          "  requires java.base;\n" +
+                          "  exports api1;\n" +
+                          "  opens api2;\n" +
+                          "}";
+
+        if (!decompiled.contains(expected)) {
+            throw new Exception("expected output not found: " + decompiled);
+        }
+
+        //compiling against a strong module read from binary:
+        Path m2 = base.resolve("m2");
+        tb.writeJavaFiles(m2,
+                          "module m2 { requires m1; }",
+                          "package test; public class Test { api1.Api1 a1; api2.Api2 a2; }");
+        Path m2Classes = classes.resolve("m2");
+        tb.createDirectories(m2Classes);
+
+        List<String> log2 = new JavacTask(tb)
+                .options("--module-path", m1Classes.toString(),
+                         "-XDrawDiagnostics")
+                .outdir(m2Classes)
+                .files(findJavaFiles(m2))
+                .run(Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
+                                               "1 error");
+        if (!Objects.equals(log2, expected2))
+            throw new Exception("expected output not found: " + log2);
+    }
+
+    @Test
+    public void testOpenModule(Path base) throws Exception {
+        Path m1 = base.resolve("m1");
+        tb.writeJavaFiles(m1,
+                          "open module m1 { 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");
+        tb.createDirectories(m1Classes);
+
+        String log = new JavacTask(tb)
+                .outdir(m1Classes)
+                .files(findJavaFiles(m1))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found: " + log);
+
+        String decompiled = new JavapTask(tb)
+                .options("--system", "none", "-bootclasspath", "")
+                .classes(m1Classes.resolve("module-info.class").toString())
+                .run()
+                .writeAll()
+                .getOutput(OutputKind.DIRECT)
+                .replace(System.getProperty("line.separator"), "\n");
+
+        String expected = "open module m1 {\n" +
+                          "  requires java.base;\n" +
+                          "  exports api1;\n" +
+                          "}";
+
+        if (!decompiled.contains(expected)) {
+            throw new Exception("expected output not found: " + decompiled);
+        }
+
+        //compiling against a ordinary module read from binary:
+        Path m2 = base.resolve("m2");
+        tb.writeJavaFiles(m2,
+                          "module m2 { requires m1; }",
+                          "package test; public class Test { api1.Api1 a1; api2.Api2 a2; }");
+        Path m2Classes = classes.resolve("m2");
+        tb.createDirectories(m2Classes);
+
+        List<String> log2 = new JavacTask(tb)
+                .options("--module-path", m1Classes.toString(),
+                         "-XDrawDiagnostics")
+                .outdir(m2Classes)
+                .files(findJavaFiles(m2))
+                .run(Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
+                                               "1 error");
+        if (!Objects.equals(log2, expected2))
+            throw new Exception("expected output not found: " + log2);
+    }
+
+    @Test
+    public void testOpenModuleNoOpens(Path base) throws Exception {
+        Path m1 = base.resolve("m1");
+        tb.writeJavaFiles(m1,
+                          "open module m1 { 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");
+        tb.createDirectories(m1Classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(m1Classes)
+                .files(findJavaFiles(m1))
+                .run(Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.no.opens.unless.strong",
+                                              "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found: " + log);
+
+    }
+
+    @Test
+    public void testNonZeroOpensInOpen(Path base) throws Exception {
+        Path m1 = base.resolve("m1");
+        tb.writeJavaFiles(m1,
+                          "module m1 { opens api; }",
+                          "package api; public class Api {}");
+        Path classes = base.resolve("classes");
+        Path m1Classes = classes.resolve("m1");
+        tb.createDirectories(m1Classes);
+
+        new JavacTask(tb)
+            .options("-XDrawDiagnostics")
+            .outdir(m1Classes)
+            .files(findJavaFiles(m1))
+            .run(Expect.SUCCESS)
+            .writeAll();
+
+        Path miClass = m1Classes.resolve("module-info.class");
+        ClassFile cf = ClassFile.read(miClass);
+        Module_attribute module = (Module_attribute) cf.attributes.map.get(Attribute.Module);
+        Module_attribute newModule = new Module_attribute(module.attribute_name_index,
+                                                          module.module_name,
+                                                          module.module_flags | Module_attribute.ACC_OPEN,
+                                                          module.requires,
+                                                          module.exports,
+                                                          module.opens,
+                                                          module.uses_index,
+                                                          module.provides);
+        Map<String, Attribute> attrs = new HashMap<>(cf.attributes.map);
+
+        attrs.put(Attribute.Module, newModule);
+
+        Attributes newAttributes = new Attributes(attrs);
+        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(miClass)) {
+            new ClassWriter().write(newClassFile, out);
+        }
+
+        Path test = base.resolve("test");
+        tb.writeJavaFiles(test,
+                          "package impl; public class Impl extends api.Api {}");
+        Path testClasses = base.resolve("test-classes");
+        tb.createDirectories(testClasses);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-path", classes.toString(),
+                         "--add-modules", "m1")
+                .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))",
+                                              "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found: " + log);
+    }
+
+}
--- a/langtools/test/tools/javac/modules/PatchModulesTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/PatchModulesTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,7 +28,7 @@
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
- *      jdk.compiler/com.sun.tools.javac.file
+ *      jdk.compiler/com.sun.tools.javac.file:+open
  *      jdk.compiler/com.sun.tools.javac.main
  * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
  * @run main PatchModulesTest
--- a/langtools/test/tools/javac/modules/ProvidesTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/ProvidesTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -41,7 +41,6 @@
 import toolbox.JavacTask;
 import toolbox.Task;
 import toolbox.Task.Expect;
-import toolbox.ToolBox;
 
 public class ProvidesTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -426,4 +425,96 @@
                 .run(Expect.SUCCESS)
                 .writeAll();
     }
+
+    @Test
+    public void testFactory(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { exports p1; provides p1.C1 with p2.C2; }",
+                "package p1; public interface C1 { }",
+                "package p2; public class C2 { public static p1.C1 provider() { return null; } }");
+
+        new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(Files.createDirectories(base.resolve("classes")))
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        List<String> output;
+        List<String> expected;
+
+        tb.writeJavaFiles(src,
+                "package p2; public class C2 { public p1.C1 provider() { return null; } }");
+
+        output = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(Files.createDirectories(base.resolve("classes")))
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("module-info.java:1:46: compiler.err.service.implementation.must.be.subtype.of.service.interface",
+                                 "1 error");
+
+        if (!expected.equals(output)) {
+            throw new Exception("Expected output not found. Output: " + output);
+        }
+
+        tb.writeJavaFiles(src,
+                "package p2; public class C2 { static p1.C1 provider() { return null; } }");
+
+        output = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(Files.createDirectories(base.resolve("classes")))
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("module-info.java:1:46: compiler.err.service.implementation.must.be.subtype.of.service.interface",
+                                 "1 error");
+
+        if (!expected.equals(output)) {
+            throw new Exception("Expected output not found. Output: " + output);
+        }
+
+        tb.writeJavaFiles(src,
+                "package p2; public class C2 { public static Object provider() { return null; } }");
+
+        output = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(Files.createDirectories(base.resolve("classes")))
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("module-info.java:1:46: compiler.err.service.implementation.provider.return.must.be.subtype.of.service.interface",
+                                 "1 error");
+
+        if (!expected.equals(output)) {
+            throw new Exception("Expected output not found. Output: " + output);
+        }
+
+        tb.writeJavaFiles(src,
+                "package p2; public class C2 { public static p1.C1 provider = new p1.C1() {}; }");
+
+        output = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(Files.createDirectories(base.resolve("classes")))
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("module-info.java:1:46: compiler.err.service.implementation.must.be.subtype.of.service.interface",
+                                 "1 error");
+
+        if (!expected.equals(output)) {
+            throw new Exception("Expected output not found. Output: " + output);
+        }
+    }
 }
--- a/langtools/test/tools/javac/modules/RepeatedUsesAndProvidesTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/RepeatedUsesAndProvidesTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -82,7 +82,7 @@
                 .run(Task.Expect.FAIL)
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
-        if (!log.contains("module-info.java:1:39: compiler.err.duplicate.provides"))
+        if (!log.contains("module-info.java:1:61: compiler.err.duplicate.provides"))
             throw new Exception("expected output not found");
     }
 }
--- a/langtools/test/tools/javac/modules/ReportNonExistentPackageTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/ReportNonExistentPackageTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -22,7 +22,7 @@
  */
 
 /**
- * @test 8144342 8149658
+ * @test 8144342 8149658 8162713
  * @summary javac doesn't report errors if module exports non-existent package
  * @library /tools/lib
  * @modules
@@ -103,4 +103,45 @@
         if (!log.contains("module-info.java:1:20: compiler.err.package.empty.or.not.found: p1"))
             throw new Exception("expected output not found");
     }
+
+    @Test
+    public void testExportPrivateEmptyPackage(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { opens p; }");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+        if (!log.contains("module-info.java:1:18: compiler.err.package.empty.or.not.found: p"))
+            throw new Exception("expected output not found, actual output: " + log);
+    }
+
+    @Test
+    public void testExportPrivateOnlyWithResources(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { opens p; }");
+        Path resource = src.resolve("p").resolve("resource.properties");
+        Files.createDirectories(resource.getParent());
+        Files.newOutputStream(resource).close();
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .sourcepath(src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+        if (!log.equals(""))
+            throw new Exception("expected output not found, actual output: " + log);
+    }
 }
--- a/langtools/test/tools/javac/modules/RequiresPublicTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*
- * 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 tests for "requires public"
- * @library /tools/lib
- * @modules
- *      jdk.compiler/com.sun.tools.javac.api
- *      jdk.compiler/com.sun.tools.javac.main
- * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
- * @run main RequiresPublicTest
- */
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-import toolbox.JavacTask;
-import toolbox.Task;
-import toolbox.ToolBox;
-
-public class RequiresPublicTest extends ModuleTestBase {
-
-    public static void main(String... args) throws Exception {
-        RequiresPublicTest t = new RequiresPublicTest();
-        t.runTests();
-    }
-
-    @Test
-    public void testJavaSE_OK(Path base) throws Exception {
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src,
-                "module m { requires java.se; }",
-                "import java.awt.Frame;\n"  // in java.se
-                + "class Test {\n"
-                + "    Frame f;\n"
-                + "}");
-        Path classes = base.resolve("classes");
-        Files.createDirectories(classes);
-
-        new JavacTask(tb, Task.Mode.CMDLINE)
-                .files(findJavaFiles(src))
-                .outdir(classes)
-                .run()
-                .writeAll();
-    }
-
-    @Test
-    public void testJavaSE_Fail(Path base) throws Exception {
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src,
-                "module m { requires java.se; }",
-                "import com.sun.source.tree.Tree;\n" // not in java.se (in jdk.compiler)
-                + "class Test {\n"
-                + "    Tree t;\n"
-                + "}");
-        Path classes = base.resolve("classes");
-        Files.createDirectories(classes);
-
-        String log = new JavacTask(tb, Task.Mode.CMDLINE)
-                .options("-XDrawDiagnostics")
-                .files(findJavaFiles(src))
-                .outdir(classes)
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
-            throw new Exception("expected output not found");
-    }
-
-    @Test
-    public void testComplex_OK(Path base) throws Exception {
-        Path src = getComplexSrc(base, "", "");
-        Path classes = base.resolve("classes");
-        Files.createDirectories(classes);
-
-        new JavacTask(tb, Task.Mode.CMDLINE)
-                .options("--module-source-path", src.toString())
-                .files(findJavaFiles(src))
-                .outdir(classes)
-                .run()
-                .writeAll();
-    }
-
-    @Test
-    public void testComplex_Fail(Path base) throws Exception {
-        Path src = getComplexSrc(base,
-                "import p5.C5; import p6.C6; import p7.C7;\n",
-                "C5 c5; C6 c6; C7 c7;\n");
-        Path classes = base.resolve("classes");
-        Files.createDirectories(classes);
-
-        String log = new JavacTask(tb, Task.Mode.CMDLINE)
-                .options("-XDrawDiagnostics",
-                        "--module-source-path", src.toString())
-                .files(findJavaFiles(src))
-                .outdir(classes)
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        String[] expect = {
-            "C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
-            "C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
-            "C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
-            "C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
-                + "(compiler.misc.location: kindname.class, p1.C1, null)",
-            "C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
-                + "(compiler.misc.location: kindname.class, p1.C1, null)",
-            "C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
-                + "(compiler.misc.location: kindname.class, p1.C1, null)"
-        };
-
-        for (String e: expect) {
-            if (!log.contains(e))
-                throw new Exception("expected output not found: " + e);
-        }
-    }
-
-    /*
-     * Set up the following module graph
-     *     m1 -> m2 => m3 => m4 -> m5
-     *              -> m6 => m7
-     * where -> is requires, => is requires public
-     */
-    Path getComplexSrc(Path base, String m1_extraImports, String m1_extraUses) throws Exception {
-        Path src = base.resolve("src");
-
-        Path src_m1 = src.resolve("m1");
-        tb.writeJavaFiles(src_m1,
-                "module m1 { requires m2; }",
-                "package p1;\n"
-                + "import p2.C2;\n"
-                + "import p3.C3;\n"
-                + "import p4.C4;\n"
-                + m1_extraImports
-                + "class C1 {\n"
-                + "  C2 c2; C3 c3; C4 c4;\n"
-                + m1_extraUses
-                + "}\n");
-
-        Path src_m2 = src.resolve("m2");
-        tb.writeJavaFiles(src_m2,
-                "module m2 {\n"
-                + "  requires public m3;\n"
-                + "  requires        m6;\n"
-                + "  exports p2;\n"
-                + "}",
-                "package p2;\n"
-                + "public class C2 { }\n");
-
-        Path src_m3 = src.resolve("m3");
-        tb.writeJavaFiles(src_m3,
-                "module m3 { requires public m4; exports p3; }",
-                "package p3;\n"
-                + "public class C3 { }\n");
-
-        Path src_m4 = src.resolve("m4");
-        tb.writeJavaFiles(src_m4,
-                "module m4 { requires m5; exports p4; }",
-                "package p4;\n"
-                + "public class C4 { }\n");
-
-        Path src_m5 = src.resolve("m5");
-        tb.writeJavaFiles(src_m5,
-                "module m5 { exports p5; }",
-                "package p5;\n"
-                + "public class C5 { }\n");
-
-        Path src_m6 = src.resolve("m6");
-        tb.writeJavaFiles(src_m6,
-                "module m6 { requires public m7; exports p6; }",
-                "package p6;\n"
-                + "public class C6 { }\n");
-
-        Path src_m7 = src.resolve("m7");
-        tb.writeJavaFiles(src_m7,
-                "module m7 { exports p7; }",
-                "package p7;\n"
-                + "public class C7 { }\n");
-
-        return src;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/RequiresStaticTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,391 @@
+/*
+ * 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
+ * @bug 8161906 8161596
+ * @summary tests for "requires static"
+ * @library /tools/lib
+ * @modules
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
+ * @run main RequiresStaticTest
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import toolbox.JavaTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.Task.OutputKind;
+
+public class RequiresStaticTest extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        RequiresStaticTest t = new RequiresStaticTest();
+        t.runTests();
+    }
+
+    @Test
+    public void testJavaSE_OK(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { requires static java.se; }",
+                "import java.awt.Frame;\n"  // in java.se
+                + "class Test {\n"
+                + "    Frame f;\n"
+                + "}");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testJavaSE_Fail(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { requires static java.se; }",
+                "import com.sun.source.tree.Tree;\n" // not in java.se (in jdk.compiler)
+                + "class Test {\n"
+                + "    Tree t;\n"
+                + "}");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testComplex_OK(Path base) throws Exception {
+        Path src = getComplexSrc(base, "", "");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-source-path", src.toString())
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testComplex_Fail(Path base) throws Exception {
+        Path src = getComplexSrc(base,
+                "import p5.C5; import p6.C6; import p7.C7; import p8.C8;\n",
+                "C5 c5; C6 c6; C7 c7; C8 c8;\n");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("-XDrawDiagnostics",
+                        "--module-source-path", src.toString())
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        String[] expect = {
+            "C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
+            "C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
+            "C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
+            "C1.java:5:52: compiler.err.not.def.access.package.cant.access: p8.C8, p8",
+            "C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
+                + "(compiler.misc.location: kindname.class, p1.C1, null)",
+            "C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
+                + "(compiler.misc.location: kindname.class, p1.C1, null)",
+            "C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
+                + "(compiler.misc.location: kindname.class, p1.C1, null)",
+            "C1.java:8:22: compiler.err.cant.resolve.location: kindname.class, C8, , , "
+                + "(compiler.misc.location: kindname.class, p1.C1, null)"
+        };
+
+        for (String e: expect) {
+            if (!log.contains(e))
+                throw new Exception("expected output not found: " + e);
+        }
+    }
+
+    /*
+     * Set up the following module graph
+     *     m1 -> m2 => m3 -=-> m4 --> m5
+     *            \           /
+     *              \       /
+     *                v   v
+     *                  m6 => m7 --> 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");
+        tb.writeJavaFiles(src_m1,
+                "module m1 { requires m2; }",
+                "package p1;\n"
+                + "import p2.C2;\n"
+                + "import p3.C3;\n"
+                + "import p4.C4;\n"
+                + m1_extraImports
+                + "class C1 {\n"
+                + "  C2 c2; C3 c3; C4 c4;\n"
+                + m1_extraUses
+                + "}\n");
+
+        Path src_m2 = src.resolve("m2");
+        tb.writeJavaFiles(src_m2,
+                "module m2 {\n"
+                + "  requires transitive m3;\n"
+                + "  requires static m6;\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");
+        tb.writeJavaFiles(src_m3,
+                "module m3 { requires transitive static m4; exports p3; }",
+                "package p3;\n"
+                + "public class C3 { }\n");
+
+        Path src_m4 = src.resolve("m4");
+        tb.writeJavaFiles(src_m4,
+                "module m4 { requires m5; requires static m6; exports p4; }",
+                "package p4;\n"
+                + "public class C4 { p6.C6 c6; p7.C7 c7;}\n");
+
+        Path src_m5 = src.resolve("m5");
+        tb.writeJavaFiles(src_m5,
+                "module m5 { exports p5; }",
+                "package p5;\n"
+                + "public class C5 { }\n");
+
+        Path src_m6 = src.resolve("m6");
+        tb.writeJavaFiles(src_m6,
+                "module m6 { requires transitive m7; exports p6; }",
+                "package p6;\n"
+                + "public class C6 { p7.C7 c7; }\n");
+
+        Path src_m7 = src.resolve("m7");
+        tb.writeJavaFiles(src_m7,
+                "module m7 { requires static m8; exports p7; }",
+                "package p7;\n"
+                + "public class C7 { p8.C8 c8; }\n");
+
+        Path src_m8 = src.resolve("m8");
+        tb.writeJavaFiles(src_m8,
+                "module m8 { exports p8; }",
+                "package p8;\n"
+                        + "public class C8 { }\n");
+
+        return src;
+    }
+
+    @Test
+    public void testRequiresStatic(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1");
+        tb.writeJavaFiles(m1,
+                "module m1 { exports m1; }",
+                "package m1;" +
+                "public class Api { }\n");
+
+        Path classes = base.resolve("classes");
+        Path m1Classes = classes.resolve("m1");
+        Files.createDirectories(m1Classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .files(findJavaFiles(m1))
+                .outdir(m1Classes)
+                .run()
+                .writeAll();
+
+        Path m3 = src.resolve("m3");
+        tb.writeJavaFiles(m3,
+                "module m3 { requires static m1; }",
+                "package m3;\n" +
+                "public class Test {\n" +
+                "    public static void main(String... args) {\n" +
+                "        try {\n" +
+                "           Class.forName(\"m1.Api\");\n" +
+                "        } catch (ClassNotFoundException e) {\n" +
+                "            System.err.println(\"ok\");\n" +
+                "        }\n" +
+                "    }\n" +
+                "}",
+                "package m3;\n" +
+                "public class ApiUse{\n" +
+                "    m1.Api api;\n" +
+                "}");
+
+        Path m3Classes = classes.resolve("m3");
+        Files.createDirectories(m3Classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-path", m1Classes.toString())
+                .files(findJavaFiles(m3))
+                .outdir(m3Classes)
+                .run()
+                .writeAll();
+
+        String log = new JavaTask(tb)
+                .vmOptions("--module-path", m3Classes.toString(), "--add-modules", "m3")
+                .className("m3.Test")
+                .run()
+                .writeAll()
+                .getOutput(OutputKind.STDERR);
+
+        String expected = "ok" + System.getProperty("line.separator");
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+    }
+
+    @Test
+    public void testRequiresTransitiveStatic(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1");
+        tb.writeJavaFiles(m1,
+                "module m1 { exports m1; }",
+                "package m1;" +
+                "public class Api { }\n");
+
+        Path classes = base.resolve("classes");
+        Path m1Classes = classes.resolve("m1");
+        Files.createDirectories(m1Classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .files(findJavaFiles(m1))
+                .outdir(m1Classes)
+                .run()
+                .writeAll();
+
+        Path m2 = src.resolve("m2");
+        tb.writeJavaFiles(m2,
+                "module m2 { requires transitive static m1; }");
+
+        Path m2Classes = classes.resolve("m2");
+        Files.createDirectories(m2Classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-path", m1Classes.toString())
+                .files(findJavaFiles(m2))
+                .outdir(m2Classes)
+                .run()
+                .writeAll();
+
+        Path m3 = src.resolve("m3");
+        tb.writeJavaFiles(m3,
+                "module m3 { requires m2; }",
+                "package m3;\n" +
+                "public class Test {\n" +
+                "    public static void main(String... args) {\n" +
+                "        try {\n" +
+                "           Class.forName(\"m1.Api\");\n" +
+                "        } catch (ClassNotFoundException e) {\n" +
+                "            System.err.println(\"ok\");\n" +
+                "        }\n" +
+                "    }\n" +
+                "}",
+                "package m3;\n" +
+                "public class ApiUse{\n" +
+                "    m1.Api api;\n" +
+                "}");
+
+        Path m3Classes = classes.resolve("m3");
+        Files.createDirectories(m3Classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-path", m1Classes.toString() + File.pathSeparator + m2Classes.toString())
+                .files(findJavaFiles(m3))
+                .outdir(m3Classes)
+                .run()
+                .writeAll();
+
+        String log = new JavaTask(tb)
+                .vmOptions("--module-path", m2Classes.toString() + File.pathSeparator + m3Classes.toString(),
+                           "--add-modules", "m3")
+                .className("m3.Test")
+                .run()
+                .writeAll()
+                .getOutput(OutputKind.STDERR);
+
+        String expected = "ok" + System.getProperty("line.separator");
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+    }
+
+    @Test
+    public void testRequiresStaticTransitive(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1");
+        tb.writeJavaFiles(m1,
+                "module m1 { exports m1; }",
+                "package m1;" +
+                "public class Api { }\n");
+
+        Path classes = base.resolve("classes");
+        Path m1Classes = classes.resolve("m1");
+        Files.createDirectories(m1Classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .files(findJavaFiles(m1))
+                .outdir(m1Classes)
+                .run()
+                .writeAll();
+
+        Path m2 = src.resolve("m2");
+        tb.writeJavaFiles(m2,
+                "module m2 { requires transitive static m1; }");
+
+        Path m2Classes = classes.resolve("m2");
+        Files.createDirectories(m2Classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-path", m1Classes.toString())
+                .files(findJavaFiles(m2))
+                .outdir(m2Classes)
+                .run()
+                .writeAll();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/RequiresTransitiveTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,205 @@
+/*
+ * 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 tests for "requires transitive"
+ * @library /tools/lib
+ * @modules
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
+ * @run main RequiresTransitiveTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
+public class RequiresTransitiveTest extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        RequiresTransitiveTest t = new RequiresTransitiveTest();
+        t.runTests();
+    }
+
+    @Test
+    public void testJavaSE_OK(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { requires java.se; }",
+                "import java.awt.Frame;\n"  // in java.se
+                + "class Test {\n"
+                + "    Frame f;\n"
+                + "}");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testJavaSE_Fail(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m { requires java.se; }",
+                "import com.sun.source.tree.Tree;\n" // not in java.se (in jdk.compiler)
+                + "class Test {\n"
+                + "    Tree t;\n"
+                + "}");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testComplex_OK(Path base) throws Exception {
+        Path src = getComplexSrc(base, "", "");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-source-path", src.toString())
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testComplex_Fail(Path base) throws Exception {
+        Path src = getComplexSrc(base,
+                "import p5.C5; import p6.C6; import p7.C7;\n",
+                "C5 c5; C6 c6; C7 c7;\n");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("-XDrawDiagnostics",
+                        "--module-source-path", src.toString())
+                .files(findJavaFiles(src))
+                .outdir(classes)
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        String[] expect = {
+            "C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
+            "C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
+            "C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
+            "C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
+                + "(compiler.misc.location: kindname.class, p1.C1, null)",
+            "C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
+                + "(compiler.misc.location: kindname.class, p1.C1, null)",
+            "C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
+                + "(compiler.misc.location: kindname.class, p1.C1, null)"
+        };
+
+        for (String e: expect) {
+            if (!log.contains(e))
+                throw new Exception("expected output not found: " + e);
+        }
+    }
+
+    /*
+     * Set up the following module graph
+     *     m1 -> m2 => m3 => m4 -> m5
+     *              -> m6 => m7
+     * 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");
+        tb.writeJavaFiles(src_m1,
+                "module m1 { requires m2; }",
+                "package p1;\n"
+                + "import p2.C2;\n"
+                + "import p3.C3;\n"
+                + "import p4.C4;\n"
+                + m1_extraImports
+                + "class C1 {\n"
+                + "  C2 c2; C3 c3; C4 c4;\n"
+                + m1_extraUses
+                + "}\n");
+
+        Path src_m2 = src.resolve("m2");
+        tb.writeJavaFiles(src_m2,
+                "module m2 {\n"
+                + "  requires transitive m3;\n"
+                + "  requires        m6;\n"
+                + "  exports p2;\n"
+                + "}",
+                "package p2;\n"
+                + "public class C2 { }\n");
+
+        Path src_m3 = src.resolve("m3");
+        tb.writeJavaFiles(src_m3,
+                "module m3 { requires transitive m4; exports p3; }",
+                "package p3;\n"
+                + "public class C3 { }\n");
+
+        Path src_m4 = src.resolve("m4");
+        tb.writeJavaFiles(src_m4,
+                "module m4 { requires m5; exports p4; }",
+                "package p4;\n"
+                + "public class C4 { }\n");
+
+        Path src_m5 = src.resolve("m5");
+        tb.writeJavaFiles(src_m5,
+                "module m5 { exports p5; }",
+                "package p5;\n"
+                + "public class C5 { }\n");
+
+        Path src_m6 = src.resolve("m6");
+        tb.writeJavaFiles(src_m6,
+                "module m6 { requires transitive m7; exports p6; }",
+                "package p6;\n"
+                + "public class C6 { }\n");
+
+        Path src_m7 = src.resolve("m7");
+        tb.writeJavaFiles(src_m7,
+                "module m7 { exports p7; }",
+                "package p7;\n"
+                + "public class C7 { }\n");
+
+        return src;
+    }
+}
--- a/langtools/test/tools/javac/modules/T8158224/Processor.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/T8158224/Processor.java	Thu Dec 01 09:02:42 2016 +0000
@@ -37,4 +37,4 @@
     public boolean process(Set<? extends TypeElement> tE, RoundEnvironment env) {
         return true;
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/modules/T8168854/pack1/Outer.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/T8168854/pack1/Outer.java	Thu Dec 01 09:02:42 2016 +0000
@@ -28,4 +28,4 @@
 public class Outer {
     public class Inter {
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/modules/T8168854/pack1/Outer1.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/modules/T8168854/pack1/Outer1.java	Thu Dec 01 09:02:42 2016 +0000
@@ -31,4 +31,4 @@
             new Outer().super();
         }
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @bug 8072480
  * @summary Verify option clash between --release and -source is reported correctly.
- * @modules jdk.compiler/com.sun.tools.javac.util
+ * @modules jdk.compiler/com.sun.tools.javac.util:open
  */
 
 import java.io.ByteArrayOutputStream;
--- a/langtools/test/tools/javac/parser/JavacParserTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/parser/JavacParserTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -370,7 +370,7 @@
     }
 
     @Test
-    void testCorrectWilcardPositions1() throws IOException {
+    void testCorrectWildcardPositions1() throws IOException {
         performWildcardPositionsTest("package test; import java.util.List; " +
                 "class Test { private void method() { List<? extends List<? extends String>> l; } }",
 
@@ -385,7 +385,7 @@
     }
 
     @Test
-    void testCorrectWilcardPositions2() throws IOException {
+    void testCorrectWildcardPositions2() throws IOException {
         performWildcardPositionsTest("package test; import java.util.List; "
                 + "class Test { private void method() { List<? super List<? super String>> l; } }",
                 Arrays.asList("List<? super List<? super String>> l;",
@@ -399,7 +399,7 @@
     }
 
     @Test
-    void testCorrectWilcardPositions3() throws IOException {
+    void testCorrectWildcardPositions3() throws IOException {
         performWildcardPositionsTest("package test; import java.util.List; " +
                 "class Test { private void method() { List<? super List<?>> l; } }",
 
@@ -413,7 +413,7 @@
     }
 
     @Test
-    void testCorrectWilcardPositions4() throws IOException {
+    void testCorrectWildcardPositions4() throws IOException {
         performWildcardPositionsTest("package test; import java.util.List; " +
                 "class Test { private void method() { " +
                 "List<? extends List<? extends List<? extends String>>> l; } }",
@@ -432,7 +432,7 @@
     }
 
     @Test
-    void testCorrectWilcardPositions5() throws IOException {
+    void testCorrectWildcardPositions5() throws IOException {
         performWildcardPositionsTest("package test; import java.util.List; " +
                 "class Test { private void method() { " +
                 "List<? extends List<? extends List<? extends String   >>> l; } }",
@@ -701,7 +701,7 @@
             }
         }.scan(cut, null);
 
-        assertEquals("testSwitchError: The Erroneous tree "
+        assertEquals("testOperatorMissingError: The Erroneous tree "
                 + "error values: " + values
                 + " do not match expected error values: "
                 + expectedValues, values, expectedValues);
@@ -726,7 +726,7 @@
             }
         }.scan(cut, null);
 
-        assertEquals("testSwitchError: The Erroneous tree "
+        assertEquals("testMissingParenthesisError: The Erroneous tree "
                 + "error values: " + values
                 + " do not match expected error values: "
                 + expectedValues, values, expectedValues);
@@ -751,7 +751,7 @@
             }
         }.scan(cut, null);
 
-        assertEquals("testSwitchError: The Erroneous tree "
+        assertEquals("testMissingClassError: The Erroneous tree "
                 + "error values: " + values
                 + " do not match expected error values: "
                 + expectedValues, values, expectedValues);
--- a/langtools/test/tools/javac/platform/PlatformProviderTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/platform/PlatformProviderTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -30,7 +30,7 @@
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.platform
- *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.compiler/com.sun.tools.javac.util:+open
  * @build toolbox.ToolBox PlatformProviderTest
  * @run main/othervm PlatformProviderTest
  */
@@ -99,7 +99,7 @@
                   .outdir(".")
                   .options("-J--class-path=" + System.getProperty("test.classes"),
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
-                           "-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
+                           "-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
                            "-XDrawDiagnostics",
                            "--release",
                            platformSpec,
@@ -134,7 +134,7 @@
                   .outdir(".")
                   .options("-J--class-path=" + System.getProperty("test.classes"),
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
-                           "-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
+                           "-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
                            "--release",
                            "fail",
                            System.getProperty("test.src") + "/PlatformProviderTestSource.java")
--- a/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java	Thu Dec 01 09:02:42 2016 +0000
@@ -70,4 +70,4 @@
     public SourceVersion getSupportedSourceVersion() {
         return SourceVersion.latestSupported();
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/processing/model/TestSymtabItems.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/processing/model/TestSymtabItems.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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,7 +25,7 @@
  * @test
  * @bug 7021183 7025809
  * @summary 269: assertion failure getting enclosing element of an undefined name
- * @modules jdk.compiler/com.sun.tools.javac.code
+ * @modules jdk.compiler/com.sun.tools.javac.code:+open
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.model
--- a/langtools/test/tools/javac/scope/DupUnsharedTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/scope/DupUnsharedTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary WriteableScope.dupUnshared not working properly for shared Scopes.
- * @modules jdk.compiler/com.sun.tools.javac.code
+ * @modules jdk.compiler/com.sun.tools.javac.code:+open
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.util
  */
--- a/langtools/test/tools/javac/scope/HashCollisionTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/scope/HashCollisionTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
  * @summary Ensure Scope impl can cope with hash collisions
  * @library /tools/javac/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.code:+open
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
--- a/langtools/test/tools/javac/scope/IterateAndRemove.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/scope/IterateAndRemove.java	Thu Dec 01 09:02:42 2016 +0000
@@ -103,4 +103,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/tree/SourceTreeScannerTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/tree/SourceTreeScannerTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -53,6 +53,7 @@
 import com.sun.source.util.TreeScanner;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.tree.JCTree.JCModuleDecl;
 import com.sun.tools.javac.tree.JCTree.TypeBoundKind;
 import com.sun.tools.javac.util.List;
 
@@ -145,7 +146,13 @@
                     }
                     try {
                         //System.err.println("FIELD: " + f.getName());
-                        reflectiveScan(f.get(tree));
+                        if (tree instanceof JCModuleDecl && f.getName().equals("mods")) {
+                            // The modifiers will not found by TreeScanner,
+                            // but the embedded annotations will be.
+                            reflectiveScan(((JCModuleDecl) tree).mods.annotations);
+                        } else {
+                            reflectiveScan(f.get(tree));
+                        }
                     } catch (IllegalAccessException e) {
                         error(e.toString());
                     }
--- a/langtools/test/tools/javac/tree/TreeKindTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/tree/TreeKindTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -114,6 +114,14 @@
                 ok = ok & verify(k, i, i == AnnotationTree.class);
                 break;
 
+            case EXPORTS:
+                ok = ok & verify(k, i, i == ExportsTree.class);
+                break;
+
+            case OPENS:
+                ok = ok & verify(k, i, i == OpensTree.class);
+                break;
+
             case OTHER:
                 ok = ok & verify(k, i, i == null);
                 break;
--- a/langtools/test/tools/javac/types/ScopeListenerTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javac/types/ScopeListenerTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @bug 8039262
  * @summary Ensure that using Types.membersClosure does not increase the number of listeners on the
  *          class's members Scope.
- * @modules jdk.compiler/com.sun.tools.javac.code
+ * @modules jdk.compiler/com.sun.tools.javac.code:+open
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.util
  */
--- a/langtools/test/tools/javap/4870651/T4870651.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javap/4870651/T4870651.java	Thu Dec 01 09:02:42 2016 +0000
@@ -46,8 +46,8 @@
                "v1(java.lang.String...)");
 
         verify("Test$Enum",
-               "flags: ACC_FINAL, ACC_SUPER, ACC_ENUM",
-               "flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM");
+               "flags: (0x4030) ACC_FINAL, ACC_SUPER, ACC_ENUM",
+               "flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM");
 
         if (errors > 0)
             throw new Error(errors + " found.");
--- a/langtools/test/tools/javap/MethodParameters.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javap/MethodParameters.java	Thu Dec 01 09:02:42 2016 +0000
@@ -45,7 +45,7 @@
     static final String Init0_expected =
         ("  Foo();\n" +
          "    descriptor: ()V\n" +
-         "    flags:\n" +
+         "    flags: (0x0000)\n" +
          "    Code:\n" +
          "      stack=1, locals=1, args_size=1\n" +
          "         0: aload_0\n" +
@@ -57,7 +57,7 @@
     static final String Init1_expected =
         ("  Foo(int);\n" +
          "    descriptor: (I)V\n" +
-         "    flags:\n" +
+         "    flags: (0x0000)\n" +
          "    Code:\n" +
          "      stack=1, locals=2, args_size=2\n" +
          "         0: aload_0\n" +
@@ -72,7 +72,7 @@
     static final String foo0_expected =
         ("  void foo0();\n" +
          "    descriptor: ()V\n" +
-         "    flags:\n" +
+         "    flags: (0x0000)\n" +
          "    Code:\n" +
          "      stack=0, locals=1, args_size=1\n" +
          "         0: return\n" +
@@ -82,7 +82,7 @@
     static final String foo2_expected =
         ("  void foo2(int, int);\n" +
          "    descriptor: (II)V\n" +
-         "    flags:\n" +
+         "    flags: (0x0000)\n" +
          "    Code:\n" +
          "      stack=0, locals=3, args_size=3\n" +
          "         0: return\n" +
--- a/langtools/test/tools/javap/T4975569.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/javap/T4975569.java	Thu Dec 01 09:02:42 2016 +0000
@@ -42,12 +42,12 @@
     }
 
     void run() {
-        verify(Anno.class.getName(), "flags: ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION");
-        verify(E.class.getName(),    "flags: ACC_FINAL, ACC_SUPER, ACC_ENUM");
-        verify(S.class.getName(),    "flags: ACC_BRIDGE, ACC_SYNTHETIC",
+        verify(Anno.class.getName(), "flags: \\(0x2600\\) ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION");
+        verify(E.class.getName(),    "flags: \\(0x4030\\) ACC_FINAL, ACC_SUPER, ACC_ENUM");
+        verify(S.class.getName(),    "flags: \\(0x1040\\) ACC_BRIDGE, ACC_SYNTHETIC",
                                      "InnerClasses:\n  static [# =\\w]+; +// ");
         verify(V.class.getName(),    "void m\\(java.lang.String...\\)",
-                                     "flags: ACC_VARARGS");
+                                     "flags: \\(0x0080\\) ACC_VARARGS");
         verify(Prot.class.getName(), "InnerClasses:\n  protected [# =\\w]+; +// ");
         verify(Priv.class.getName(), new String[]{"-p"},
                                      "InnerClasses:\n  private [# =\\w]+; +// ");
--- a/langtools/test/tools/jdeps/lib/ModuleMetaData.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/lib/ModuleMetaData.java	Thu Dec 01 09:02:42 2016 +0000
@@ -70,8 +70,8 @@
         return this;
     }
 
-    ModuleMetaData requiresPublic(String name) {
-        requires.put(name, new ModuleRequires(name, PUBLIC));
+    ModuleMetaData requiresTransitive(String name) {
+        requires.put(name, new ModuleRequires(name, TRANSITIVE));
         return this;
     }
 
--- a/langtools/test/tools/jdeps/modules/CheckModuleTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/modules/CheckModuleTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -54,7 +54,7 @@
 
     // m4 and m5 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", "m6", "m7", "m8");
+    private static final Set<String> modules = Set.of("unsafe", "m4", "m5", "mVI", "mVII", "m8");
 
     private static final String JAVA_BASE = "java.base";
 
@@ -100,10 +100,10 @@
             { "m4", new ModuleMetaData[] {
                         // original
                         new ModuleMetaData("m4")
-                            .requiresPublic("java.compiler")
+                            .requiresTransitive("java.compiler")
                             .requires("java.logging")
                             // unnused exports
-                            .exports("p4.internal", Set.of("m6", "m7")),
+                            .exports("p4.internal", Set.of("mVI", "mVII")),
                         // suggested version
                         new ModuleMetaData("m4")
                             .requires("java.compiler"),
@@ -115,21 +115,21 @@
             { "m5", new ModuleMetaData[] {
                         // original
                         new ModuleMetaData("m5")
-                            .requiresPublic("java.compiler")
-                            .requiresPublic("java.logging")
+                            .requiresTransitive("java.compiler")
+                            .requiresTransitive("java.logging")
                             .requires("java.sql")
-                            .requiresPublic("m4"),
+                            .requiresTransitive("m4"),
                         // suggested version
                         new ModuleMetaData("m5")
-                            .requiresPublic("java.compiler")
+                            .requiresTransitive("java.compiler")
                             .requires("java.logging")
-                            .requiresPublic("java.sql")
-                            .requiresPublic("m4"),
+                            .requiresTransitive("java.sql")
+                            .requiresTransitive("m4"),
                         // reduced version
                         new ModuleMetaData("m5")
-                            .requiresPublic("java.compiler")
-                            .requiresPublic("java.sql")
-                            .requiresPublic("m4"),
+                            .requiresTransitive("java.compiler")
+                            .requiresTransitive("java.sql")
+                            .requiresTransitive("m4"),
                     }
             },
         };
--- a/langtools/test/tools/jdeps/modules/GenModuleInfo.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/modules/GenModuleInfo.java	Thu Dec 01 09:02:42 2016 +0000
@@ -30,14 +30,17 @@
  * @run testng GenModuleInfo
  */
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.lang.module.ModuleDescriptor;
 
 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.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -51,7 +54,6 @@
 public class GenModuleInfo {
     private static final String MODULE_INFO = "module-info.class";
     private static final String TEST_SRC = System.getProperty("test.src");
-    private static final String TEST_CLASSES = System.getProperty("test.classes");
 
     private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
     private static final Path MODS_DIR = Paths.get("mods");
@@ -60,8 +62,85 @@
     private static final Path NEW_MODS_DIR = Paths.get("new_mods");
 
     // the names of the modules in this test
-    private static final String UNSUPPORTED = "unsupported";
-    private static String[] modules = new String[] {"m1", "m2", "m3", UNSUPPORTED};
+    public static final String UNSUPPORTED = "unsupported";
+    public static final Set<String> MODULES = Set.of(
+        "mI", "mII", "mIII", "provider", UNSUPPORTED
+    );
+
+    /**
+     * Compile modules
+     */
+    public static void compileModules(Path dest) {
+        assertTrue(CompilerUtils.compileModule(SRC_DIR, dest, UNSUPPORTED,
+            "--add-exports", "java.base/jdk.internal.perf=" + UNSUPPORTED));
+        MODULES.stream()
+               .filter(mn -> !mn.equals(UNSUPPORTED))
+               .forEach(mn -> assertTrue(CompilerUtils.compileModule(SRC_DIR, dest, mn)));
+    }
+
+    /**
+     * Create JAR files with no module-info.class
+     */
+    public static List<Path> createJARFiles(Path mods, Path libs) throws IOException {
+        Files.createDirectory(libs);
+
+        for (String mn : MODULES) {
+            Path root = mods.resolve(mn);
+            Path msrc = SRC_DIR.resolve(mn);
+            Path metaInf = msrc.resolve("META-INF");
+            if (Files.exists(metaInf)) {
+                try (Stream<Path> resources = Files.find(metaInf, Integer.MAX_VALUE,
+                        (p, attr) -> { return attr.isRegularFile();})) {
+                    resources.forEach(file -> {
+                        try {
+                            Path path = msrc.relativize(file);
+                            Files.createDirectories(root.resolve(path).getParent());
+                            Files.copy(file, root.resolve(path));
+                        } catch (IOException e) {
+                            throw new UncheckedIOException(e);
+                        }
+                    });
+                }
+            }
+            // copy all entries except module-info.class
+            try (Stream<Path> stream = Files.find(root, Integer.MAX_VALUE,
+                    (p, attr) -> { return attr.isRegularFile();})) {
+                Stream<Path> entries = stream.filter(f -> {
+                    String fn = f.getFileName().toString();
+                    if (fn.endsWith(".class")) {
+                        return !fn.equals("module-info.class");
+                    } else {
+                        return true;
+                    }
+                });
+
+                JdepsUtil.createJar(libs.resolve(mn + ".jar"), root, entries);
+            }
+        }
+
+       return MODULES.stream()
+                .map(mn -> LIBS_DIR.resolve(mn + ".jar"))
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * compile the generated module-info.java
+     */
+    public static void compileNewGenModuleInfo(Path source, Path dest) {
+
+        assertTrue(CompilerUtils.compileModule(source, dest, UNSUPPORTED,
+            "-p", dest.toString(),
+            "--add-exports", "java.base/jdk.internal.perf=" + UNSUPPORTED));
+
+        MODULES.stream()
+            .filter(mn -> !mn.equals(UNSUPPORTED))
+            .forEach(mn -> assertTrue(
+                CompilerUtils.compileModule(source, dest,
+                                            mn, "-p", dest.toString()))
+            );
+
+    }
+
     /**
      * Compiles all modules used by the test
      */
@@ -72,29 +151,14 @@
         CompilerUtils.cleanDir(DEST_DIR);
         CompilerUtils.cleanDir(NEW_MODS_DIR);
 
-        assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, UNSUPPORTED,
-                                               "--add-exports", "java.base/jdk.internal.perf=" + UNSUPPORTED));
-        Arrays.asList("m1", "m2", "m3")
-              .forEach(mn -> assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn)));
-
-        Files.createDirectory(LIBS_DIR);
-        Files.createDirectory(DEST_DIR);
+        compileModules(MODS_DIR);
 
-        for (String mn : modules) {
-            Path root = MODS_DIR.resolve(mn);
-            try (Stream<Path> stream = Files.walk(root, Integer.MAX_VALUE)) {
-                Stream<Path> entries = stream.filter(f -> {
-                    String fn = f.getFileName().toString();
-                    return fn.endsWith(".class") && !fn.equals("module-info.class");
-                });
-                JdepsUtil.createJar(LIBS_DIR.resolve(mn + ".jar"), root, entries);
-            }
-        }
+        createJARFiles(MODS_DIR, LIBS_DIR);
     }
 
     @Test
-    public void jdeps() throws IOException {
-        Stream<String> files = Arrays.stream(modules)
+    public void automaticModules() throws IOException {
+        Stream<String> files = MODULES.stream()
                 .map(mn -> LIBS_DIR.resolve(mn + ".jar"))
                 .map(Path::toString);
         JdepsRunner.run(Stream.concat(Stream.of("-cp"), files).toArray(String[]::new));
@@ -102,43 +166,27 @@
 
     @Test
     public void test() throws IOException {
-        Stream<String> files = Arrays.stream(modules)
+        Files.createDirectory(DEST_DIR);
+
+        Stream<String> files = MODULES.stream()
                 .map(mn -> LIBS_DIR.resolve(mn + ".jar"))
                 .map(Path::toString);
 
-        JdepsRunner.run(Stream.concat(Stream.of("--generate-module-info", DEST_DIR.toString()),
-                                      files).toArray(String[]::new));
+        Stream<String> options = Stream.concat(
+            Stream.of("--generate-module-info", DEST_DIR.toString()), files);
+        JdepsRunner.run(options.toArray(String[]::new));
 
         // check file exists
-        Arrays.stream(modules)
-                .map(mn -> DEST_DIR.resolve(mn).resolve("module-info.java"))
-                .forEach(f -> assertTrue(Files.exists(f)));
+        MODULES.stream()
+             .map(mn -> DEST_DIR.resolve(mn).resolve("module-info.java"))
+             .forEach(f -> assertTrue(Files.exists(f)));
 
-        // copy classes except the original module-info.class
-        try (Stream<Path> stream = Files.walk(MODS_DIR, Integer.MAX_VALUE)) {
-            stream.filter(path -> !path.getFileName().toString().equals(MODULE_INFO) &&
-                                    path.getFileName().toString().endsWith(".class"))
-                  .map(path -> MODS_DIR.relativize(path))
-                  .forEach(path -> {
-                      try {
-                          Path newFile = NEW_MODS_DIR.resolve(path);
-                          Files.createDirectories(newFile.getParent());
-                          Files.copy(MODS_DIR.resolve(path), newFile);
-                      } catch (IOException e) {
-                          throw new UncheckedIOException(e);
-                      }
-                  });
-        }
+        // copy classes to a temporary directory
+        // and then compile new module-info.java
+        copyClasses(MODS_DIR, NEW_MODS_DIR);
+        compileNewGenModuleInfo(DEST_DIR, NEW_MODS_DIR);
 
-        // compile new module-info.java
-        assertTrue(CompilerUtils.compileModule(DEST_DIR, NEW_MODS_DIR, UNSUPPORTED,
-                        "-p", NEW_MODS_DIR.toString(), "-verbose",
-                        "--add-exports", "java.base/jdk.internal.perf=" + UNSUPPORTED));
-        Arrays.asList("m1", "m2", "m3")
-              .forEach(mn -> assertTrue(CompilerUtils.compileModule(DEST_DIR, NEW_MODS_DIR,
-                                        mn, "-p", NEW_MODS_DIR.toString())));
-
-        for (String mn : modules) {
+        for (String mn : MODULES) {
             Path p1 = NEW_MODS_DIR.resolve(mn).resolve(MODULE_INFO);
             Path p2 = MODS_DIR.resolve(mn).resolve(MODULE_INFO);
 
@@ -150,6 +198,30 @@
         }
     }
 
+    /**
+     * Copy classes except the module-info.class to the destination directory
+     */
+    public static void copyClasses(Path from, Path dest) throws IOException {
+        try (Stream<Path> stream = Files.walk(from, Integer.MAX_VALUE)) {
+            stream.filter(path -> !path.getFileName().toString().equals(MODULE_INFO) &&
+                path.getFileName().toString().endsWith(".class"))
+                .map(path -> from.relativize(path))
+                .forEach(path -> {
+                    try {
+                        Path newFile = dest.resolve(path);
+                        Files.createDirectories(newFile.getParent());
+                        Files.copy(from.resolve(path), newFile);
+                    } catch (IOException e) {
+                        throw new UncheckedIOException(e);
+                    }
+                });
+        }
+    }
+
+    /**
+     * Verify the generated module-info.java is equivalent to module-info.class
+     * compiled from source.
+     */
     private void verify(ModuleDescriptor md1, ModuleDescriptor md2) {
         System.out.println("verifying: " + md1.name());
         assertEquals(md1.name(), md2.name());
@@ -158,6 +230,14 @@
         assertEquals(md1.exports().stream()
                                   .map(ModuleDescriptor.Exports::source)
                                   .collect(Collectors.toSet()), md2.packages());
+        if (!md1.opens().isEmpty()) {
+            throw new RuntimeException("unexpected opens: " +
+                md1.opens().stream()
+                   .map(o -> o.toString())
+                   .collect(Collectors.joining(",")));
+        }
+
+        assertEquals(md1.provides(), md2.provides());
     }
 
     private Set<String> packages(Path dir) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/GenOpenModule.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,112 @@
+/*
+ * 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
+ * @summary Tests jdeps --generate-open-module option
+ * @library ../lib
+ * @build CompilerUtils JdepsUtil JdepsRunner
+ * @modules jdk.jdeps/com.sun.tools.jdeps
+ * @run testng GenOpenModule
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.module.ModuleDescriptor;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import java.util.stream.Stream;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+public class GenOpenModule extends GenModuleInfo {
+    private static final String MODULE_INFO = "module-info.class";
+
+    private static final Path MODS_DIR = Paths.get("mods");
+    private static final Path LIBS_DIR = Paths.get("libs");
+    private static final Path DEST_DIR = Paths.get("moduleinfosrc");
+    private static final Path NEW_MODS_DIR = Paths.get("new_mods");
+
+    /**
+     * Compiles all modules used by the test
+     */
+    @BeforeTest
+    public void compileAll() throws Exception {
+
+        compileModules(MODS_DIR);
+
+        createJARFiles(MODS_DIR, LIBS_DIR);
+    }
+
+    @Test
+    public void test() throws IOException {
+        Stream<String> files = MODULES.stream()
+                .map(mn -> LIBS_DIR.resolve(mn + ".jar"))
+                .map(Path::toString);
+
+        Stream<String> options = Stream.concat(
+            Stream.of("--generate-open-module", DEST_DIR.toString()), files);
+        JdepsRunner.run(options.toArray(String[]::new));
+
+        // check file exists
+        MODULES.stream()
+             .map(mn -> DEST_DIR.resolve(mn).resolve("module-info.java"))
+             .forEach(f -> assertTrue(Files.exists(f)));
+
+        // copy classes to a temporary directory
+        // and then compile new module-info.java
+        copyClasses(MODS_DIR, NEW_MODS_DIR);
+        compileNewGenModuleInfo(DEST_DIR, NEW_MODS_DIR);
+
+        for (String mn : MODULES) {
+            Path p1 = NEW_MODS_DIR.resolve(mn).resolve(MODULE_INFO);
+            Path p2 = MODS_DIR.resolve(mn).resolve(MODULE_INFO);
+
+            try (InputStream in1 = Files.newInputStream(p1);
+                 InputStream in2 = Files.newInputStream(p2)) {
+                verify(ModuleDescriptor.read(in1),
+                       ModuleDescriptor.read(in2));
+            }
+        }
+    }
+
+    /*
+     * Verify the dependences
+     */
+    private void verify(ModuleDescriptor openModule, ModuleDescriptor md) {
+        System.out.println("verifying: " + openModule.name());
+        assertTrue(openModule.isOpen());
+        assertTrue(!md.isOpen());
+        assertEquals(openModule.name(), md.name());
+        assertEquals(openModule.requires(), md.requires());
+        assertTrue(openModule.exports().isEmpty());
+        assertEquals(openModule.provides(), md.provides());
+    }
+}
--- a/langtools/test/tools/jdeps/modules/InverseDeps.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/modules/InverseDeps.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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", "m6", "m7")
+        List.of("unsafe", "m4", "m5", "mVI", "mVII")
     );
 
     /**
@@ -108,8 +108,8 @@
                 }
             },
             { "jdk.unsupported", new String[][] {
-                    new String[] {"jdk.unsupported", "unsafe", "m6", "m7"},
-                    new String[] {"jdk.unsupported", "unsafe", "m7"}
+                    new String[] {"jdk.unsupported", "unsafe", "mVI", "mVII"},
+                    new String[] {"jdk.unsupported", "unsafe", "mVII"}
                 }
             },
         };
@@ -155,8 +155,8 @@
                     }
             },
             { "sun.misc", new String[][] {
-                        new String[] {"jdk.unsupported", "unsafe", "m6", "m7"},
-                        new String[] {"jdk.unsupported", "unsafe", "m7"}
+                        new String[] {"jdk.unsupported", "unsafe", "mVI", "mVII"},
+                        new String[] {"jdk.unsupported", "unsafe", "mVII"}
                     }
             }
         };
@@ -180,13 +180,13 @@
         return new Object[][] {
             // -regex and result
             { "org.safe.Lib", new String[][] {
-                    new String[] { "unsafe", "m7"},
-                    new String[] { "unsafe", "m6", "m7"},
+                    new String[] { "unsafe", "mVII"},
+                    new String[] { "unsafe", "mVI", "mVII"},
                 }
             },
             { "java.util.logging.*|org.safe.Lib", new String[][] {
-                    new String[] { "unsafe", "m7"},
-                    new String[] { "unsafe", "m6", "m7"},
+                    new String[] { "unsafe", "mVII"},
+                    new String[] { "unsafe", "mVI", "mVII"},
                     new String[] { "java.logging", "m5"},
                 }
             }
@@ -212,18 +212,18 @@
         return new Object[][] {
             // -regex and result
             { "sun.misc.Unsafe", new String[][] {
-                    new String[] {"jdk.unsupported", "unsafe.jar", "m6.jar", "m7.jar"},
-                    new String[] {"jdk.unsupported", "unsafe.jar", "m7.jar"}
+                    new String[] {"jdk.unsupported", "unsafe.jar", "mVI.jar", "mVII.jar"},
+                    new String[] {"jdk.unsupported", "unsafe.jar", "mVII.jar"}
                 }
             },
             { "org.safe.Lib", new String[][] {
-                    new String[] { "unsafe.jar", "m7.jar"},
-                    new String[] { "unsafe.jar", "m6.jar", "m7.jar"},
+                    new String[] { "unsafe.jar", "mVII.jar"},
+                    new String[] { "unsafe.jar", "mVI.jar", "mVII.jar"},
                 }
             },
             { "java.util.logging.*|org.safe.Lib", new String[][] {
-                    new String[] { "unsafe.jar", "m7.jar"},
-                    new String[] { "unsafe.jar", "m6.jar", "m7.jar"},
+                    new String[] { "unsafe.jar", "mVII.jar"},
+                    new String[] { "unsafe.jar", "mVI.jar", "mVII.jar"},
                     new String[] { "java.logging", "m5.jar"},
                 }
             }
@@ -234,11 +234,11 @@
     public void testClassPath(String name, String[][] expected) throws Exception {
         // -classpath
         String cpath = modules.stream()
-            .filter(mn -> !mn.equals("m7"))
+            .filter(mn -> !mn.equals("mVII"))
             .map(mn -> LIBS_DIR.resolve(mn + ".jar").toString())
             .collect(Collectors.joining(File.pathSeparator));
 
-        Path jarfile = LIBS_DIR.resolve("m7.jar");
+        Path jarfile = LIBS_DIR.resolve("mVII.jar");
 
         String cmd1 = String.format("jdeps --inverse -classpath %s -regex %s %s%n",
             cpath, name, jarfile);
--- a/langtools/test/tools/jdeps/modules/ModuleTest.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/modules/ModuleTest.java	Thu Dec 01 09:02:42 2016 +0000
@@ -58,7 +58,7 @@
 
     // the names of the modules in this test
     private static final String UNSUPPORTED = "unsupported";
-    private static String[] modules = new String[] {"m1", "m2", "m3", "m4", UNSUPPORTED};
+    private static String[] modules = new String[] {"mI", "mII", "mIII", "m4", UNSUPPORTED};
     /**
      * Compiles all modules used by the test
      */
@@ -70,37 +70,37 @@
         assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, UNSUPPORTED,
                                                "--add-exports", "java.base/jdk.internal.perf=" + UNSUPPORTED));
         // m4 is not referenced
-        Arrays.asList("m1", "m2", "m3", "m4")
+        Arrays.asList("mI", "mII", "mIII", "m4")
               .forEach(mn -> assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn)));
 
-        assertTrue(CompilerUtils.compile(SRC_DIR.resolve("m3"), UNNAMED_DIR, "-p", MODS_DIR.toString()));
+        assertTrue(CompilerUtils.compile(SRC_DIR.resolve("mIII"), UNNAMED_DIR, "-p", MODS_DIR.toString()));
         Files.delete(UNNAMED_DIR.resolve("module-info.class"));
     }
 
     @DataProvider(name = "modules")
     public Object[][] expected() {
         return new Object[][]{
-                { "m3", new ModuleMetaData("m3").requiresPublic("java.sql")
-                            .requiresPublic("m2")
+                { "mIII", new ModuleMetaData("mIII").requiresTransitive("java.sql")
+                            .requiresTransitive("mII")
                             .requires("java.logging")
-                            .requiresPublic("m1")
+                            .requiresTransitive("mI")
                             .reference("p3", "java.lang", "java.base")
                             .reference("p3", "java.sql", "java.sql")
                             .reference("p3", "java.util.logging", "java.logging")
-                            .reference("p3", "p1", "m1")
-                            .reference("p3", "p2", "m2")
-                            .qualified("p3", "p2.internal", "m2")
+                            .reference("p3", "p1", "mI")
+                            .reference("p3", "p2", "mII")
+                            .qualified("p3", "p2.internal", "mII")
                 },
-                { "m2", new ModuleMetaData("m2").requiresPublic("m1")
+                { "mII", new ModuleMetaData("mII").requiresTransitive("mI")
                             .reference("p2", "java.lang", "java.base")
-                            .reference("p2", "p1", "m1")
+                            .reference("p2", "p1", "mI")
                             .reference("p2.internal", "java.lang", "java.base")
                             .reference("p2.internal", "java.io", "java.base")
                 },
-                { "m1", new ModuleMetaData("m1").requires("unsupported")
+                { "mI", new ModuleMetaData("mI").requires("unsupported")
                             .reference("p1", "java.lang", "java.base")
                             .reference("p1.internal", "java.lang", "java.base")
-                            .reference("p1.internal", "p1", "m1")
+                            .reference("p1.internal", "p1", "mI")
                             .reference("p1.internal", "q", "unsupported")
                 },
                 { "unsupported", new ModuleMetaData("unsupported")
@@ -115,7 +115,7 @@
         // jdeps --module-path mods -m <name>
         runTest(data, MODS_DIR.toString(), Set.of(name));
 
-        // jdeps --module-path libs/m1.jar:.... -m <name>
+        // jdeps --module-path libs/mI.jar:.... -m <name>
         String mp = Arrays.stream(modules)
                 .filter(mn -> !mn.equals(name))
                 .map(mn -> MODS_DIR.resolve(mn).toString())
@@ -129,21 +129,21 @@
                 { "unnamed", new ModuleMetaData("unnamed", false)
                             .depends("java.sql")
                             .depends("java.logging")
-                            .depends("m1")
-                            .depends("m2")
+                            .depends("mI")
+                            .depends("mII")
                             .reference("p3", "java.lang", "java.base")
                             .reference("p3", "java.sql", "java.sql")
                             .reference("p3", "java.util.logging", "java.logging")
-                            .reference("p3", "p1", "m1")
-                            .reference("p3", "p2", "m2")
-                            .internal("p3", "p2.internal", "m2")
+                            .reference("p3", "p1", "mI")
+                            .reference("p3", "p2", "mII")
+                            .internal("p3", "p2.internal", "mII")
                 },
         };
     }
 
     @Test(dataProvider = "unnamed")
     public void unnamedTest(String name, ModuleMetaData data) throws IOException {
-        runTest(data, MODS_DIR.toString(), Set.of("m1", "m2"), UNNAMED_DIR);
+        runTest(data, MODS_DIR.toString(), Set.of("mI", "mII"), UNNAMED_DIR);
     }
 
     private void runTest(ModuleMetaData data, String modulepath,
--- a/langtools/test/tools/jdeps/modules/TransitiveDeps.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/modules/TransitiveDeps.java	Thu Dec 01 09:02:42 2016 +0000
@@ -58,7 +58,7 @@
     private static final Path LIBS_DIR = Paths.get("libs");
 
     // the names of the modules in this test
-    private static String[] modules = new String[] {"unsafe", "m6", "m7"};
+    private static String[] modules = new String[] {"unsafe", "mVI", "mVII"};
     /**
      * Compiles all modules used by the test
      */
@@ -86,15 +86,15 @@
     @DataProvider(name = "modules")
     public Object[][] expected1() {
         return new Object[][]{
-            { "m7",
-               List.of(new ModuleMetaData("m7")
-                            .requires("m6")
+            { "mVII",
+               List.of(new ModuleMetaData("mVII")
+                            .requires("mVI")
                             .requires("unsafe")
                             .reference("p7.Main", "java.lang.Object", "java.base")
                             .reference("p7.Main", "java.lang.String", "java.base")
                             .reference("p7.Main", "org.safe.Lib", "unsafe")
-                            .reference("p7.Main", "p6.safe.Lib", "m6"),
-                        new ModuleMetaData("m6")
+                            .reference("p7.Main", "p6.safe.Lib", "mVI"),
+                        new ModuleMetaData("mVI")
                             .requires("unsafe")
                             .reference("p6.indirect.UnsafeRef", "java.lang.Object", "java.base")
                             .reference("p6.indirect.UnsafeRef", "org.unsafe.UseUnsafe ", "unsafe")
@@ -121,7 +121,7 @@
 
     @Test(dataProvider = "modules")
     public void testModulePath(String name, List<ModuleMetaData> data) throws IOException {
-        Set<String> roots = Set.of("m6", "unsafe");
+        Set<String> roots = Set.of("mVI", "unsafe");
 
         String cmd1 = String.format("jdeps --module-path %s --add-modules %s -m %s%n", MODS_DIR,
             roots.stream().collect(Collectors.joining(",")), name);
@@ -152,13 +152,13 @@
     @DataProvider(name = "jars")
     public Object[][] expected2() {
         return new Object[][]{
-            { "m7", List.of(new ModuleMetaData("m7.jar")
-                                .requires("m6.jar")
+            { "mVII", List.of(new ModuleMetaData("mVII.jar")
+                                .requires("mVI.jar")
                                 .requires("unsafe.jar")
                                 .reference("p7.Main", "java.lang.Object", "java.base")
                                 .reference("p7.Main", "java.lang.String", "java.base")
                                 .reference("p7.Main", "org.safe.Lib", "unsafe.jar")
-                                .reference("p7.Main", "p6.safe.Lib", "m6.jar"))
+                                .reference("p7.Main", "p6.safe.Lib", "mVI.jar"))
             },
         };
     }
@@ -185,15 +185,15 @@
     @DataProvider(name = "compileTimeView")
     public Object[][] expected3() {
         return new Object[][] {
-            {"m7",
-             List.of(new ModuleMetaData("m7.jar")
-                        .requires("m6.jar")
+            {"mVII",
+             List.of(new ModuleMetaData("mVII.jar")
+                        .requires("mVI.jar")
                         .requires("unsafe.jar")
                         .reference("p7.Main", "java.lang.Object", "java.base")
                         .reference("p7.Main", "java.lang.String", "java.base")
                         .reference("p7.Main", "org.safe.Lib", "unsafe.jar")
-                        .reference("p7.Main", "p6.safe.Lib", "m6.jar"),
-                    new ModuleMetaData("m6.jar")
+                        .reference("p7.Main", "p6.safe.Lib", "mVI.jar"),
+                    new ModuleMetaData("mVI.jar")
                         .requires("unsafe.jar")
                         .reference("p6.indirect.UnsafeRef", "java.lang.Object", "java.base")
                         .reference("p6.indirect.UnsafeRef", "org.unsafe.UseUnsafe ", "unsafe.jar")
@@ -240,15 +240,15 @@
     @DataProvider(name = "recursiveDeps")
     public Object[][] expected4() {
         return new Object[][] {
-            {"m7",
-                List.of(new ModuleMetaData("m7.jar")
-                        .requires("m6.jar")
+            {"mVII",
+                List.of(new ModuleMetaData("mVII.jar")
+                        .requires("mVI.jar")
                         .requires("unsafe.jar")
                         .reference("p7.Main", "java.lang.Object", "java.base")
                         .reference("p7.Main", "java.lang.String", "java.base")
                         .reference("p7.Main", "org.safe.Lib", "unsafe.jar")
-                        .reference("p7.Main", "p6.safe.Lib", "m6.jar"),
-                    new ModuleMetaData("m6.jar")
+                        .reference("p7.Main", "p6.safe.Lib", "mVI.jar"),
+                    new ModuleMetaData("mVI.jar")
                         .requires("unsafe.jar")
                         .reference("p6.safe.Lib", "java.io.PrintStream", "java.base")
                         .reference("p6.safe.Lib", "java.lang.Class", "java.base")
--- a/langtools/test/tools/jdeps/modules/src/m1/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 {
-    requires unsupported;
-    exports p1;
-}
--- a/langtools/test/tools/jdeps/modules/src/m1/p1/Goo.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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.
- *
- * 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 Goo  {
-    public void name() {
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m1/p1/Lib.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 p1;
-
-public class Lib {
-    public static boolean isPresent() {
-        return true;
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m1/p1/S.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 p1;
-
-public interface S {
-    String name();
-}
--- a/langtools/test/tools/jdeps/modules/src/m1/p1/internal/Impl.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 p1.internal;
-
-import p1.S;
-
-public class Impl implements S {
-    public Impl() {
-        q.Counter.create("impl.counter");
-    }
-
-    public String name() {
-        return Impl.class.getName();
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m2/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 m2 {
-    requires public m1;
-    exports p2;
-    exports p2.internal to m3;
-}
--- a/langtools/test/tools/jdeps/modules/src/m2/p2/Bar.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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;
-
-import p1.Goo;
-
-public class Bar {
-    public Bar() {}
-
-    public Goo toGoo() {
-        return new Goo();
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m2/p2/internal/T2.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 p2.internal;
-
-public class T2 {
-    public static void print() {
-        System.out.println("T2");
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m3/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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.
- */
-
-module m3 {
-    requires public java.sql;
-    requires public m2;
-    requires java.logging;   // TODO: --generate-module-info to do transitive reduction
-    requires public m1;
-    exports p3;
-}
--- a/langtools/test/tools/jdeps/modules/src/m3/p3/Foo.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 p3;
-
-import java.sql.Driver;
-import p1.Goo;
-import p2.Bar;
-
-public class Foo {
-    public Goo get(Bar bar) {
-        return bar.toGoo();
-    }
-
-    public Driver getDriver() { return null; }
-}
--- a/langtools/test/tools/jdeps/modules/src/m3/p3/Main.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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 p3;
-
-import p2.internal.T2;
-
-public class Main {
-    public void run() {
-        T2.print();
-    }
-
-    public static void main(String... args) throws Exception {
-        Foo foo = new Foo();
-        foo.getDriver().getParentLogger().config("test");
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m4/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/modules/src/m4/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -23,7 +23,7 @@
 
 module m4 {
     // not used in signature
-    requires public java.compiler;
+    requires transitive java.compiler;
 
     // unused dependence
     requires java.logging;
@@ -31,5 +31,5 @@
     exports p4;
 
     // unuused qualified exports
-    exports p4.internal to m6,m7;
+    exports p4.internal to mVI,mVII;
 }
--- a/langtools/test/tools/jdeps/modules/src/m5/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/jdeps/modules/src/m5/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -22,15 +22,15 @@
  */
 
 module m5 {
-    // m4 requires public java.compiler
-    requires public m4;
-    requires public java.compiler;
+    // m4 requires transitive java.compiler
+    requires transitive m4;
+    requires transitive java.compiler;
 
-    // java.sql should be requires public
+    // java.sql should be requires transitive
     requires java.sql;
 
     // java.logging is used for implementation only
-    requires public java.logging;
+    requires transitive java.logging;
 
     exports p5;
 
--- a/langtools/test/tools/jdeps/modules/src/m6/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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 m6 {
-    requires unsafe;
-
-    // no dependency on sun.misc.Unsafe directly or indirectly
-    exports p6.safe;
-
-    // direct dependency on org.unsafe
-    // hence indirect dependency on sun.misc.Unsafe
-    exports p6.indirect;
-}
--- a/langtools/test/tools/jdeps/modules/src/m6/p6/indirect/UnsafeRef.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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.
- *
- * 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 p6.indirect;
-
-// indirectly depend on sun.misc.Unsafe
-public class UnsafeRef {
-     public static org.unsafe.UseUnsafe get() {
-         return new org.unsafe.UseUnsafe();
-     }
-}
--- a/langtools/test/tools/jdeps/modules/src/m6/p6/safe/Lib.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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 p6.safe;
-
-// no direct or indirect dependency on sun.misc.Unsafe
-public class Lib {
-    public static void doit() {
-        System.out.println(Lib.class.getName());
-        org.safe.Lib.doit();
-    }
-}
--- a/langtools/test/tools/jdeps/modules/src/m7/module-info.java	Wed Nov 23 16:16:36 2016 +0000
+++ /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.
- *
- * 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 m7 {
-    // only use classes that have no direct or indirect dependency
-    // to sun.misc.Unsafe
-    requires unsafe;
-    requires m6;
-}
--- a/langtools/test/tools/jdeps/modules/src/m7/p7/Main.java	Wed Nov 23 16:16:36 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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 p7;
-
-// Only use classes in unsafe and m6 modules with no
-// direct or indirect dependency on sun.misc.Unsafe
-public class Main {
-    public static void main(String... args) {
-        p6.safe.Lib.doit();
-        org.safe.Lib.doit();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mI/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 mI {
+    requires unsupported;
+    exports p1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mI/p1/Goo.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 Goo  {
+    public void name() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mI/p1/Lib.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 p1;
+
+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/mI/p1/S.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 p1;
+
+public interface S {
+    String name();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mI/p1/internal/Impl.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 p1.internal;
+
+import p1.S;
+
+public class Impl implements S {
+    public Impl() {
+        q.Counter.create("impl.counter");
+    }
+
+    public String name() {
+        return Impl.class.getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mII/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 mII {
+    requires transitive mI;
+    exports p2;
+    exports p2.internal to mIII;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mII/p2/Bar.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p2;
+
+import p1.Goo;
+
+public class Bar {
+    public Bar() {}
+
+    public Goo toGoo() {
+        return new Goo();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mII/p2/internal/T2.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 p2.internal;
+
+public class T2 {
+    public static void print() {
+        System.out.println("T2");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mIII/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ */
+
+module mIII {
+    requires transitive java.sql;
+    requires transitive mII;
+    requires java.logging;   // TODO: --generate-module-info to do transitive reduction
+    requires transitive mI;
+    exports p3;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mIII/p3/Foo.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 p3;
+
+import java.sql.Driver;
+import p1.Goo;
+import p2.Bar;
+
+public class Foo {
+    public Goo get(Bar bar) {
+        return bar.toGoo();
+    }
+
+    public Driver getDriver() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mIII/p3/Main.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 p3;
+
+import p2.internal.T2;
+
+public class Main {
+    public void run() {
+        T2.print();
+    }
+
+    public static void main(String... args) throws Exception {
+        Foo foo = new Foo();
+        foo.getDriver().getParentLogger().config("test");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mVI/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,33 @@
+/*
+ * 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 mVI {
+    requires unsafe;
+
+    // no dependency on sun.misc.Unsafe directly or indirectly
+    exports p6.safe;
+
+    // direct dependency on org.unsafe
+    // hence indirect dependency on sun.misc.Unsafe
+    exports p6.indirect;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mVI/p6/indirect/UnsafeRef.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 p6.indirect;
+
+// indirectly depend on sun.misc.Unsafe
+public class UnsafeRef {
+     public static org.unsafe.UseUnsafe get() {
+         return new org.unsafe.UseUnsafe();
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mVI/p6/safe/Lib.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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 p6.safe;
+
+// no direct or indirect dependency on sun.misc.Unsafe
+public class Lib {
+    public static void doit() {
+        System.out.println(Lib.class.getName());
+        org.safe.Lib.doit();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mVII/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 mVII {
+    // only use classes that have no direct or indirect dependency
+    // to sun.misc.Unsafe
+    requires unsafe;
+    requires mVI;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/mVII/p7/Main.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,33 @@
+/*
+ * 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 p7;
+
+// Only use classes in unsafe and mVI modules with no
+// direct or indirect dependency on sun.misc.Unsafe
+public class Main {
+    public static void main(String... args) {
+        p6.safe.Lib.doit();
+        org.safe.Lib.doit();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/META-INF/services/java.util.spi.ToolProvider	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,3 @@
+q.ProviderImpl3
+q.ProviderImpl2
+q.ProviderImpl1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/META-INF/services/p.Service$I$J	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,1 @@
+p.Provider$Impl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/module-info.java	Thu Dec 01 09:02:42 2016 +0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module provider {
+    provides java.util.spi.ToolProvider with
+        q.ProviderImpl3,
+        q.ProviderImpl2,
+        q.ProviderImpl1;
+
+    uses p.Service.I.J;
+
+    // nested types
+    provides p.Service.I.J with p.Provider.Impl;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/p/Provider.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 p;
+
+public class Provider {
+    public static class Impl implements Service.I.J {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/p/Service.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 p;
+
+public class Service {
+    public static class I {
+        public static interface J {}
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/q/ProviderImpl1.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 q;
+
+import java.io.*;
+import java.util.spi.ToolProvider;
+
+public class ProviderImpl1 implements ToolProvider {
+    public String name() {
+        return "provider1";
+    }
+
+    public int run(PrintWriter out, PrintWriter err, String... args) {
+        return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/q/ProviderImpl2.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 q;
+
+import java.io.*;
+import java.util.spi.ToolProvider;
+
+public class ProviderImpl2 implements ToolProvider {
+    public String name() {
+        return "provider2";
+    }
+
+    public int run(PrintWriter out, PrintWriter err, String... args) {
+        return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/src/provider/q/ProviderImpl3.java	Thu Dec 01 09:02:42 2016 +0000
@@ -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.
+ *
+ * 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 q;
+
+import java.io.*;
+import java.util.spi.ToolProvider;
+
+public class ProviderImpl3 implements ToolProvider {
+    public String name() {
+        return "provider3";
+    }
+
+    public int run(PrintWriter out, PrintWriter err, String... args) {
+        return 0;
+    }
+}
--- a/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Thu Dec 01 09:02:42 2016 +0000
@@ -72,51 +72,132 @@
     }
 
     /**
-     * Adds a "requires public" directive to the declaration.
-     * @param requires the name of the module that is required
+     * Adds a "requires" directive to the declaration.
+     * @param module the name of the module that is required
+     * @param modulePath a path in while to locate the modules
+     *    if the declaration is compiled
+     * @return this builder
+     */
+    public ModuleBuilder requires(String module, Path... modulePath) {
+        addDirective(requires, "requires " + module + ";");
+        this.modulePath.addAll(Arrays.asList(modulePath));
+        return this;
+
+    }
+
+    /**
+     * Adds a "requires static" directive to the declaration.
+     * @param module the name of the module that is required
      * @param modulePath a path in which to locate the modules
      *    if the declaration is compiled
      * @return this builder
      */
-    public ModuleBuilder requiresPublic(String requires, Path... modulePath) {
-        this.requires.add("requires public " + requires + ";");
+    public ModuleBuilder requiresStatic(String module, Path... modulePath) {
+        addDirective(requires, "requires static " + module + ";");
+        this.modulePath.addAll(Arrays.asList(modulePath));
+        return this;
+    }
+
+    /**
+     * Adds a "requires transitive" directive to the declaration.
+     * @param module the name of the module that is required
+     * @param modulePath a path in which to locate the modules
+     *    if the declaration is compiled
+     * @return this builder
+     */
+    public ModuleBuilder requiresTransitive(String module, Path... modulePath) {
+        addDirective(requires, "requires transitive " + module + ";");
         this.modulePath.addAll(Arrays.asList(modulePath));
         return this;
     }
 
     /**
-     * Adds a "requires" directive to the declaration.
-     * @param requires the name of the module that is required
-     * @param modulePath a path in while to locate the modules
+     * Adds a "requires static transitive" directive to the declaration.
+     * @param module the name of the module that is required
+     * @param modulePath a path in which to locate the modules
      *    if the declaration is compiled
      * @return this builder
      */
-    public ModuleBuilder requires(String requires, Path... modulePath) {
-        this.requires.add("requires " + requires + ";");
+    public ModuleBuilder requiresStaticTransitive(String module, Path... modulePath) {
+        addDirective(requires, "requires static transitive " + module + ";");
         this.modulePath.addAll(Arrays.asList(modulePath));
         return this;
     }
 
     /**
+     * Adds an unqualified "exports" directive to the declaration.
+     * @param pkg the name of the package to be exported
+     * @return this builder
+     */
+    public ModuleBuilder exports(String pkg) {
+        return addDirective(exports, "exports " + pkg + ";");
+    }
+
+    /**
+     * Adds an unqualified "exports dynamic" directive to the declaration.
+     * @param pkg the name of the package to be exported
+     * @return this builder
+     */
+    public ModuleBuilder exportsDynamic(String pkg) {
+        return addDirective(exports, "exports dynamic " + pkg + ";");
+    }
+
+    /**
+     * Adds an unqualified "exports private" directive to the declaration.
+     * @param pkg the name of the package to be exported
+     * @return this builder
+     */
+    public ModuleBuilder exportsPrivate(String pkg) {
+        return addDirective(exports, "exports private " + pkg + ";");
+    }
+
+    /**
+     * Adds an unqualified "exports dynamic private" directive to the declaration.
+     * @param pkg the name of the package to be exported
+     * @return this builder
+     */
+    public ModuleBuilder exportsDynamicPrivate(String pkg) {
+        return addDirective(exports, "exports dynamic private " + pkg + ";");
+    }
+
+    /**
      * Adds a qualified "exports" directive to the declaration.
      * @param pkg the name of the package to be exported
      * @param module the name of the module to which it is to be exported
      * @return this builder
      */
     public ModuleBuilder exportsTo(String pkg, String module) {
-        this.exports.add("exports " + pkg + " to " + module + ";");
-        return this;
+        return addDirective(exports, "exports " + pkg + " to " + module + ";");
     }
 
     /**
-     * Adds an unqualified "exports" directive to the declaration.
+     * Adds a qualified "exports dynamic" directive to the declaration.
      * @param pkg the name of the package to be exported
      * @param module the name of the module to which it is to be exported
      * @return this builder
      */
-    public ModuleBuilder exports(String pkg) {
-        this.exports.add("exports " + pkg + ";");
-        return this;
+    public ModuleBuilder exportsDynamicTo(String pkg, String module) {
+        return addDirective(exports, "exports dynamic " + pkg + " to " + module + ";");
+    }
+
+    /**
+     * Adds a qualified "exports private" directive to the declaration.
+     * @param pkg the name of the package to be exported
+     * @param module the name of the module to which it is to be exported
+     * @return this builder
+     */
+    public ModuleBuilder exportsPrivateTo(String pkg, String module) {
+        return addDirective(exports, "exports private " + pkg + " to " + module + ";");
+    }
+
+    /**
+     * Adds a qualified "exports dynamic private" directive to the declaration.
+     * @param pkg the name of the package to be exported
+     * @param module the name of the module to which it is to be exported
+     * @return this builder
+     */
+    public ModuleBuilder exportsDynamicPrivateTo(String pkg, String module) {
+        return addDirective(exports, "exports dynamic private " + pkg + " to " + module + ";");
     }
 
     /**
@@ -125,8 +206,7 @@
      * @return this builder
      */
     public ModuleBuilder uses(String service) {
-        this.uses.add("uses " + service + ";");
-        return this;
+        return addDirective(uses, "uses " + service + ";");
     }
 
     /**
@@ -136,7 +216,11 @@
      * @return this builder
      */
     public ModuleBuilder provides(String service, String implementation) {
-        this.provides.add("provides " + service + " with " + implementation + ";");
+        return addDirective(provides, "provides " + service + " with " + implementation + ";");
+    }
+
+    private ModuleBuilder addDirective(List<String> directives, String directive) {
+        directives.add(directive);
         return this;
     }
 
--- a/langtools/test/tools/sjavac/Serialization.java	Wed Nov 23 16:16:36 2016 +0000
+++ b/langtools/test/tools/sjavac/Serialization.java	Thu Dec 01 09:02:42 2016 +0000
@@ -61,7 +61,7 @@
                 Option.SRC.arg, "root",
                 Option.SOURCEPATH.arg, "sourcepath",
                 Option.CLASSPATH.arg, "classpath",
-                Option.MODULEPATH.arg, "modulepath",
+                Option.MODULE_PATH.arg, "modulepath",
                 Option.PERMIT_SOURCES_WITHOUT_PACKAGE.arg,
                 Option.PERMIT_UNIDENTIFIED_ARTIFACTS.arg,
                 Option.TR.arg, ".prop=" + CompileJavaPackages.class.getName(),