changeset 43144:b5e41646e1a6

Merge
author lana
date Fri, 13 Jan 2017 01:35:30 +0000
parents 39a1515fd106 a8f5cdfa330a
children 35ee451a5fd3
files langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacSourcePosition.java langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/NotDefAccessClassPackageCantAccess.java langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/module-info.java langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/p1/C1.java langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/module-info.java langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/p2/C2.java
diffstat 133 files changed, 3131 insertions(+), 707 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java	Fri Jan 13 01:35:30 2017 +0000
@@ -243,9 +243,9 @@
      * Returns the names of the annotation types supported by this
      * processor.  An element of the result may be the canonical
      * (fully qualified) name of a supported annotation type.
-     * Alternately it may be of the form &quot;<tt><i>name</i>.*</tt>&quot;
+     * Alternately it may be of the form &quot;<code><i>name</i>.*</code>&quot;
      * representing the set of all annotation types with canonical
-     * names beginning with &quot;<tt><i>name.</i></tt>&quot;.
+     * names beginning with &quot;<code><i>name.</i></code>&quot;.
      *
      * In either of those cases, the name of the annotation type can
      * be optionally preceded by a module name followed by a {@code
@@ -267,13 +267,13 @@
      * <dl>
      * <dt><i>SupportedAnnotationTypeString:</i>
      * <dd><i>ModulePrefix</i><sub><i>opt</i></sub> <i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
-     * <dd><tt>*</tt>
+     * <dd><code>*</code>
      *
      * <dt><i>ModulePrefix:</i>
-     * <dd><i>TypeName</i> <tt>/</tt>
+     * <dd><i>TypeName</i> <code>/</code>
      *
      * <dt><i>DotStar:</i>
-     * <dd><tt>.</tt> <tt>*</tt>
+     * <dd><code>.</code> <code>*</code>
      * </dl>
      * </blockquote>
      *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java	Fri Jan 13 01:35:30 2017 +0000
@@ -41,7 +41,7 @@
  * implementing this interface are used to operate on a value when the
  * type of that value is unknown at compile time.  When a visitor is
  * passed to a value's {@link AnnotationValue#accept accept} method,
- * the <tt>visit<i>XYZ</i></tt> method applicable to that value is
+ * the <code>visit<i>XYZ</i></code> method applicable to that value is
  * invoked.
  *
  * <p> Classes implementing this interface may or may not throw a
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java	Fri Jan 13 01:35:30 2017 +0000
@@ -32,7 +32,7 @@
  * pattern.  Classes implementing this interface are used to operate
  * on an element when the kind of element is unknown at compile time.
  * When a visitor is passed to an element's {@link Element#accept
- * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
+ * accept} method, the <code>visit<i>XYZ</i></code> method most applicable
  * to that element is invoked.
  *
  * <p> Classes implementing this interface may or may not throw a
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java	Fri Jan 13 01:35:30 2017 +0000
@@ -32,7 +32,7 @@
  * visitor design pattern.  Classes implementing this
  * interface are used to operate on a type when the kind of
  * type is unknown at compile time.  When a visitor is passed to a
- * type's {@link TypeMirror#accept accept} method, the <tt>visit<i>XYZ</i></tt>
+ * type's {@link TypeMirror#accept accept} method, the <code>visit<i>XYZ</i></code>
  * method most applicable to that type is invoked.
  *
  * <p> Classes implementing this interface may or may not throw a
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java	Fri Jan 13 01:35:30 2017 +0000
@@ -28,11 +28,11 @@
 
 /**
  * Represents a wildcard type argument.
- * Examples include:    <pre><tt>
+ * Examples include:    <pre><code>
  *   ?
  *   ? extends Number
  *   ? super T
- * </tt></pre>
+ * </code></pre>
  *
  * <p> A wildcard may have its upper bound explicitly set by an
  * {@code extends} clause, its lower bound explicitly set by a
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Fri Jan 13 01:35:30 2017 +0000
@@ -36,10 +36,10 @@
  * A visitor of program elements based on their {@linkplain
  * ElementKind kind} with default behavior appropriate for the {@link
  * SourceVersion#RELEASE_6 RELEASE_6} source version.  For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,10 +34,10 @@
  * A visitor of program elements based on their {@linkplain
  * ElementKind kind} with default behavior appropriate for the {@link
  * SourceVersion#RELEASE_7 RELEASE_7} source version.  For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor8.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor8.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,10 +34,10 @@
  * A visitor of program elements based on their {@linkplain
  * ElementKind kind} with default behavior appropriate for the {@link
  * SourceVersion#RELEASE_8 RELEASE_8} source version.  For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,10 +34,10 @@
  * A visitor of program elements based on their {@linkplain
  * ElementKind kind} with default behavior appropriate for the {@link
  * SourceVersion#RELEASE_9 RELEASE_9} source version.  For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,26 +34,26 @@
 /**
  * A scanning visitor of program elements with default behavior
  * appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6}
- * source version.  The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version.  The <code>visit<i>XYZ</i></code> methods in this
  * class scan their component elements by calling {@code scan} on
  * their {@linkplain Element#getEnclosedElements enclosed elements},
  * {@linkplain ExecutableElement#getParameters parameters}, etc., as
  * indicated in the individual method specifications.  A subclass can
  * control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods.  Note that clients of a scanner
+ * <code>visit<i>XYZ</i></code> methods.  Note that clients of a scanner
  * may get the desired behavior be invoking {@code v.scan(e, p)} rather
  * than {@code v.visit(e, p)} on the root objects of interest.
  *
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
  * new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>.  In this
+ * default way by calling <code>super.visit<i>XYZ</i></code>.  In this
  * fashion, the concrete visitor can control the ordering of traversal
  * over the component elements with respect to the additional
  * processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>XYZ</i></code> at the start of the overridden
  * methods will yield a preorder traversal, etc.  If the component
  * elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
  * should call {@code scan} with the elements in the desired order.
  *
  * <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,26 +34,26 @@
 /**
  * A scanning visitor of program elements with default behavior
  * appropriate for the {@link SourceVersion#RELEASE_7 RELEASE_7}
- * source version.  The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version.  The <code>visit<i>XYZ</i></code> methods in this
  * class scan their component elements by calling {@code scan} on
  * their {@linkplain Element#getEnclosedElements enclosed elements},
  * {@linkplain ExecutableElement#getParameters parameters}, etc., as
  * indicated in the individual method specifications.  A subclass can
  * control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods.  Note that clients of a scanner
+ * <code>visit<i>XYZ</i></code> methods.  Note that clients of a scanner
  * may get the desired behavior be invoking {@code v.scan(e, p)} rather
  * than {@code v.visit(e, p)} on the root objects of interest.
  *
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
  * new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>.  In this
+ * default way by calling <code>super.visit<i>XYZ</i></code>.  In this
  * fashion, the concrete visitor can control the ordering of traversal
  * over the component elements with respect to the additional
  * processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>XYZ</i></code> at the start of the overridden
  * methods will yield a preorder traversal, etc.  If the component
  * elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
  * should call {@code scan} with the elements in the desired order.
  *
  * <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner8.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner8.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,26 +34,26 @@
 /**
  * A scanning visitor of program elements with default behavior
  * appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
- * source version.  The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version.  The <code>visit<i>XYZ</i></code> methods in this
  * class scan their component elements by calling {@code scan} on
  * their {@linkplain Element#getEnclosedElements enclosed elements},
  * {@linkplain ExecutableElement#getParameters parameters}, etc., as
  * indicated in the individual method specifications.  A subclass can
  * control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods.  Note that clients of a scanner
+ * <code>visit<i>XYZ</i></code> methods.  Note that clients of a scanner
  * may get the desired behavior be invoking {@code v.scan(e, p)} rather
  * than {@code v.visit(e, p)} on the root objects of interest.
  *
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
  * new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>.  In this
+ * default way by calling <code>super.visit<i>XYZ</i></code>.  In this
  * fashion, the concrete visitor can control the ordering of traversal
  * over the component elements with respect to the additional
  * processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>XYZ</i></code> at the start of the overridden
  * methods will yield a preorder traversal, etc.  If the component
  * elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
  * should call {@code scan} with the elements in the desired order.
  *
  * <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,26 +34,26 @@
 /**
  * A scanning visitor of program elements with default behavior
  * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
- * source version.  The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version.  The <code>visit<i>XYZ</i></code> methods in this
  * class scan their component elements by calling {@code scan} on
  * their {@linkplain Element#getEnclosedElements enclosed elements},
  * {@linkplain ExecutableElement#getParameters parameters}, etc., as
  * indicated in the individual method specifications.  A subclass can
  * control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods.  Note that clients of a scanner
+ * <code>visit<i>XYZ</i></code> methods.  Note that clients of a scanner
  * may get the desired behavior be invoking {@code v.scan(e, p)} rather
  * than {@code v.visit(e, p)} on the root objects of interest.
  *
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
  * new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>.  In this
+ * default way by calling <code>super.visit<i>XYZ</i></code>.  In this
  * fashion, the concrete visitor can control the ordering of traversal
  * over the component elements with respect to the additional
  * processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>XYZ</i></code> at the start of the overridden
  * methods will yield a preorder traversal, etc.  If the component
  * elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
  * should call {@code scan} with the elements in the desired order.
  *
  * <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,10 +34,10 @@
  * A visitor of types based on their {@linkplain TypeKind kind} with
  * default behavior appropriate for the {@link SourceVersion#RELEASE_6
  * RELEASE_6} source version.  For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,10 +34,10 @@
  * A visitor of types based on their {@linkplain TypeKind kind} with
  * default behavior appropriate for the {@link SourceVersion#RELEASE_7
  * RELEASE_7} source version.  For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor8.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor8.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,10 +34,10 @@
  * A visitor of types based on their {@linkplain TypeKind kind} with
  * default behavior appropriate for the {@link SourceVersion#RELEASE_8
  * RELEASE_8} source version.  For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java	Fri Jan 13 01:35:30 2017 +0000
@@ -34,10 +34,10 @@
  * A visitor of types based on their {@linkplain TypeKind kind} with
  * default behavior appropriate for the {@link SourceVersion#RELEASE_9
  * RELEASE_9} source version.  For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>XYZ</i></code> that may have more than one
+ * kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
+ * to the <code>visit<i>XYZKind</i></code> method corresponding to the
+ * first argument's kind.  The <code>visit<i>XYZKind</i></code> methods
  * call {@link #defaultAction defaultAction}, passing their arguments
  * to {@code defaultAction}'s corresponding parameters.
  *
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Jan 13 01:35:30 2017 +0000
@@ -921,6 +921,7 @@
 
         public PackageSymbol unnamedPackage;
         public Map<Name, PackageSymbol> visiblePackages;
+        public Set<ModuleSymbol> readModules;
         public List<Symbol> enclosedPackages = List.nil();
 
         public Completer usesProvidesCompleter = Completer.NULL_COMPLETER;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Jan 13 01:35:30 2017 +0000
@@ -61,7 +61,6 @@
 import com.sun.tools.javac.util.List;
 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.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
@@ -469,9 +468,7 @@
         scope.enter(errSymbol);
 
         Source source = Source.instance(context);
-        Options options = Options.instance(context);
-        boolean noModules = options.isSet("noModules");
-        if (source.allowModules() && !noModules) {
+        if (source.allowModules()) {
             java_base = enterModule(names.java_base);
             //avoid completing java.base during the Symtab initialization
             java_base.completer = Completer.NULL_COMPLETER;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Jan 13 01:35:30 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,7 @@
 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.PCK;
 import static com.sun.tools.javac.code.Kinds.Kind.VAR;
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.ARRAY;
@@ -228,7 +229,14 @@
         s.resetAnnotations(); // mark Annotations as incomplete for now
 
         normal(() -> {
-            Assert.check(s.annotationsPendingCompletion());
+            // Packages are unusual, in that they are the only type of declaration that can legally appear
+            // more than once in a compilation, and in all cases refer to the same underlying symbol.
+            // This means they are the only kind of declaration that syntactically may have multiple sets
+            // of annotations, each on a different package declaration, even though that is ultimately
+            // forbidden by JLS 8 section 7.4.
+            // The corollary here is that all of the annotations on a package symbol may have already
+            // been handled, meaning that the set of annotations pending completion is now empty.
+            Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
             JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
             DiagnosticPosition prevLintPos =
                     deferPos != null
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jan 13 01:35:30 2017 +0000
@@ -353,7 +353,7 @@
             @Override @DefinedBy(Api.COMPILER_TREE)
             public Symbol visitMemberSelect(MemberSelectTree node, Env<AttrContext> env) {
                 Symbol site = visit(node.getExpression(), env);
-                if (site.kind == ERR || site.kind == ABSENT_TYP)
+                if (site.kind == ERR || site.kind == ABSENT_TYP || site.kind == HIDDEN)
                     return site;
                 Name name = (Name)node.getIdentifier();
                 if (site.kind == PCK) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jan 13 01:35:30 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -436,8 +436,10 @@
     }
 
     void clearLocalClassNameIndexes(ClassSymbol c) {
-        localClassNameIndexes.remove(new Pair<>(
-                c.owner.enclClass().flatname, c.name));
+        if (c.owner != null && c.owner.kind != NIL) {
+            localClassNameIndexes.remove(new Pair<>(
+                    c.owner.enclClass().flatname, c.name));
+        }
     }
 
     public void newRound() {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Fri Jan 13 01:35:30 2017 +0000
@@ -1327,6 +1327,7 @@
         initAddExports();
 
         msym.visiblePackages = new LinkedHashMap<>();
+        msym.readModules = new HashSet<>(readable);
 
         Map<Name, ModuleSymbol> seen = new HashMap<>();
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jan 13 01:35:30 2017 +0000
@@ -54,14 +54,19 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.EnumSet;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Set;
+import java.util.function.BiFunction;
 import java.util.function.BiPredicate;
+import java.util.function.Predicate;
 import java.util.stream.Stream;
 
 import javax.lang.model.element.ElementVisitor;
 
+import com.sun.tools.javac.code.Directive.ExportsDirective;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Flags.BLOCK;
 import static com.sun.tools.javac.code.Flags.STATIC;
@@ -69,6 +74,8 @@
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** Helper class for name resolution, used mostly by the attribution phase.
@@ -89,6 +96,7 @@
     Check chk;
     Infer infer;
     ClassFinder finder;
+    ModuleFinder moduleFinder;
     Types types;
     JCDiagnostic.Factory diags;
     public final boolean allowMethodHandles;
@@ -98,8 +106,6 @@
     private final boolean compactMethodDiags;
     final EnumSet<VerboseResolutionMode> verboseResolutionMode;
 
-    private final boolean checkModuleAccess;
-
     WriteableScope polymorphicSignatureScope;
 
     protected Resolve(Context context) {
@@ -118,6 +124,7 @@
         chk = Check.instance(context);
         infer = Infer.instance(context);
         finder = ClassFinder.instance(context);
+        moduleFinder = ModuleFinder.instance(context);
         types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         Source source = Source.instance(context);
@@ -135,10 +142,6 @@
         inapplicableMethodException = new InapplicableMethodException(diags);
 
         allowModules = source.allowModules();
-
-        // The following is required, for now, to support building
-        // Swing beaninfo via javadoc.
-        checkModuleAccess = !options.isSet("noModules");
     }
 
     /** error symbols, which are returned when resolution fails
@@ -321,8 +324,7 @@
                 isAccessible = true;
                 break;
             case PUBLIC:
-                isAccessible = true;
-                if (allowModules && checkModuleAccess) {
+                if (allowModules) {
                     ModuleSymbol currModule = env.toplevel.modle;
                     currModule.complete();
                     PackageSymbol p = c.packge();
@@ -497,7 +499,7 @@
         public Void visitClassType(ClassType t, Env<AttrContext> env) {
             visit(t.getTypeArguments(), env);
             if (!isAccessible(env, t, true)) {
-                accessBase(new AccessError(t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
+                accessBase(new AccessError(env, null, t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
             }
             return null;
         }
@@ -1971,7 +1973,7 @@
     Symbol loadClass(Env<AttrContext> env, Name name) {
         try {
             ClassSymbol c = finder.loadClass(env.toplevel.modle, name);
-            return isAccessible(env, c) ? c : new AccessError(c);
+            return isAccessible(env, c) ? c : new AccessError(env, null, c);
         } catch (ClassFinder.BadClassFile err) {
             throw err;
         } catch (CompletionFailure ex) {
@@ -1989,20 +1991,29 @@
         Symbol loadClass(Env<AttrContext> env, Name name);
     }
 
-    private RecoveryLoadClass recoveryLoadClass = (env, name) -> {
-        //even if a class cannot be found in the current module and packages in modules it depends on that
-        //are exported for any or this module, the class may exist internally in some of these modules,
-        //or may exist in a module on which this module does not depend. Provide better diagnostic in
-        //such cases by looking for the class in any module:
-        for (ModuleSymbol ms : syms.getAllModules()) {
-            //do not load currently unloaded classes, to avoid too eager completion of random things in other modules:
-            ClassSymbol clazz = syms.getClass(ms, name);
-
-            if (clazz != null) {
-                return new AccessError(clazz);
+    private RecoveryLoadClass recoveryLoadClass = new RecoveryLoadClass() {
+        @Override
+        public Symbol loadClass(Env<AttrContext> env, Name name) {
+            if (allowModules) {
+                Scope importScope = env.toplevel.namedImportScope;
+                Symbol existing = importScope.findFirst(Convert.shortName(name),
+                                                        sym -> sym.kind == TYP && sym.flatName() == name);
+
+                if (existing != null) {
+                    return new InvisibleSymbolError(env, true, existing);
+                }
+
+                return lookupInvisibleSymbol(env, name, syms::getClass, (ms, n) -> {
+                    try {
+                        return finder.loadClass(ms, n);
+                    } catch (CompletionFailure cf) {
+                        //ignore
+                        return null;
+                    }
+                }, sym -> sym.kind == Kind.TYP, false, typeNotFound);
             }
-        }
-        return null;
+            return null;
+        }
     };
 
     public RecoveryLoadClass setRecoveryLoadClass(RecoveryLoadClass recovery) {
@@ -2011,6 +2022,84 @@
         return prev;
     }
 
+    Symbol lookupPackage(Env<AttrContext> env, Name name) {
+        PackageSymbol pack = syms.lookupPackage(env.toplevel.modle, name);
+
+        if (allowModules && isImportOnDemand(env, name)) {
+            pack.complete();
+            if (!pack.exists()) {
+                Name nameAndDot = name.append('.', names.empty);
+                boolean prefixOfKnown =
+                        env.toplevel.modle.visiblePackages.values()
+                                                          .stream()
+                                                          .anyMatch(p -> p.fullname.startsWith(nameAndDot));
+
+                return lookupInvisibleSymbol(env, name, syms::getPackage, syms::enterPackage, sym -> {
+                    sym.complete();
+                    return sym.exists();
+                }, prefixOfKnown, pack);
+            }
+        }
+
+        return pack;
+    }
+
+    private boolean isImportOnDemand(Env<AttrContext> env, Name name) {
+        if (!env.tree.hasTag(IMPORT))
+            return false;
+
+        JCTree qualid = ((JCImport) env.tree).qualid;
+
+        if (!qualid.hasTag(SELECT))
+            return false;
+
+        if (TreeInfo.name(qualid) != names.asterisk)
+            return false;
+
+        return TreeInfo.fullName(((JCFieldAccess) qualid).selected) == name;
+    }
+
+    private Symbol lookupInvisibleSymbol(Env<AttrContext> env,
+                                         Name name,
+                                         BiFunction<ModuleSymbol, Name, Symbol> get,
+                                         BiFunction<ModuleSymbol, Name, Symbol> load,
+                                         Predicate<Symbol> validate,
+                                         boolean suppressError,
+                                         Symbol defaultResult) {
+        //even if a class/package cannot be found in the current module and among packages in modules
+        //it depends on that are exported for any or this module, the class/package may exist internally
+        //in some of these modules, or may exist in a module on which this module does not depend.
+        //Provide better diagnostic in such cases by looking for the class in any module:
+        Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules());
+
+        recoverableModules.remove(env.toplevel.modle);
+
+        for (ModuleSymbol ms : recoverableModules) {
+            Symbol sym = get.apply(ms, name);
+
+            //avoid overly eager completing classes from source-based modules, as those
+            //may not be completable with the current compiler settings:
+            if (sym == null && (ms.sourceLocation == null)) {
+                if (ms.classLocation == null) {
+                    ms = moduleFinder.findModule(ms);
+                }
+
+                if (ms.kind != ERR) {
+                    sym = load.apply(ms, name);
+                }
+            }
+
+            if (sym == null)
+                continue;
+
+            if (validate.test(sym)) {
+                return new InvisibleSymbolError(env, suppressError, sym);
+            }
+        }
+
+        return defaultResult;
+    }
+
     /**
      * Find a type declared in a scope (not inherited).  Return null
      * if none is found.
@@ -2211,7 +2300,7 @@
         }
 
         if (kind.contains(KindSelector.PCK))
-            return syms.lookupPackage(env.toplevel.modle, name);
+            return lookupPackage(env, name);
         else return bestSoFar;
     }
 
@@ -2225,11 +2314,6 @@
                               Name name, KindSelector kind) {
         Name fullname = TypeSymbol.formFullName(name, pck);
         Symbol bestSoFar = typeNotFound;
-        PackageSymbol pack = null;
-        if (kind.contains(KindSelector.PCK)) {
-            pack = syms.lookupPackage(env.toplevel.modle, fullname);
-            if (pack.exists()) return pack;
-        }
         if (kind.contains(KindSelector.TYP)) {
             Symbol sym = loadClass(env, fullname);
             if (sym.exists()) {
@@ -2238,7 +2322,10 @@
             }
             else bestSoFar = bestOf(bestSoFar, sym);
         }
-        return (pack != null) ? pack : bestSoFar;
+        if (kind.contains(KindSelector.PCK)) {
+            return lookupPackage(env, fullname);
+        }
+        return bestSoFar;
     }
 
     /** Find an identifier among the members of a given type `site'.
@@ -3947,10 +4034,6 @@
         private Env<AttrContext> env;
         private Type site;
 
-        AccessError(Symbol sym) {
-            this(null, null, sym);
-        }
-
         AccessError(Env<AttrContext> env, Type site, Symbol sym) {
             super(HIDDEN, sym, "access error");
             this.env = env;
@@ -3983,7 +4066,14 @@
                 if (sym.owner.kind == PCK) {
                     return diags.create(dkind, log.currentSource(),
                             pos, "not.def.access.package.cant.access",
-                        sym, sym.location());
+                        sym, sym.location(), inaccessiblePackageReason(env, sym.packge()));
+                } else if (   sym.packge() != syms.rootPackage
+                           && sym.packge().modle != env.toplevel.modle
+                           && !isAccessible(env, sym.outermostClass())) {
+                    return diags.create(dkind, log.currentSource(),
+                            pos, "not.def.access.class.intf.cant.access.reason",
+                            sym, sym.location(), sym.location().packge(),
+                            inaccessiblePackageReason(env, sym.packge()));
                 } else {
                     return diags.create(dkind, log.currentSource(),
                             pos, "not.def.access.class.intf.cant.access",
@@ -4015,6 +4105,90 @@
         }
     }
 
+    class InvisibleSymbolError extends InvalidSymbolError {
+
+        private final Env<AttrContext> env;
+        private final boolean suppressError;
+
+        InvisibleSymbolError(Env<AttrContext> env, boolean suppressError, Symbol sym) {
+            super(HIDDEN, sym, "invisible class error");
+            this.env = env;
+            this.suppressError = suppressError;
+            this.name = sym.name;
+        }
+
+        @Override
+        JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
+                DiagnosticPosition pos,
+                Symbol location,
+                Type site,
+                Name name,
+                List<Type> argtypes,
+                List<Type> typeargtypes) {
+            if (suppressError)
+                return null;
+
+            if (sym.kind == PCK) {
+                JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
+                return diags.create(dkind, log.currentSource(),
+                        pos, "package.not.visible", sym, details);
+            }
+
+            JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
+
+            if (pos.getTree() != null && pos.getTree().hasTag(SELECT) && sym.owner.kind == PCK) {
+                pos = ((JCFieldAccess) pos.getTree()).selected.pos();
+
+                return diags.create(dkind, log.currentSource(),
+                        pos, "package.not.visible", sym.packge(), details);
+            }
+
+            return diags.create(dkind, log.currentSource(),
+                    pos, "not.def.access.package.cant.access", sym, sym.packge(), details);
+        }
+    }
+
+    JCDiagnostic inaccessiblePackageReason(Env<AttrContext> env, PackageSymbol sym) {
+        //no dependency:
+        if (!env.toplevel.modle.readModules.contains(sym.modle)) {
+            //does not read:
+            if (sym.modle != syms.unnamedModule) {
+                if (env.toplevel.modle != syms.unnamedModule) {
+                    return diags.fragment(Fragments.NotDefAccessDoesNotRead(env.toplevel.modle,
+                                                                            sym,
+                                                                            sym.modle));
+                } else {
+                    return diags.fragment(Fragments.NotDefAccessDoesNotReadFromUnnamed(sym,
+                                                                                       sym.modle));
+                }
+            } else {
+                return diags.fragment(Fragments.NotDefAccessDoesNotReadUnnamed(sym,
+                                                                               env.toplevel.modle));
+            }
+        } else {
+            if (sym.packge().modle.exports.stream().anyMatch(e -> e.packge == sym)) {
+                //not exported to this module:
+                if (env.toplevel.modle != syms.unnamedModule) {
+                    return diags.fragment(Fragments.NotDefAccessNotExportedToModule(sym,
+                                                                                    sym.modle,
+                                                                                    env.toplevel.modle));
+                } else {
+                    return diags.fragment(Fragments.NotDefAccessNotExportedToModuleFromUnnamed(sym,
+                                                                                               sym.modle));
+                }
+            } else {
+                //not exported:
+                if (env.toplevel.modle != syms.unnamedModule) {
+                    return diags.fragment(Fragments.NotDefAccessNotExported(sym,
+                                                                            sym.modle));
+                } else {
+                    return diags.fragment(Fragments.NotDefAccessNotExportedFromUnnamed(sym,
+                                                                                       sym.modle));
+                }
+            }
+        }
+    }
+
     /**
      * InvalidSymbolError error class indicating that an instance member
      * has erroneously been accessed from a static context.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Fri Jan 13 01:35:30 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -410,7 +410,9 @@
                     importNamedStatic(tree, p, name, localEnv);
                     chk.checkCanonical(imp.selected);
                 } else {
-                    TypeSymbol c = attribImportType(imp, localEnv).tsym;
+                    Type importedType = attribImportType(imp, localEnv);
+                    Type originalType = importedType.getOriginalType();
+                    TypeSymbol c = originalType.hasTag(CLASS) ? originalType.tsym : importedType.tsym;
                     chk.checkCanonical(imp);
                     importNamed(tree.pos(), c, env, tree);
                 }
@@ -938,6 +940,7 @@
          */
         void finishClass(JCClassDecl tree, Env<AttrContext> env) {
             if ((tree.mods.flags & Flags.ENUM) != 0 &&
+                !tree.sym.type.hasTag(ERROR) &&
                 (types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
                 addEnumMembers(tree, env);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Jan 13 01:35:30 2017 +0000
@@ -681,7 +681,7 @@
         if (sep == -1) {
             msym = modules.getDefaultModule();
             typeName = name;
-        } else if (source.allowModules() && !options.isSet("noModules")) {
+        } else if (source.allowModules()) {
             Name modName = names.fromString(name.substring(0, sep));
 
             msym = moduleFinder.findModule(modName);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Fri Jan 13 01:35:30 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -222,41 +222,6 @@
         }
     }
 
-    public JavacSourcePosition getSourcePosition(Element e) {
-        Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e);
-        if (treeTop == null)
-            return null;
-        JCTree tree = treeTop.fst;
-        JCCompilationUnit toplevel = treeTop.snd;
-        JavaFileObject sourcefile = toplevel.sourcefile;
-        if (sourcefile == null)
-            return null;
-        return new JavacSourcePosition(sourcefile, tree.pos, toplevel.lineMap);
-    }
-
-    public JavacSourcePosition getSourcePosition(Element e, AnnotationMirror a) {
-        Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e);
-        if (treeTop == null)
-            return null;
-        JCTree tree = treeTop.fst;
-        JCCompilationUnit toplevel = treeTop.snd;
-        JavaFileObject sourcefile = toplevel.sourcefile;
-        if (sourcefile == null)
-            return null;
-
-        JCTree annoTree = matchAnnoToTree(a, e, tree);
-        if (annoTree == null)
-            return null;
-        return new JavacSourcePosition(sourcefile, annoTree.pos,
-                                       toplevel.lineMap);
-    }
-
-    public JavacSourcePosition getSourcePosition(Element e, AnnotationMirror a,
-                                            AnnotationValue v) {
-        // TODO: better accuracy in getSourcePosition(... AnnotationValue)
-        return getSourcePosition(e, a);
-    }
-
     /**
      * Returns the tree for an annotation given the annotated element
      * and the element's own tree.  Returns null if the tree cannot be found.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacSourcePosition.java	Thu Jan 12 23:41:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * 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.javac.model;
-
-import javax.tools.JavaFileObject;
-import com.sun.tools.javac.util.Position;
-
-/**
- * Implementation of model API SourcePosition based on javac internal state.
- *
- * <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></p>
- */
-class JavacSourcePosition {
-
-    final JavaFileObject sourcefile;
-    final int pos;
-    final Position.LineMap lineMap;
-
-    JavacSourcePosition(JavaFileObject sourcefile,
-                        int pos,
-                        Position.LineMap lineMap) {
-        this.sourcefile = sourcefile;
-        this.pos = pos;
-        this.lineMap = (pos != Position.NOPOS) ? lineMap : null;
-    }
-
-    public JavaFileObject getFile() {
-        return sourcefile;
-    }
-
-    public int getOffset() {
-        return pos;     // makes use of fact that Position.NOPOS == -1
-    }
-
-    public int getLine() {
-        return (lineMap != null) ? lineMap.getLineNumber(pos) : -1;
-    }
-
-    public int getColumn() {
-        return (lineMap != null) ? lineMap.getColumnNumber(pos) : -1;
-    }
-
-    public String toString() {
-        int line = getLine();
-        return (line > 0)
-              ? sourcefile + ":" + line
-              : sourcefile.toString();
-    }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Jan 13 01:35:30 2017 +0000
@@ -230,7 +230,7 @@
         chk = Check.instance(context);
         initProcessorLoader();
 
-        allowModules = source.allowModules() && options.isUnset("noModules");
+        allowModules = source.allowModules();
     }
 
     public void setProcessors(Iterable<? extends Processor> processors) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jan 13 01:35:30 2017 +0000
@@ -823,17 +823,87 @@
 compiler.err.not.annotation.type=\
     {0} is not an annotation type
 
+# 0: symbol, 1: symbol, 2: message segment
+compiler.err.not.def.access.package.cant.access=\
+    {0} is not visible\n\
+    ({2})
+
+# 0: symbol, 1: symbol, 2: message segment
+compiler.misc.not.def.access.package.cant.access=\
+    {0} is not visible\n\
+    ({2})
+
+# 0: symbol, 1: message segment
+compiler.err.package.not.visible=\
+    package {0} is not visible\n\
+    ({1})
+
+# 0: symbol, 1: message segment
+compiler.misc.package.not.visible=\
+    package {0} is not visible\n\
+    ({1})
+
+# {0} - current module
+# {1} - package in which the invisible class is declared
+# {2} - module in which {1} is declared
+# 0: symbol, 1: symbol, 2: symbol
+compiler.misc.not.def.access.does.not.read=\
+    package {1} is declared in module {2}, but module {0} does not read it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
 # 0: symbol, 1: symbol
-compiler.err.not.def.access.package.cant.access=\
-    {0} is not visible because package {1} is not visible
+compiler.misc.not.def.access.does.not.read.from.unnamed=\
+    package {0} is declared in module {1}, which is not in the module graph
+
+# {0} - package in which the invisible class is declared
+# {1} - current module
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.does.not.read.unnamed=\
+    package {0} is declared in the unnamed module, but module {0} does not read it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.not.exported=\
+    package {0} is declared in module {1}, which does not export it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.not.exported.from.unnamed=\
+    package {0} is declared in module {1}, which does not export it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# {2} - current module
+# 0: symbol, 1: symbol, 2: symbol
+compiler.misc.not.def.access.not.exported.to.module=\
+    package {0} is declared in module {1}, which does not export it to module {2}
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.not.exported.to.module.from.unnamed=\
+    package {0} is declared in module {1}, which does not export it to the unnamed module
 
 # 0: symbol, 1: symbol
 compiler.err.not.def.access.class.intf.cant.access=\
-    {0} in {1} is defined in an inaccessible class or interface
+    {1}.{0} is defined in an inaccessible class or interface
 
 # 0: symbol, 1: symbol
 compiler.misc.not.def.access.class.intf.cant.access=\
-    {0} in {1} is defined in an inaccessible class or interface
+    {1}.{0} is defined in an inaccessible class or interface
+
+# 0: symbol, 1: symbol, 2: symbol, 3: message segment
+compiler.err.not.def.access.class.intf.cant.access.reason=\
+    {1}.{0} in package {2} is not accessible\n\
+    ({3})
+
+# 0: symbol, 1: symbol, 2: symbol, 3: message segment
+compiler.misc.not.def.access.class.intf.cant.access.reason=\
+    {1}.{0} in package {2} is not accessible\n\
+    ({3})
 
 # 0: symbol, 1: list of type, 2: type
 compiler.misc.cant.access.inner.cls.constr=\
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java	Fri Jan 13 01:35:30 2017 +0000
@@ -68,6 +68,11 @@
      */
     public static final int DBG_EVNT = 0b0010000;
 
+    /**
+     * Event debugging.
+     */
+    public static final int DBG_WRAP = 0b0100000;
+
     private static Map<JShell, Integer> debugMap = null;
 
     /**
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Fri Jan 13 01:35:30 2017 +0000
@@ -119,6 +119,7 @@
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_FMGR;
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
+import static jdk.internal.jshell.debug.InternalDebugControl.DBG_WRAP;
 import static jdk.internal.jshell.tool.ContinuousCompletionProvider.STARTSWITH_MATCHER;
 
 /**
@@ -217,7 +218,7 @@
 
     static final String DEFAULT_STARTUP_NAME = "DEFAULT";
     static final Pattern BUILTIN_FILE_PATTERN = Pattern.compile("\\w+");
-    static final String BUILTIN_FILE_PATH_FORMAT = "jrt:/jdk.jshell/jdk/jshell/tool/resources/%s.jsh";
+    static final String BUILTIN_FILE_PATH_FORMAT = "/jdk/jshell/tool/resources/%s.jsh";
 
     // match anything followed by whitespace
     private static final Pattern OPTION_PRE_PATTERN =
@@ -1919,9 +1920,13 @@
                         flags |= DBG_EVNT;
                         fluff("Event debugging on");
                         break;
+                    case 'w':
+                        flags |= DBG_WRAP;
+                        fluff("Wrap debugging on");
+                        break;
                     default:
                         hard("Unknown debugging option: %c", ch);
-                        fluff("Use: 0 r g f c d");
+                        fluff("Use: 0 r g f c d e w");
                         return false;
                 }
             }
@@ -2421,9 +2426,11 @@
     String readResource(String name) throws IOException {
         // Attempt to find the file as a resource
         String spec = String.format(BUILTIN_FILE_PATH_FORMAT, name);
-        URL url = new URL(spec);
-        BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
-        return reader.lines().collect(Collectors.joining("\n"));
+
+        try (InputStream in = JShellTool.class.getResourceAsStream(spec);
+             BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
+            return reader.lines().collect(Collectors.joining("\n"));
+        }
     }
 
     // retrieve the default startup string
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java	Fri Jan 13 01:35:30 2017 +0000
@@ -66,7 +66,7 @@
                     if ((read = input.read()) == (-1)) {
                         break;
                     }
-                    if (read == 3 && currentState == State.BUFFER) {
+                    if (read == 3 && getState() == State.BUFFER) {
                         stop.run();
                     } else {
                         write(read);
@@ -141,6 +141,10 @@
         }
     }
 
+    private synchronized State getState() {
+        return state;
+    }
+
     private synchronized State waitInputNeeded() {
         while (state == State.WAIT) {
             try {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Fri Jan 13 01:35:30 2017 +0000
@@ -49,6 +49,7 @@
 import java.io.Writer;
 import java.util.LinkedHashSet;
 import java.util.Set;
+import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo;
 import jdk.jshell.Key.ErroneousKey;
 import jdk.jshell.Key.MethodKey;
 import jdk.jshell.Key.TypeDeclKey;
@@ -58,7 +59,6 @@
 import jdk.jshell.TaskFactory.BaseTask;
 import jdk.jshell.TaskFactory.CompileTask;
 import jdk.jshell.TaskFactory.ParseTask;
-import jdk.jshell.TreeDissector.ExpressionInfo;
 import jdk.jshell.Wrap.Range;
 import jdk.jshell.Snippet.Status;
 import jdk.jshell.spi.ExecutionControl.ClassBytecodes;
@@ -296,7 +296,7 @@
 
     private List<Snippet> processExpression(String userSource, String compileSource) {
         String name = null;
-        ExpressionInfo ei = typeOfExpression(compileSource);
+        ExpressionInfo ei = ExpressionToTypeInfo.expressionInfo(compileSource, state);
         ExpressionTree assignVar;
         Wrap guts;
         Snippet snip;
@@ -499,16 +499,6 @@
         return singletonList(snip);
     }
 
-    private ExpressionInfo typeOfExpression(String expression) {
-        Wrap guts = Wrap.methodReturnWrap(expression);
-        TaskFactory.AnalyzeTask at = trialCompile(guts);
-        if (!at.hasErrors() && at.firstCuTree() != null) {
-            return TreeDissector.createByFirstClass(at)
-                    .typeOfReturnStatement(at, state);
-        }
-        return null;
-    }
-
     /**
      * Should a temp var wrap the expression. TODO make this user configurable.
      *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jshell;
+
+import com.sun.source.tree.ReturnTree;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ConditionalExpressionTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Types;
+import jdk.jshell.TaskFactory.AnalyzeTask;
+
+/**
+ * Compute information about an expression string, particularly its type name.
+ */
+class ExpressionToTypeInfo {
+
+    private static final String OBJECT_TYPE_NAME = "Object";
+
+    final AnalyzeTask at;
+    final CompilationUnitTree cu;
+    final JShell state;
+    final Symtab syms;
+    final Types types;
+
+    private ExpressionToTypeInfo(AnalyzeTask at, CompilationUnitTree cu, JShell state) {
+        this.at = at;
+        this.cu = cu;
+        this.state = state;
+        this.syms = Symtab.instance(at.context);
+        this.types = Types.instance(at.context);
+    }
+
+    public static class ExpressionInfo {
+        ExpressionTree tree;
+        String typeName;
+        boolean isNonVoid;
+    }
+
+    // return mechanism and other general structure from TreePath.getPath()
+    private static class Result extends Error {
+
+        static final long serialVersionUID = -5942088234594905629L;
+        final TreePath expressionPath;
+
+        Result(TreePath path) {
+            this.expressionPath = path;
+        }
+    }
+
+    private static class PathFinder extends TreePathScanner<TreePath, Boolean> {
+
+        // Optimize out imports etc
+        @Override
+        public TreePath visitCompilationUnit(CompilationUnitTree node, Boolean isTargetContext) {
+            return scan(node.getTypeDecls(), isTargetContext);
+        }
+
+        // Only care about members
+        @Override
+        public TreePath visitClass(ClassTree node, Boolean isTargetContext) {
+            return scan(node.getMembers(), isTargetContext);
+        }
+
+        // Only want the doit method where the code is
+        @Override
+        public TreePath visitMethod(MethodTree node, Boolean isTargetContext) {
+            if (Util.isDoIt(node.getName())) {
+                return scan(node.getBody(), true);
+            } else {
+                return null;
+            }
+        }
+
+        @Override
+        public TreePath visitReturn(ReturnTree node, Boolean isTargetContext) {
+            ExpressionTree tree = node.getExpression();
+            TreePath tp = new TreePath(getCurrentPath(), tree);
+            if (isTargetContext) {
+                throw new Result(tp);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    private Type pathToType(TreePath tp) {
+        return (Type) at.trees().getTypeMirror(tp);
+    }
+
+    private Type pathToType(TreePath tp, Tree tree) {
+        if (tree instanceof ConditionalExpressionTree) {
+            // Conditionals always wind up as Object -- this corrects
+            ConditionalExpressionTree cet = (ConditionalExpressionTree) tree;
+            Type tmt = pathToType(new TreePath(tp, cet.getTrueExpression()));
+            Type tmf = pathToType(new TreePath(tp, cet.getFalseExpression()));
+            if (!tmt.isPrimitive() && !tmf.isPrimitive()) {
+                Type lub = types.lub(tmt, tmf);
+                // System.err.printf("cond ? %s : %s  --  lub = %s\n",
+                //             varTypeName(tmt), varTypeName(tmf), varTypeName(lub));
+                return lub;
+            }
+        }
+        return pathToType(tp);
+    }
+
+    /**
+     * Entry method: get expression info
+     * @param code the expression as a string
+     * @param state a JShell instance
+     * @return type information
+     */
+    public static ExpressionInfo expressionInfo(String code, JShell state) {
+        if (code == null || code.isEmpty()) {
+            return null;
+        }
+        try {
+            OuterWrap codeWrap = state.outerMap.wrapInTrialClass(Wrap.methodReturnWrap(code));
+            AnalyzeTask at = state.taskFactory.new AnalyzeTask(codeWrap);
+            CompilationUnitTree cu = at.firstCuTree();
+            if (at.hasErrors() || cu == null) {
+                return null;
+            }
+            return new ExpressionToTypeInfo(at, cu, state).typeOfExpression();
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+
+    private ExpressionInfo typeOfExpression() {
+        return treeToInfo(findExpressionPath());
+    }
+
+    private TreePath findExpressionPath() {
+        try {
+            new PathFinder().scan(new TreePath(cu), false);
+        } catch (Result result) {
+            return result.expressionPath;
+        }
+        return null;
+    }
+
+    private ExpressionInfo treeToInfo(TreePath tp) {
+        if (tp != null) {
+            Tree tree = tp.getLeaf();
+            if (tree instanceof ExpressionTree) {
+                ExpressionInfo ei = new ExpressionInfo();
+                ei.tree = (ExpressionTree) tree;
+                Type type = pathToType(tp, tree);
+                if (type != null) {
+                    switch (type.getKind()) {
+                        case VOID:
+                        case NONE:
+                        case ERROR:
+                        case OTHER:
+                            break;
+                        case NULL:
+                            ei.isNonVoid = true;
+                            ei.typeName = OBJECT_TYPE_NAME;
+                            break;
+                        default: {
+                            ei.isNonVoid = true;
+                            ei.typeName = varTypeName(type);
+                            if (ei.typeName == null) {
+                                ei.typeName = OBJECT_TYPE_NAME;
+                            }
+                            break;
+                        }
+                    }
+                }
+                return ei;
+            }
+        }
+        return null;
+    }
+
+    private String varTypeName(Type type) {
+        try {
+            TypePrinter tp = new VarTypePrinter(at.messages(),
+                    state.maps::fullClassNameAndPackageToClass, syms, types);
+            return tp.toString(type);
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+
+}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Fri Jan 13 01:35:30 2017 +0000
@@ -105,7 +105,6 @@
 import java.util.stream.Collectors;
 
 import static java.util.stream.Collectors.collectingAndThen;
-import static java.util.stream.Collectors.joining;
 import static java.util.stream.Collectors.toCollection;
 import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toSet;
@@ -128,6 +127,7 @@
 import javax.tools.JavaFileManager.Location;
 import javax.tools.StandardLocation;
 
+import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo;
 import static jdk.jshell.Util.REPL_DOESNOTMATTER_CLASS_NAME;
 import static jdk.jshell.SourceCodeAnalysis.Completeness.DEFINITELY_INCOMPLETE;
 import static jdk.jshell.TreeDissector.printType;
@@ -1430,47 +1430,17 @@
 
     @Override
     public String analyzeType(String code, int cursor) {
-        code = code.substring(0, cursor);
-        CompletionInfo completionInfo = analyzeCompletion(code);
-        if (!completionInfo.completeness().isComplete())
-            return null;
-        if (completionInfo.completeness() == Completeness.COMPLETE_WITH_SEMI) {
-            code += ";";
-        }
-
-        OuterWrap codeWrap;
         switch (guessKind(code)) {
             case IMPORT: case METHOD: case CLASS: case ENUM:
             case INTERFACE: case ANNOTATION_TYPE: case VARIABLE:
                 return null;
             default:
-                codeWrap = proc.outerMap.wrapInTrialClass(Wrap.methodWrap(code));
                 break;
         }
-        AnalyzeTask at = proc.taskFactory.new AnalyzeTask(codeWrap);
-        SourcePositions sp = at.trees().getSourcePositions();
-        CompilationUnitTree topLevel = at.firstCuTree();
-        int pos = codeWrap.snippetIndexToWrapIndex(code.length());
-        TreePath tp = pathFor(topLevel, sp, pos);
-        while (ExpressionTree.class.isAssignableFrom(tp.getParentPath().getLeaf().getKind().asInterface()) &&
-               tp.getParentPath().getLeaf().getKind() != Kind.ERRONEOUS &&
-               tp.getParentPath().getParentPath() != null)
-            tp = tp.getParentPath();
-        TypeMirror type = at.trees().getTypeMirror(tp);
-
-        if (type == null)
-            return null;
-
-        switch (type.getKind()) {
-            case ERROR: case NONE: case OTHER:
-            case PACKAGE: case VOID:
-                return null; //not usable
-            case NULL:
-                type = at.getElements().getTypeElement("java.lang.Object").asType();
-                break;
-        }
-
-        return TreeDissector.printType(at, proc, type);
+        ExpressionInfo ei = ExpressionToTypeInfo.expressionInfo(code, proc);
+        return (ei == null || !ei.isNonVoid)
+                ? null
+                : ei.typeName;
     }
 
     @Override
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Fri Jan 13 01:35:30 2017 +0000
@@ -321,7 +321,7 @@
         final JavacTaskImpl task;
         private DiagList diags = null;
         private final SourceHandler<?> sourceHandler;
-        private final Context context = new Context();
+        final Context context = new Context();
         private Types types;
         private JavacMessages messages;
         private Trees trees;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java	Fri Jan 13 01:35:30 2017 +0000
@@ -28,14 +28,11 @@
 
 import com.sun.source.tree.ClassTree;
 import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.tree.ExpressionTree;
 import com.sun.source.tree.MethodTree;
-import com.sun.source.tree.ReturnTree;
 import com.sun.source.tree.StatementTree;
 import com.sun.source.tree.Tree;
 import com.sun.source.tree.VariableTree;
 import com.sun.source.util.SourcePositions;
-import com.sun.source.util.TreePath;
 import com.sun.source.util.Trees;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.MethodType;
@@ -47,7 +44,6 @@
 import jdk.jshell.Wrap.Range;
 
 import java.util.List;
-import java.util.Locale;
 
 import java.util.function.Predicate;
 import java.util.stream.Stream;
@@ -61,16 +57,6 @@
 
 class TreeDissector {
 
-    private static final String OBJECT_TYPE = "Object";
-
-    static class ExpressionInfo {
-
-        boolean isNonVoid;
-        String typeName;
-        ExpressionTree tree;
-        String signature;
-    }
-
     private final TaskFactory.BaseTask bt;
     private final ClassTree targetClass;
     private final CompilationUnitTree targetCompilationUnit;
@@ -219,41 +205,6 @@
         return null;
     }
 
-
-    ExpressionInfo typeOfReturnStatement(AnalyzeTask at, JShell state) {
-        ExpressionInfo ei = new ExpressionInfo();
-        Tree unitTree = firstStatement();
-        if (unitTree instanceof ReturnTree) {
-            ei.tree = ((ReturnTree) unitTree).getExpression();
-            if (ei.tree != null) {
-                TreePath viPath = trees().getPath(targetCompilationUnit, ei.tree);
-                if (viPath != null) {
-                    TypeMirror tm = trees().getTypeMirror(viPath);
-                    if (tm != null) {
-                        ei.typeName = printType(at, state, tm);
-                        switch (tm.getKind()) {
-                            case VOID:
-                            case NONE:
-                            case ERROR:
-                            case OTHER:
-                                break;
-                            case NULL:
-                                ei.isNonVoid = true;
-                                ei.typeName = OBJECT_TYPE;
-                                break;
-                            default: {
-                                ei.isNonVoid = true;
-                                break;
-
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return ei;
-    }
-
     String typeOfMethod(MethodSnippet msn) {
         Tree unitTree = method(msn);
         if (unitTree instanceof JCMethodDecl) {
@@ -274,8 +225,13 @@
 
     public static String printType(AnalyzeTask at, JShell state, TypeMirror type) {
         Type typeImpl = (Type) type;
-        TypePrinter tp = new TypePrinter(at.messages(), state.maps::fullClassNameAndPackageToClass, typeImpl);
-        return tp.visit(typeImpl, Locale.getDefault());
+        try {
+            TypePrinter tp = new TypePrinter(at.messages(),
+                    state.maps::fullClassNameAndPackageToClass);
+            return tp.toString(typeImpl);
+        } catch (Exception ex) {
+            return null;
+        }
     }
 
     /**
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java	Fri Jan 13 01:35:30 2017 +0000
@@ -22,7 +22,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package jdk.jshell;
 
 import static com.sun.tools.javac.code.Flags.COMPOUND;
@@ -41,17 +40,21 @@
  * Print types in source form.
  */
 class TypePrinter extends Printer {
+
     private static final String OBJECT = "Object";
 
     private final JavacMessages messages;
     private final BinaryOperator<String> fullClassNameAndPackageToClass;
-    private boolean useWildCard = false;
 
-    TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass, Type typeToPrint) {
+    TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass) {
         this.messages = messages;
         this.fullClassNameAndPackageToClass = fullClassNameAndPackageToClass;
     }
 
+    String toString(Type t) {
+        return visit(t, Locale.getDefault());
+    }
+
     @Override
     protected String localize(Locale locale, String key, Object... args) {
         return messages.getLocalizedString(locale, key, args);
@@ -68,18 +71,6 @@
     }
 
     @Override
-    public String visitWildcardType(Type.WildcardType wt, Locale locale) {
-        if (useWildCard) { // at TypeArgument(ex: List<? extends T>)
-            return super.visitWildcardType(wt, locale);
-        } else { // at TopLevelType(ex: ? extends List<T>, ? extends Number[][])
-            Type extendsBound = wt.getExtendsBound();
-            return extendsBound == null
-                    ? OBJECT
-                    : visit(extendsBound, locale);
-        }
-    }
-
-    @Override
     public String visitType(Type t, Locale locale) {
         String s = (t.tsym == null || t.tsym.name == null)
                 ? OBJECT // none
@@ -87,20 +78,9 @@
         return s;
     }
 
-    @Override
-    public String visitClassType(ClassType ct, Locale locale) {
-        boolean prevUseWildCard = useWildCard;
-        try {
-            useWildCard = true;
-            return super.visitClassType(ct, locale);
-        } finally {
-            useWildCard = prevUseWildCard;
-        }
-    }
-
     /**
-     * Converts a class name into a (possibly localized) string. Anonymous
-     * inner classes get converted into a localized string.
+     * Converts a class name into a (possibly localized) string. Anonymous inner
+     * classes get converted into a localized string.
      *
      * @param t the type of the class whose name is to be rendered
      * @param longform if set, the class' fullname is displayed - if unset the
@@ -112,21 +92,13 @@
     protected String className(ClassType t, boolean longform, Locale locale) {
         Symbol sym = t.tsym;
         if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
-            /***
-            StringBuilder s = new StringBuilder(visit(t.supertype_field, locale));
-            for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) {
-                s.append('&');
-                s.append(visit(is.head, locale));
-            }
-            return s.toString();
-            ***/
             return OBJECT;
         } else if (sym.name.length() == 0) {
             // Anonymous
             String s;
             ClassType norm = (ClassType) t.tsym.type;
             if (norm == null) {
-                s = "object";
+                s = OBJECT;
             } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
                 s = visit(norm.interfaces_field.head, locale);
             } else {
@@ -160,7 +132,7 @@
     @Override
     public String visitPackageSymbol(PackageSymbol s, Locale locale) {
         return s.isUnnamed()
-                ? ""   // Unnamed package
+                ? "" // Unnamed package
                 : s.fullname.toString();
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java	Fri Jan 13 01:35:30 2017 +0000
@@ -46,6 +46,7 @@
 import static java.util.stream.Collectors.toSet;
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
+import static jdk.internal.jshell.debug.InternalDebugControl.DBG_WRAP;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
 import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED;
 import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
@@ -180,6 +181,8 @@
                     .collect(toList());
             // Set the outer wrap for this snippet
             si.setOuterWrap(state.outerMap.wrapInClass(except, plus, snippets, wraps));
+            state.debug(DBG_WRAP, "++setWrap() %s\n%s\n",
+                    si, si.outerWrap().wrapped());
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jshell;
+
+import java.util.HashSet;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.util.JavacMessages;
+import java.util.Locale;
+import java.util.Set;
+import java.util.function.BinaryOperator;
+import com.sun.tools.javac.code.BoundKind;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type.CapturedType;
+import com.sun.tools.javac.code.Type.TypeMapping;
+import com.sun.tools.javac.code.Type.TypeVar;
+import com.sun.tools.javac.code.Type.WildcardType;
+import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.code.Types.SimpleVisitor;
+import com.sun.tools.javac.util.List;
+import static com.sun.tools.javac.code.BoundKind.EXTENDS;
+import static com.sun.tools.javac.code.BoundKind.SUPER;
+import static com.sun.tools.javac.code.BoundKind.UNBOUND;
+import static com.sun.tools.javac.code.Type.ArrayType;
+import static com.sun.tools.javac.code.TypeTag.BOT;
+import static com.sun.tools.javac.code.TypeTag.WILDCARD;
+
+/**
+ * Print variable types in source form.
+ * TypeProjection and CaptureScanner are copied from Types in the JEP-286
+ * Sandbox by Maurizio.  The checks for Non-Denotable in TypePrinter are
+ * cribbed from denotableChecker of the same source.
+ *
+ * @author Maurizio Cimadamore
+ * @author Robert Field
+ */
+class VarTypePrinter extends TypePrinter {
+    private static final String WILD = "?";
+
+    private final Symtab syms;
+    private final Types types;
+
+    VarTypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass,
+            Symtab syms, Types types) {
+        super(messages, fullClassNameAndPackageToClass);
+        this.syms = syms;
+        this.types = types;
+    }
+
+    @Override
+    String toString(Type t) {
+        return super.toString(upward(t));
+    }
+
+    @Override
+    public String visitTypeVar(TypeVar t, Locale locale) {
+        /* Any type variable mentioned in the inferred type must have been declared as a type parameter
+                  (i.e cannot have been produced by inference (18.4))
+         */
+        // and beyond that, there are no global type vars, so if there are any
+        // type variables left, they need to be eliminated
+        return WILD; // Non-denotable
+    }
+
+    @Override
+    public String visitCapturedType(CapturedType t, Locale locale) {
+        /* Any type variable mentioned in the inferred type must have been declared as a type parameter
+                  (i.e cannot have been produced by capture conversion (5.1.10))
+         */
+        return WILD; // Non-denotable
+    }
+
+    public Type upward(Type t) {
+        List<Type> captures = captures(t);
+        return upward(t, captures);
+    }
+
+    /************* Following from JEP-286 Types.java ***********/
+
+    public Type upward(Type t, List<Type> vars) {
+        return t.map(new TypeProjection(vars), true);
+    }
+
+    public List<Type> captures(Type t) {
+        CaptureScanner cs = new CaptureScanner();
+        Set<Type> captures = new HashSet<>();
+        cs.visit(t, captures);
+        return List.from(captures);
+    }
+
+    class CaptureScanner extends SimpleVisitor<Void, Set<Type>> {
+
+        @Override
+        public Void visitType(Type t, Set<Type> types) {
+            return null;
+        }
+
+        @Override
+        public Void visitClassType(ClassType t, Set<Type> seen) {
+            if (t.isCompound()) {
+                types.directSupertypes(t).forEach(s -> visit(s, seen));
+            } else {
+                t.allparams().forEach(ta -> visit(ta, seen));
+            }
+            return null;
+        }
+
+        @Override
+        public Void visitArrayType(ArrayType t, Set<Type> seen) {
+            return visit(t.elemtype, seen);
+        }
+
+        @Override
+        public Void visitWildcardType(WildcardType t, Set<Type> seen) {
+            visit(t.type, seen);
+            return null;
+        }
+
+        @Override
+        public Void visitTypeVar(TypeVar t, Set<Type> seen) {
+            if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
+                visit(t.getUpperBound(), seen);
+            }
+            return null;
+        }
+
+        @Override
+        public Void visitCapturedType(CapturedType t, Set<Type> seen) {
+            if (seen.add(t)) {
+                visit(t.getUpperBound(), seen);
+                visit(t.getLowerBound(), seen);
+            }
+            return null;
+        }
+    }
+
+    class TypeProjection extends TypeMapping<Boolean> {
+
+        List<Type> vars;
+        Set<Type> seen = new HashSet<>();
+
+        public TypeProjection(List<Type> vars) {
+            this.vars = vars;
+        }
+
+        @Override
+        public Type visitClassType(ClassType t, Boolean upward) {
+            if (upward && !t.isCompound() && t.tsym.name.isEmpty()) {
+                //lift anonymous class type to first supertype (class or interface)
+                return types.directSupertypes(t).last();
+            } else if (t.isCompound()) {
+                List<Type> components = types.directSupertypes(t);
+                List<Type> components1 = components.map(c -> c.map(this, upward));
+                if (components == components1) return t;
+                else return types.makeIntersectionType(components1);
+            } else {
+                Type outer = t.getEnclosingType();
+                Type outer1 = visit(outer, upward);
+                List<Type> typarams = t.getTypeArguments();
+                List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, upward));
+                if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
+                    //not defined
+                    return syms.botType;
+                }
+                if (outer1 == outer && typarams1 == typarams) return t;
+                else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
+                    @Override
+                    protected boolean needsStripping() {
+                        return true;
+                    }
+                };
+            }
+        }
+
+        protected Type makeWildcard(Type upper, Type lower) {
+            BoundKind bk;
+            Type bound;
+            if (upper.hasTag(BOT)) {
+                upper = syms.objectType;
+            }
+            boolean isUpperObject = types.isSameType(upper, syms.objectType);
+            if (!lower.hasTag(BOT) && isUpperObject) {
+                bound = lower;
+                bk = SUPER;
+            } else {
+                bound = upper;
+                bk = isUpperObject ? UNBOUND : EXTENDS;
+            }
+            return new WildcardType(bound, bk, syms.boundClass);
+        }
+
+        @Override
+        public Type visitTypeVar(TypeVar t, Boolean upward) {
+            if (vars.contains(t)) {
+                try {
+                    if (seen.add(t)) {
+                        return (upward ?
+                                t.getUpperBound() :
+                                (t.getLowerBound() == null) ?
+                                        syms.botType :
+                                        t.getLowerBound())
+                                    .map(this, upward);
+                    } else {
+                        //cycle
+                        return syms.objectType;
+                    }
+                } finally {
+                    seen.remove(t);
+                }
+            } else {
+                return t;
+            }
+        }
+
+        @Override
+        public Type visitWildcardType(WildcardType wt, Boolean upward) {
+            if (upward) {
+                return wt.isExtendsBound() ?
+                        wt.type.map(this, upward) :
+                        syms.objectType;
+            } else {
+                return wt.isSuperBound() ?
+                        wt.type.map(this, upward) :
+                        syms.botType;
+            }
+        }
+
+        private Type mapTypeArgument(Type t, boolean upward) {
+            if (!t.containsAny(vars)) {
+                return t;
+            } else if (!t.hasTag(WILDCARD) && !upward) {
+                //not defined
+                return syms.botType;
+            } else {
+                Type upper = t.map(this, upward);
+                Type lower = t.map(this, !upward);
+                return makeWildcard(upper, lower);
+            }
+        }
+    }
+}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java	Fri Jan 13 01:35:30 2017 +0000
@@ -115,12 +115,6 @@
     }
 
     @Override
-    public void setClasspath(String path)
-            throws EngineTerminationException, InternalException {
-        throw new NotImplementedException("setClasspath: Not supported yet.");
-    }
-
-    @Override
     public Class<?> findClass(String name) throws ClassNotFoundException {
         Class<?> klass = klasses.get(name);
         if (klass == null) {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java	Fri Jan 13 01:35:30 2017 +0000
@@ -131,12 +131,6 @@
         loaderDelegate.addToClasspath(cp);
     }
 
-    @Override
-    public void setClasspath(String path)
-            throws EngineTerminationException, InternalException {
-        loaderDelegate.setClasspath(path);
-    }
-
     /**
      * {@inheritDoc}
      * <p>
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/ExecutionControlForwarder.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/ExecutionControlForwarder.java	Fri Jan 13 01:35:30 2017 +0000
@@ -147,12 +147,6 @@
                     ec.addToClasspath(cp);
                     return writeSuccess();
                 }
-                case CMD_SET_CLASSPATH: {
-                    // Set the claspath
-                    String cp = in.readUTF();
-                    ec.setClasspath(cp);
-                    return writeSuccess();
-                }
                 case CMD_STOP: {
                     // Stop the current execution
                     try {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java	Fri Jan 13 01:35:30 2017 +0000
@@ -60,16 +60,6 @@
             throws EngineTerminationException, InternalException;
 
     /**
-     * Sets the execution class path to the specified path.
-     *
-     * @param path the path to add
-     * @throws EngineTerminationException the execution engine has terminated
-     * @throws InternalException an internal problem occurred
-     */
-    void setClasspath(String path)
-            throws EngineTerminationException, InternalException;
-
-    /**
      * Finds the class with the specified binary name.
      *
      * @param name the binary name of the class
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteCodes.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteCodes.java	Fri Jan 13 01:35:30 2017 +0000
@@ -66,10 +66,6 @@
      */
     static final String CMD_ADD_CLASSPATH  = "CMD_ADD_CLASSPATH";
     /**
-     * Set the class-path.
-     */
-    static final String CMD_SET_CLASSPATH  = "CMD_SET_CLASSPATH";
-    /**
      * Stop an invoke.
      */
     static final String CMD_STOP           = "CMD_STOP";
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/StreamingExecutionControl.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/StreamingExecutionControl.java	Fri Jan 13 01:35:30 2017 +0000
@@ -137,21 +137,6 @@
     }
 
     @Override
-    public void setClasspath(String path)
-            throws EngineTerminationException, InternalException {
-        try {
-            // Send the classpath addition command to the remote agent.
-            writeCommand(CMD_SET_CLASSPATH);
-            out.writeUTF(path);
-            out.flush();
-            // Retrieve and report results from the remote agent.
-            readAndReportClassSimpleResult();
-        } catch (IOException ex) {
-            throw new EngineTerminationException("Exception writing remote set classpath: " + ex);
-        }
-    }
-
-    @Override
     public void stop()
             throws EngineTerminationException, InternalException {
         try {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java	Fri Jan 13 01:35:30 2017 +0000
@@ -118,16 +118,6 @@
             throws EngineTerminationException, InternalException;
 
     /**
-     * Sets the execution class path to the specified path.
-     *
-     * @param path the path to add
-     * @throws EngineTerminationException the execution engine has terminated
-     * @throws InternalException an internal problem occurred
-     */
-    void setClasspath(String path)
-            throws EngineTerminationException, InternalException;
-
-    /**
      * Interrupts a running invoke.
      *
      * @throws EngineTerminationException the execution engine has terminated
--- a/langtools/test/jdk/jshell/KullaTesting.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/jdk/jshell/KullaTesting.java	Fri Jan 13 01:35:30 2017 +0000
@@ -99,7 +99,6 @@
 
     private Map<String, Snippet> idToSnippet = new LinkedHashMap<>();
     private Set<Snippet> allSnippets = new LinkedHashSet<>();
-    private List<String> classpath;
 
     static {
         JShell js = JShell.create();
@@ -159,7 +158,6 @@
     }
 
     public void addToClasspath(String path) {
-        classpath.add(path);
         getState().addToClasspath(path);
     }
 
@@ -200,7 +198,6 @@
         state = builder.build();
         allSnippets = new LinkedHashSet<>();
         idToSnippet = new LinkedHashMap<>();
-        classpath = new ArrayList<>();
     }
 
     @AfterMethod
@@ -210,7 +207,6 @@
         analysis = null;
         allSnippets = null;
         idToSnippet = null;
-        classpath = null;
     }
 
     public ClassLoader createAndRunFromModule(String moduleName, Path modPath) {
--- a/langtools/test/jdk/jshell/StopExecutionTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/jdk/jshell/StopExecutionTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8171385
  * @summary Test JShell#stop
  * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream
@@ -30,9 +31,13 @@
  */
 
 import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.function.Consumer;
 
 import jdk.internal.jshell.tool.StopDetectingInputStream;
 import jdk.internal.jshell.tool.StopDetectingInputStream.State;
@@ -128,4 +133,31 @@
         }
     }
 
+    public void testStopDetectingInputBufferWaitStop() throws Exception {
+        Runnable shouldNotHappenRun =
+                () -> { throw new AssertionError("Should not happen."); };
+        Consumer<Exception> shouldNotHappenExc =
+                exc -> { throw new AssertionError("Should not happen.", exc); };
+        StopDetectingInputStream sd = new StopDetectingInputStream(shouldNotHappenRun, shouldNotHappenExc);
+        CountDownLatch reading = new CountDownLatch(1);
+        PipedInputStream is = new PipedInputStream() {
+            @Override
+            public int read() throws IOException {
+                reading.countDown();
+                return super.read();
+            }
+        };
+        PipedOutputStream os = new PipedOutputStream(is);
+
+        sd.setInputStream(is);
+        sd.setState(State.BUFFER);
+        reading.await();
+        sd.setState(State.WAIT);
+        os.write(3);
+        int value = sd.read();
+
+        if (value != 3) {
+            throw new AssertionError();
+        }
+    }
 }
--- a/langtools/test/jdk/jshell/TypeNameTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/jdk/jshell/TypeNameTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -23,81 +23,229 @@
 
 /*
  * @test
- * @bug 8144903
+ * @bug 8144903 8171981
  * @summary Tests for determining the type from the expression
  * @build KullaTesting TestingInputStream
  * @run testng TypeNameTest
  */
 
-import jdk.jshell.Snippet;
-import jdk.jshell.VarSnippet;
 import org.testng.annotations.Test;
 
-import static jdk.jshell.Snippet.Status.VALID;
 import static org.testng.Assert.assertEquals;
 
 @Test
 public class TypeNameTest extends KullaTesting {
 
-    public void testReplClassName() {
-        assertEval("class C {}");
-        VarSnippet sn = (VarSnippet) varKey(assertEval("new C();"));
-        assertEquals(sn.typeName(), "C");
+
+    private void assertType(String expr, String type) {
+        assertEquals(varKey(assertEval(expr)).typeName(), type);
+        assertInferredType(expr, type);
+    }
+
+    public void testTypeInference() {
+        assertEval("import java.util.List;");
+        assertEval("import java.util.ArrayList;");
+        assertEval("import java.util.Arrays;");
+
+        assertType("new Object().getClass().getSuperclass() ", "Class<?>");
+        assertType("new ArrayList().getClass().getSuperclass()", "Class<?>");
+        assertType("new ArrayList().getClass()", "Class<? extends ArrayList>");
+        assertType("ArrayList.class", "Class<ArrayList>");
+        assertType("ArrayList.class.getSuperclass()", "Class<? super ArrayList>");
+
+        assertEval("class D<T extends CharSequence> { D<? super T> getS() { return null; } }");
+        assertEval("D<?> d = new D<String>();");
+        assertType("d.getS()", "D<? extends CharSequence>");
+        assertType("null", "Object");
+        assertType("Class.forName( \"java.util.ArrayList\" )", "Class<?>");
+        assertType("new ArrayList<Boolean>() {}", "ArrayList<Boolean>");
+        assertType("new ArrayList<String>().stream()", "java.util.stream.Stream<String>");
+        assertType("Arrays.asList( 1, 2, 3)", "List<Integer>");
+        assertType("new ArrayList().getClass().getClass()", "Class<? extends Class>");
+
+        assertEval("interface A {}");
+        assertEval("interface I {}");
+        assertEval("interface J extends A, I {}");
+        assertEval("interface K extends A, I {}");
+        assertEval("class P<T extends A & I> {}");
+        assertType("(P<?>) null", "P<? extends Object>");
+    }
+
+    public void testConditionals() {
+        assertEval("import java.util.List;");
+        assertEval("import java.util.ArrayList;");
+        assertEval("import java.util.Arrays;");
+
+        assertEval("CharSequence cs = \"hi\";");
+        assertEval("String st = \"low\";");
+        assertEval("boolean b;");
+        assertType("b? cs : st", "CharSequence");
+
+        assertEval("List<String> l1 = Arrays.asList(\"hi\");");
+        assertEval("List<? extends String> l2 = Arrays.asList(\"po\");");
+        assertType("b? l1.get(0) : l2.get(0)", "String");
+
+        assertEval("class X {}");
+        assertEval("class B extends X {}");
+        assertEval("class C extends X {}");
+        assertType("b? new B() : new C()", "X");
+    }
+
+    public void testJEP286NonDenotable() {
+        assertEval("import java.util.List;");
+        assertEval("import java.util.Arrays;");
+        assertEval("import java.util.Iterator;");
+
+        assertEval("List<? extends String> extString() { return Arrays.asList( \"hi\", \"low\" ); }");
+        assertEval("List<? super String> supString() { return Arrays.asList( \"hi\", \"low\" ); }");
+        assertEval("List<?> unbString() { return Arrays.asList( \"hi\", \"low\" ); }");
+        assertEval("List<? extends String>[] extStringArr() {" +
+                " @SuppressWarnings(\"unchecked\") " +
+                "List<? extends String>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
+        assertEval("List<? super String>[] supStringArr() {" +
+                " @SuppressWarnings(\"unchecked\") " +
+                "List<? super String>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
+        assertEval("List<?>[] unbStringArr() {" +
+                " @SuppressWarnings(\"unchecked\") " +
+                "List<?>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
+        assertEval("Iterable<? extends List<? extends String>> extStringIter() {" +
+                "return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
+        assertEval("Iterable<? extends List<? super String>> supStringIter() {" +
+                "return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
+        assertEval("Iterable<? extends List<?>> unbStringIter() {" +
+                "return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
+        assertType("extString()", "List<? extends String>");
+        assertType("extString().get(0)", "String");
+        assertType("supString()", "List<? super String>");
+        assertType("supString().get(0)", "Object");
+        assertType("unbString()", "List<?>");
+        assertType("unbString().get(0)", "Object");
+        assertType("supStringArr()", "List<? super String>[]");
+        assertType("supStringArr()[0]", "List<? super String>");
+        assertType("supStringArr()[0].get(0)", "Object");
+        assertType("unbStringArr()", "List<?>[]");
+        assertType("unbStringArr()[0]", "List<?>");
+        assertType("unbStringArr()[0].get(0)", "Object");
+        assertType("extStringIter()", "Iterable<? extends List<? extends String>>");
+        assertType("extStringIter().iterator()", "Iterator<? extends List<? extends String>>");
+        assertType("extStringIter().iterator().next()", "List<? extends String>");
+        assertType("extStringIter().iterator().next().get(0)", "String");
+        assertType("supStringIter()", "Iterable<? extends List<? super String>>");
+        assertType("supStringIter().iterator()", "Iterator<? extends List<? super String>>");
+        assertType("supStringIter().iterator().next()", "List<? super String>");
+        assertType("supStringIter().iterator().next().get(0)", "Object");
+        assertType("unbStringIter()", "Iterable<? extends List<?>>");
+        assertType("unbStringIter().iterator()", "Iterator<? extends List<?>>");
+        assertType("unbStringIter().iterator().next()", "List<?>");
+        assertType("unbStringIter().iterator().next().get(0)", "Object");
+    }
+
+    public void testJEP286NonDenotable2() {
+        assertEval("import java.util.List;");
+        assertEval("import java.util.Arrays;");
+        assertEval("import java.lang.reflect.Array;");
+
+        assertEval("<Z extends Comparable<Z>> List<? extends Z> extFbound() {" +
+                "return Arrays.asList( (Z)null ); }");
+        assertEval("<Z extends Comparable<Z>> List<? super Z> supFbound() {" +
+                "return Arrays.asList( (Z)null ); }");
+        assertEval("<Z extends Comparable<Z>> List<? extends Z>[] extFboundArr() {" +
+                "@SuppressWarnings(\"unchecked\")" +
+                "List<? extends Z>[] a = new List[1]; a[0] = Arrays.asList( (Z)null ); return a; }");
+        assertEval("<Z extends Comparable<Z>> List<? super Z>[] supFboundArr() {" +
+                "@SuppressWarnings(\"unchecked\")" +
+                "List<? super Z>[] a = new List[1]; a[0] = Arrays.asList( (Z)null ); return a; }");
+        assertEval("<Z extends Comparable<Z>> Iterable<? extends List<? extends Z>> extFboundIter() {" +
+                "return Arrays.asList( Arrays.asList( (Z)null ) ); }");
+        assertEval("<Z extends Comparable<Z>> Iterable<? extends List<? super Z>> supFboundIter() {" +
+                "return Arrays.asList( Arrays.asList( (Z)null ) ); }");
+        assertEval("<Z> List<Z> listOf(Z z) { return Arrays.asList( z ); }");
+        assertEval("<Z> Z[] arrayOf(Z z) {" +
+                "@SuppressWarnings(\"unchecked\")" +
+                "final Z[] a = (Z[]) Array.newInstance(z.getClass(), 1); a[0] = z; return a; }");
+        assertType("extFbound()", "List<? extends Comparable<?>>");
+        assertType("extFbound().get(0)", "Comparable<?>");
+        assertType("supFbound()", "List<?>");
+        assertType("supFbound().get(0)", "Object");
+        assertType("extFboundArr()", "List<? extends Comparable<?>>[]");
+        assertType("extFboundArr()[0]", "List<? extends Comparable<?>>");
+        assertType("extFboundArr()[0].get(0)", "Comparable<?>");
+        assertType("supFboundArr()", "List<?>[]");
+        assertType("supFboundArr()[0]", "List<?>");
+        assertType("supFboundArr()[0].get(0)", "Object");
+        assertType("extFboundIter()", "Iterable<? extends List<? extends Comparable<?>>>");
+        assertType("extFboundIter().iterator()", "java.util.Iterator<? extends List<? extends Comparable<?>>>");
+        assertType("extFboundIter().iterator().next()", "List<? extends Comparable<?>>");
+        assertType("extFboundIter().iterator().next().get(0)", "Comparable<?>");
+        assertType("supFboundIter()", "Iterable<? extends List<?>>");
+        assertType("supFboundIter().iterator()", "java.util.Iterator<? extends List<?>>");
+        assertType("supFboundIter().iterator().next()", "List<?>");
+        assertType("supFboundIter().iterator().next().get(0)", "Object");
+        assertType("listOf(23)", "List<Integer>");
+        assertType("listOf(true)", "List<Boolean>");
+        assertType("listOf(true).get(0)", "Boolean");
+        assertType("arrayOf(99)", "Integer[]");
+        assertType("arrayOf(99)[0]", "Integer");
+
+        assertEval("<Z> Z choose(Z z1, Z z2) { return z1; }");
+        assertType("choose(1, 1L);", "Object");
+    }
+
+    public void testVariableTypeName() {
+        assertType("\"x\"", "String");
+
+        assertType("java.util.regex.Pattern.compile(\"x\")", "java.util.regex.Pattern");
+        assertEval("import java.util.regex.*;");
+        assertType("java.util.regex.Pattern.compile(\"x\")", "Pattern");
+
+        assertType("new java.util.ArrayList()", "java.util.ArrayList");
+        assertEval("import java.util.ArrayList;");
+        assertType("new java.util.ArrayList()", "ArrayList");
+
+        assertType("java.util.Locale.Category.FORMAT", "java.util.Locale.Category");
+        assertEval("import static java.util.Locale.Category;");
+        assertType("java.util.Locale.Category.FORMAT", "Category");
     }
 
     public void testReplNestedClassName() {
         assertEval("class D { static class E {} }");
-        VarSnippet sn = (VarSnippet) varKey(assertEval("new D.E();"));
-        assertEquals(sn.typeName(), "D.E");
+        assertType("new D.E();", "D.E");
     }
 
     public void testAnonymousClassName() {
         assertEval("class C {}");
-        VarSnippet sn = (VarSnippet) varKey(assertEval("new C() { int x; };"));
-        assertEquals(sn.typeName(), "C");
+        assertType("new C();", "C");
+        assertType("new C() { int x; };", "C");
     }
 
     public void testCapturedTypeName() {
-        VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass();"));
-        assertEquals(sn.typeName(), "Class<? extends String>");
-    }
-
-    public void testArrayTypeOfCapturedTypeName() {
-        VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass().getEnumConstants();"));
-        assertEquals(sn.typeName(), "String[]");
+        assertType("\"\".getClass();", "Class<? extends String>");
+        assertType("\"\".getClass().getEnumConstants();", "String[]");
     }
 
     public void testJavaLang() {
-        VarSnippet sn = (VarSnippet) varKey(assertEval("\"\";"));
-        assertEquals(sn.typeName(), "String");
+        assertType("\"\";", "String");
     }
 
     public void testNotOverEagerPackageEating() {
-        VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass().getDeclaredMethod(\"hashCode\");"));
-        assertEquals(sn.typeName(), "java.lang.reflect.Method");
+        assertType("\"\".getClass().getDeclaredMethod(\"hashCode\");", "java.lang.reflect.Method");
     }
 
     public void testBounds() {
         assertEval("java.util.List<? extends String> list1 = java.util.Arrays.asList(\"\");");
-        VarSnippet sn1 = (VarSnippet) varKey(assertEval("list1.iterator().next()"));
-        assertEquals(sn1.typeName(), "String");
+        assertType("list1.iterator().next()", "String");
         assertEval("java.util.List<? super String> list2 = java.util.Arrays.asList(\"\");");
-        VarSnippet sn2 = (VarSnippet) varKey(assertEval("list2.iterator().next()"));
-        assertEquals(sn2.typeName(), "Object");
+        assertType("list2.iterator().next()", "Object");
         assertEval("java.util.List<?> list3 = java.util.Arrays.asList(\"\");");
-        VarSnippet sn3 = (VarSnippet) varKey(assertEval("list3.iterator().next()"));
-        assertEquals(sn3.typeName(), "Object");
+        assertType("list3.iterator().next()", "Object");
         assertEval("class Test1<X extends CharSequence> { public X get() { return null; } }");
-        Snippet x = varKey(assertEval("Test1<?> test1 = new Test1<>();"));
-        VarSnippet sn4 = (VarSnippet) varKey(assertEval("test1.get()"));
-        assertEquals(sn4.typeName(), "Object");
+        assertEval("Test1<?> test1 = new Test1<>();");
+        assertType("test1.get()", "CharSequence");
         assertEval("class Test2<X extends Number & CharSequence> { public X get() { return null; } }");
         assertEval("Test2<?> test2 = new Test2<>();");
-        VarSnippet sn5 = (VarSnippet) varKey(assertEval("test2.get()"));
-        assertEquals(sn5.typeName(), "Object");
-        assertEval("class Test3<T> { T[][] get() { return null; } }", added(VALID));
+        assertType("test2.get()", "Object");
+        assertEval("class Test3<T> { T[][] get() { return null; } }");
         assertEval("Test3<? extends String> test3 = new Test3<>();");
-        VarSnippet sn6 = (VarSnippet) varKey(assertEval("test3.get()"));
-        assertEquals(sn6.typeName(), "String[][]");
+        assertType("test3.get()", "String[][]");
     }
 }
--- a/langtools/test/jdk/jshell/VariablesTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/jdk/jshell/VariablesTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -337,20 +337,4 @@
         assertEquals(unr.get(0), "class undefined");
         assertVariables(variable("undefined", "d"));
     }
-
-    public void variableTypeName() {
-        assertEquals(varKey(assertEval("\"x\"")).typeName(), "String");
-
-        assertEquals(varKey(assertEval("java.util.regex.Pattern.compile(\"x\")")).typeName(), "java.util.regex.Pattern");
-        assertEval("import java.util.regex.*;", added(VALID));
-        assertEquals(varKey(assertEval("java.util.regex.Pattern.compile(\"x\")")).typeName(), "Pattern");
-
-        assertEquals(varKey(assertEval("new java.util.ArrayList()")).typeName(), "java.util.ArrayList");
-        assertEval("import java.util.ArrayList;", added(VALID));
-        assertEquals(varKey(assertEval("new java.util.ArrayList()")).typeName(), "ArrayList");
-
-        assertEquals(varKey(assertEval("java.util.Locale.Category.FORMAT")).typeName(), "java.util.Locale.Category");
-        assertEval("import static java.util.Locale.Category;", added(VALID));
-        assertEquals(varKey(assertEval("java.util.Locale.Category.FORMAT")).typeName(), "Category");
-    }
 }
--- a/langtools/test/tools/javac/T5003235/T5003235a.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/T5003235/T5003235a.java	Fri Jan 13 01:35:30 2017 +0000
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Private inner class accessible from subclasses
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235a.out --diags:layout=%b:%l:%_%m T5003235a.java
+ * @compile/fail/ref=T5003235a.out -XDrawDiagnostics T5003235a.java
  */
 
 class Super {
--- a/langtools/test/tools/javac/T5003235/T5003235a.out	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/T5003235/T5003235a.out	Fri Jan 13 01:35:30 2017 +0000
@@ -1,13 +1,5 @@
-T5003235a.java:21: defaultM() in Super.Inner is defined in an inaccessible class or interface
-        i.defaultM();
-         ^
-T5003235a.java:22: protectedM() in Super.Inner is defined in an inaccessible class or interface
-        i.protectedM();
-         ^
-T5003235a.java:23: publicM() in Super.Inner is defined in an inaccessible class or interface
-        i.publicM();
-         ^
-T5003235a.java:24: privateM() in Super.Inner is defined in an inaccessible class or interface
-        i.privateM();
-         ^
+T5003235a.java:21:10: compiler.err.not.def.access.class.intf.cant.access: defaultM(), Super.Inner
+T5003235a.java:22:10: compiler.err.not.def.access.class.intf.cant.access: protectedM(), Super.Inner
+T5003235a.java:23:10: compiler.err.not.def.access.class.intf.cant.access: publicM(), Super.Inner
+T5003235a.java:24:10: compiler.err.not.def.access.class.intf.cant.access: privateM(), Super.Inner
 4 errors
--- a/langtools/test/tools/javac/T5003235/T5003235b.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/T5003235/T5003235b.java	Fri Jan 13 01:35:30 2017 +0000
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Accessibility of private inner class
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235b.out --diags:layout=%b:%l:%_%m T5003235b.java
+ * @compile/fail/ref=T5003235b.out -XDrawDiagnostics T5003235b.java
  */
 
 class Outer {
--- a/langtools/test/tools/javac/T5003235/T5003235b.out	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/T5003235/T5003235b.out	Fri Jan 13 01:35:30 2017 +0000
@@ -1,13 +1,5 @@
-T5003235b.java:28: k in Outer.Inner is defined in an inaccessible class or interface
-        System.out.println("Value of k: " + outer.inner.k);
-                                                       ^
-T5003235b.java:29: l in Outer.Inner is defined in an inaccessible class or interface
-        System.out.println("Value of l: " + outer.inner.l);
-                                                       ^
-T5003235b.java:30: m in Outer.Inner is defined in an inaccessible class or interface
-        System.out.println("Value of m: " + outer.inner.m);
-                                                       ^
-T5003235b.java:31: n in Outer.Inner is defined in an inaccessible class or interface
-        System.out.println("Value of n: " + outer.inner.n);
-                                                       ^
+T5003235b.java:28:56: compiler.err.not.def.access.class.intf.cant.access: k, Outer.Inner
+T5003235b.java:29:56: compiler.err.not.def.access.class.intf.cant.access: l, Outer.Inner
+T5003235b.java:30:56: compiler.err.not.def.access.class.intf.cant.access: m, Outer.Inner
+T5003235b.java:31:56: compiler.err.not.def.access.class.intf.cant.access: n, Outer.Inner
 4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171325/NPEClearingLocalClassNameIndexesTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,21 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8171325
+ * @summary NPE in Check.clearLocalClassNameIndexes
+ * @compile/fail/ref=NPEClearingLocalClassNameIndexesTest.out -XDrawDiagnostics NPEClearingLocalClassNameIndexesTest.java
+ */
+
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class NPEClearingLocalClassNameIndexesTest {
+    <A> void f(List<A> t) {}
+    <B, C> C g(C u, Function<B, C> v) { return null; }
+    <D> D g(Supplier<D> w) { return null; }
+
+    public void test() {
+        f(g((String) null, task -> g(new NoSuch() {})));
+        f(g((String) null, task -> g(new NoSuch<int>() {})));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171325/NPEClearingLocalClassNameIndexesTest.out	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,6 @@
+NPEClearingLocalClassNameIndexesTest.java:18:9: compiler.err.cant.apply.symbol: kindname.method, f, java.util.List<A>, java.lang.String, kindname.class, NPEClearingLocalClassNameIndexesTest, (compiler.misc.incompatible.upper.lower.bounds: C, java.lang.Object,java.util.List<A>, java.lang.String)
+NPEClearingLocalClassNameIndexesTest.java:18:42: compiler.err.cant.resolve.location: kindname.class, NoSuch, , , (compiler.misc.location: kindname.class, NPEClearingLocalClassNameIndexesTest, null)
+NPEClearingLocalClassNameIndexesTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, f, java.util.List<A>, java.lang.String, kindname.class, NPEClearingLocalClassNameIndexesTest, (compiler.misc.incompatible.upper.lower.bounds: C, java.lang.Object,java.util.List<A>, java.lang.String)
+NPEClearingLocalClassNameIndexesTest.java:19:42: compiler.err.cant.resolve.location: kindname.class, NoSuch, , , (compiler.misc.location: kindname.class, NPEClearingLocalClassNameIndexesTest, null)
+NPEClearingLocalClassNameIndexesTest.java:19:49: compiler.err.type.found.req: int, (compiler.misc.type.req.ref)
+5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171332/Buggy.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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 enum Buggy implements Buggy {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171332/Processor.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,21 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 8171332
+ * @summary 8171332: NPE in MembersPhase.finishClass
+ * @modules java.compiler
+ *          jdk.compiler
+ * @build Processor
+ * @compile/fail/ref=Processor.out -XDrawDiagnostics -processor Processor Buggy.java
+ */
+
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class Processor extends AbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171332/Processor.out	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,3 @@
+Buggy.java:24:35: compiler.err.intf.expected.here
+Buggy.java:24:13: compiler.err.cyclic.inheritance: Buggy
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/DuplicatedAnnotatedPackagesTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,6 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8171528
+ * @summary Crash in Annotate with duplicate package-info declarations
+ * @compile/fail/ref=DuplicatedAnnotatedPackagesTest.out -XDrawDiagnostics pkg1/package-info.java pkg2/package-info.java
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/DuplicatedAnnotatedPackagesTest.out	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,4 @@
+package-info.java:2:9: compiler.warn.pkg-info.already.seen: test
+package-info.java:1:1: compiler.err.already.annotated: kindname.package, test
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/pkg1/package-info.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,2 @@
+@Deprecated
+package test;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/pkg2/package-info.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,2 @@
+@Deprecated
+package test;
--- a/langtools/test/tools/javac/diags/Example.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/diags/Example.java	Fri Jan 13 01:35:30 2017 +0000
@@ -61,9 +61,10 @@
         declaredKeys = new TreeSet<String>();
         srcFiles = new ArrayList<File>();
         procFiles = new ArrayList<File>();
-        supportFiles = new ArrayList<File>();
         srcPathFiles = new ArrayList<File>();
         moduleSourcePathFiles = new ArrayList<File>();
+        modulePathFiles = new ArrayList<File>();
+        classPathFiles = new ArrayList<File>();
         additionalFiles = new ArrayList<File>();
 
         findFiles(file, srcFiles);
@@ -89,10 +90,13 @@
                 } else if (files == srcFiles && c.getName().equals("additional")) {
                     additionalFilesDir = c;
                     findFiles(c, additionalFiles);
-                } else if (files == srcFiles && c.getName().equals("support"))
-                    findFiles(c, supportFiles);
-                else
+                } else if (files == srcFiles && c.getName().equals("modulepath")) {
+                    findFiles(c, modulePathFiles);
+                } else if (files == srcFiles && c.getName().equals("classpath")) {
+                    findFiles(c, classPathFiles);
+                } else {
                     findFiles(c, files);
+                }
             }
         } else if (f.isFile()) {
                 if (f.getName().endsWith(".java")) {
@@ -194,23 +198,32 @@
      */
     private void run(PrintWriter out, Set<String> keys, boolean raw, boolean verbose)
             throws IOException {
-        ClassLoader loader = getClass().getClassLoader();
-        if (supportFiles.size() > 0) {
-            File supportDir = new File(tempDir, "support");
-            supportDir.mkdirs();
-            clean(supportDir);
-            List<String> sOpts = Arrays.asList("-d", supportDir.getPath());
-            new Jsr199Compiler(verbose).run(null, null, false, sOpts, procFiles);
-            URLClassLoader ucl =
-                    new URLClassLoader(new URL[] { supportDir.toURI().toURL() }, loader);
-            loader = ucl;
+        List<String> opts = new ArrayList<String>();
+        if (!modulePathFiles.isEmpty()) {
+            File modulepathDir = new File(tempDir, "modulepath");
+            modulepathDir.mkdirs();
+            clean(modulepathDir);
+            List<String> sOpts = Arrays.asList("-d", modulepathDir.getPath(),
+                                               "--module-source-path", new File(file, "modulepath").getAbsolutePath());
+            new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles);
+            opts.add("--module-path");
+            opts.add(modulepathDir.getAbsolutePath());
+        }
+
+        if (!classPathFiles.isEmpty()) {
+            File classpathDir = new File(tempDir, "classpath");
+            classpathDir.mkdirs();
+            clean(classpathDir);
+            List<String> sOpts = Arrays.asList("-d", classpathDir.getPath());
+            new Jsr199Compiler(verbose).run(null, null, false, sOpts, classPathFiles);
+            opts.add("--class-path");
+            opts.add(classpathDir.getAbsolutePath());
         }
 
         File classesDir = new File(tempDir, "classes");
         classesDir.mkdirs();
         clean(classesDir);
 
-        List<String> opts = new ArrayList<String>();
         opts.add("-d");
         opts.add(classesDir.getPath());
         if (options != null)
@@ -327,8 +340,9 @@
     File additionalFilesDir;
     List<File> srcPathFiles;
     List<File> moduleSourcePathFiles;
+    List<File> modulePathFiles;
+    List<File> classPathFiles;
     List<File> additionalFiles;
-    List<File> supportFiles;
     File infoFile;
     private List<String> runOpts;
     private List<String> options;
--- a/langtools/test/tools/javac/diags/RunExamples.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/diags/RunExamples.java	Fri Jan 13 01:35:30 2017 +0000
@@ -239,8 +239,10 @@
                     srcFiles.remove(e.infoFile);
                     showFiles(e, srcFiles);
                     showFiles(e, e.srcPathFiles);
+                    showFiles(e, e.moduleSourcePathFiles);
+                    showFiles(e, e.modulePathFiles);
+                    showFiles(e, e.classPathFiles);
                     showFiles(e, e.procFiles);
-                    showFiles(e, e.supportFiles);
                 }
                 run(e);
             }
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Fri Jan 13 01:35:30 2017 +0000
@@ -20,11 +20,13 @@
 compiler.err.limit.stack                                # Code
 compiler.err.limit.string                               # Gen
 compiler.err.limit.string.overflow                      # JavaCompiler
+compiler.err.module.non.zero.opens                      # bad class file
 compiler.err.name.reserved.for.internal.use             # UNUSED
 compiler.err.no.annotation.member
 compiler.err.no.encl.instance.of.type.in.scope          # cannot occur; always followed by assert false;
 compiler.err.no.match.entry                             # UNUSED?
 compiler.err.not.annotation.type                        # cannot occur given preceding checkType
+compiler.err.not.def.access.package.cant.access
 compiler.err.proc.bad.config.file                       # JavacProcessingEnvironment
 compiler.err.proc.cant.access                           # completion failure
 compiler.err.proc.cant.access.1                         # completion failure, no stack trace
@@ -69,10 +71,11 @@
 compiler.misc.kindname.value
 compiler.misc.incompatible.eq.lower.bounds              # cannot happen?
 compiler.misc.module.name.mismatch
+compiler.misc.module.non.zero.opens                     # bad class file
 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.not.def.access.package.cant.access
+compiler.misc.package.not.visible
 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/NotDefAccessClassIntfCantAccessReason/NotDefAccessClassIntfCantAccessReason.java	Fri Jan 13 01:35:30 2017 +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.err.not.def.access.class.intf.cant.access.reason
+//key: compiler.misc.not.def.access.does.not.read
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apia/api1/Api.java	Fri Jan 13 01:35:30 2017 +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 api1;
+
+public class Api {
+    public static void test() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apia/module-info.java	Fri Jan 13 01:35:30 2017 +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 apia {
+    exports api1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apib/api2/Api.java	Fri Jan 13 01:35:30 2017 +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 api2;
+
+public class Api {
+    public static api1.Api get() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apib/module-info.java	Fri Jan 13 01:35:30 2017 +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 apib {
+    requires apia;
+    exports api2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/impl/impl/Impl.java	Fri Jan 13 01:35:30 2017 +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 {
+    void test() {
+        api2.Api.get().test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/impl/module-info.java	Fri Jan 13 01:35:30 2017 +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 impl {
+    requires apib;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/NotDefAccessClassIntfCantAccessReason.java	Fri Jan 13 01:35:30 2017 +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.
+ */
+
+// key: compiler.err.prob.found.req
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.not.def.access.class.intf.cant.access.reason
+// key: compiler.misc.not.def.access.does.not.read
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apia/api1/Api.java	Fri Jan 13 01:35:30 2017 +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 api1;
+
+public class Api {
+    public static void test() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apia/module-info.java	Fri Jan 13 01:35:30 2017 +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 apia {
+    exports api1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apib/api2/Api.java	Fri Jan 13 01:35:30 2017 +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 api2;
+
+public class Api {
+    public static api1.Api get() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apib/module-info.java	Fri Jan 13 01:35:30 2017 +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 apib {
+    requires apia;
+    exports api2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/impl/impl/Impl.java	Fri Jan 13 01:35:30 2017 +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 {
+    void test(api2.Api a2) {
+        Runnable r = a2.get() :: test;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/impl/module-info.java	Fri Jan 13 01:35:30 2017 +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 impl {
+    requires apib;
+}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/NotDefAccessClassPackageCantAccess.java	Thu Jan 12 23:41:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.not.def.access.package.cant.access
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/module-info.java	Thu Jan 12 23:41:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module m1x {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/p1/C1.java	Thu Jan 12 23:41:19 2017 +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.
- */
-
-package p1;
-
-public class C1 {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/module-info.java	Thu Jan 12 23:41:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module m2x {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/p2/C2.java	Thu Jan 12 23:41:19 2017 +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 p2;
-
-public class C2 {
-    p1.C1 c1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/NotDefAccessDoesNotRead.java	Fri Jan 13 01:35:30 2017 +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.err.package.not.visible
+//key: compiler.misc.not.def.access.does.not.read
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/api/api/Api.java	Fri Jan 13 01:35:30 2017 +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 api;
+
+public class Api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/api/module-info.java	Fri Jan 13 01:35:30 2017 +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 api {
+    exports api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/impl/impl/Impl.java	Fri Jan 13 01:35:30 2017 +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 impl;
+
+public class Impl {
+    api.Api api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/impl/module-info.java	Fri Jan 13 01:35:30 2017 +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.
+ */
+
+module impl {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadFromUnnamed/NotDefAccessDoesNotReadFromUnnamed.java	Fri Jan 13 01:35:30 2017 +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.package.not.visible
+//key: compiler.misc.not.def.access.does.not.read.from.unnamed
+
+public class NotDefAccessDoesNotReadFromUnnamed {
+     api.Api api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadFromUnnamed/modulepath/api/api/Api.java	Fri Jan 13 01:35:30 2017 +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 api;
+
+public class Api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadFromUnnamed/modulepath/api/module-info.java	Fri Jan 13 01:35:30 2017 +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 api {
+    exports api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/NotDefAccessDoesNotReadUnnamed.java	Fri Jan 13 01:35:30 2017 +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.not.def.access.class.intf.cant.access.reason
+//key: compiler.misc.not.def.access.does.not.read.unnamed
+//options: --add-reads=auxiliary=ALL-UNNAMED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/classpath/api/Api.java	Fri Jan 13 01:35:30 2017 +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 api;
+
+public class Api {
+    public void test() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/auxiliary/auxiliary/Auxiliary.java	Fri Jan 13 01:35:30 2017 +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 auxiliary;
+
+public class Auxiliary {
+    public static api.Api get() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/auxiliary/module-info.java	Fri Jan 13 01:35:30 2017 +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 auxiliary {
+    exports auxiliary;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/impl/impl/Impl.java	Fri Jan 13 01:35:30 2017 +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 {
+    {
+        auxiliary.Auxiliary.get().test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/impl/module-info.java	Fri Jan 13 01:35:30 2017 +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 impl {
+    requires auxiliary;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/NotDefAccessNotExported.java	Fri Jan 13 01:35:30 2017 +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.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/api/api/Api.java	Fri Jan 13 01:35:30 2017 +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 api;
+
+public class Api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/api/module-info.java	Fri Jan 13 01:35:30 2017 +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.
+ */
+
+module api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/impl/impl/Impl.java	Fri Jan 13 01:35:30 2017 +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 impl;
+
+public class Impl {
+    api.Api api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/impl/module-info.java	Fri Jan 13 01:35:30 2017 +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 impl {
+    requires api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedFromUnnamed/NotDefAccessNotExportedFromUnnamed.java	Fri Jan 13 01:35:30 2017 +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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported.from.unnamed
+//options: --add-modules api
+
+public class NotDefAccessNotExportedFromUnnamed {
+     api.Api api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedFromUnnamed/modulepath/api/api/Api.java	Fri Jan 13 01:35:30 2017 +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 api;
+
+public class Api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedFromUnnamed/modulepath/api/module-info.java	Fri Jan 13 01:35:30 2017 +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.
+ */
+
+module api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/NotDefAccessNotExportedToModule.java	Fri Jan 13 01:35:30 2017 +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.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported.to.module
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/api/api/Api.java	Fri Jan 13 01:35:30 2017 +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 api;
+
+public class Api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/api/module-info.java	Fri Jan 13 01:35:30 2017 +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 api {
+    exports api to other;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/impl/impl/Impl.java	Fri Jan 13 01:35:30 2017 +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 impl;
+
+public class Impl {
+    api.Api api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/impl/module-info.java	Fri Jan 13 01:35:30 2017 +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 impl {
+    requires api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/other/module-info.java	Fri Jan 13 01:35:30 2017 +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 other {
+     requires api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/NotDefAccessNotExportedToModuleFromUnnamed.java	Fri Jan 13 01:35:30 2017 +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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported.to.module.from.unnamed
+//options: --add-modules api
+
+public class NotDefAccessNotExportedToModuleFromUnnamed {
+     api.Api api;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/modulepath/api/api/Api.java	Fri Jan 13 01:35:30 2017 +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 api;
+
+public class Api {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/modulepath/api/module-info.java	Fri Jan 13 01:35:30 2017 +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 api {
+    exports api to other;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/modulepath/other/module-info.java	Fri Jan 13 01:35:30 2017 +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 other {
+     requires api;
+}
--- a/langtools/test/tools/javac/modules/AddLimitMods.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/AddLimitMods.java	Fri Jan 13 01:35:30 2017 +0000
@@ -217,8 +217,8 @@
 
     private static final List<Entry<String[], String>> variants = Arrays.asList(
             new SimpleEntry<String[], String>(new String[] {},
-                                              "Test.java:2:18: compiler.err.doesnt.exist: javax.annotation\n"
-                                            + "Test.java:5:19: compiler.err.doesnt.exist: javax.xml.bind\n"
+                                              "Test.java:2:7: compiler.err.package.not.visible: javax.annotation, (compiler.misc.not.def.access.does.not.read.from.unnamed: javax.annotation, java.annotations.common)\n"
+                                            + "Test.java:5:14: compiler.err.package.not.visible: javax.xml.bind, (compiler.misc.not.def.access.does.not.read.from.unnamed: javax.xml.bind, java.xml.bind)\n"
                                             + "2 errors\n"),
             new SimpleEntry<String[], String>(new String[] {"--add-modules", "java.annotations.common,java.xml.bind"},
                                               null),
--- a/langtools/test/tools/javac/modules/AddReadsTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/AddReadsTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -81,7 +81,7 @@
                 .getOutput(Task.OutputKind.DIRECT);
 
         checkOutputContains(log,
-            "Test.java:1:44: compiler.err.not.def.access.package.cant.access: api.Api, api");
+            "Test.java:1:41: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read: m2x, api, m1x)");
 
         //test add dependencies:
         new JavacTask(tb)
--- a/langtools/test/tools/javac/modules/AutomaticModules.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/AutomaticModules.java	Fri Jan 13 01:35:30 2017 +0000
@@ -283,7 +283,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
+        List<String> expected = Arrays.asList("Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
                                               "1 error");
 
         if (!expected.equals(log)) {
@@ -300,8 +300,8 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        expected = Arrays.asList("Impl.java:1:51: compiler.err.doesnt.exist: apiB",
-                                 "Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
+        expected = Arrays.asList("Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read: m1x, apiB, automaticB)",
+                                 "Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
                                  "2 errors");
 
         if (!expected.equals(log)) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/ConvenientAccessErrorsTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8169197 8172668
+ * @summary Check convenient errors are produced for inaccessible classes.
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
+ * @run main ConvenientAccessErrorsTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+
+public class ConvenientAccessErrorsTest extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        new ConvenientAccessErrorsTest().runTests();
+    }
+
+    @Test
+    public void testNoDep(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports api; }",
+                          "package api; public class Api { public void call() { } }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { }",
+                          "package test; public class Test { api.Api api; }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read: m2x, api, m1x)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testNotExported(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports api; }",
+                          "package api; public class Api { }",
+                          "package impl; public class Impl { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { requires m1x; }",
+                          "package test; public class Test { impl.Impl api; }");
+        Path src_m3 = src.resolve("m3x");
+        tb.writeJavaFiles(src_m3,
+                          "module m3x { requires m1x; }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:35: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported: impl, m1x)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports api; exports impl to m3x;}");
+
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList(
+                "Test.java:1:35: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported.to.module: impl, m1x, m2x)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testInaccessibleInExported(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports api; }",
+                          "package api; class Api { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { requires m1x; }",
+                          "package test; public class Test { api.Api api; }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:38: compiler.err.not.def.public.cant.access: api.Api, api",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+//    @Test
+    public void testInaccessibleUnnamedModule(Path base) throws Exception {
+        Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }");
+
+        Path moduleSrc = base.resolve("module-src");
+        Path m1x = moduleSrc.resolve("m1x");
+
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        tb.writeJavaFiles(m1x,
+                          "module m1x { }",
+                          "package test; public class Test { api.Api api; api.Api.Foo api; }");
+
+        List<String> log = new JavacTask(tb)
+                .options("-classpath", jar.toString(),
+                         "-XDrawDiagnostics")
+                .outdir(classes)
+                .files(findJavaFiles(moduleSrc))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:38: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
+                "Test.java:1:51: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
+                "2 errors");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testIndirectReferenceToUnnamedModule(Path base) throws Exception {
+        Path jar = prepareTestJar(base, "package api; public class Api { public void test() {} }");
+
+        Path moduleSrc = base.resolve("module-src");
+        Path m1x = moduleSrc.resolve("m1x");
+        Path auxiliary = moduleSrc.resolve("auxiliary");
+
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        tb.writeJavaFiles(m1x,
+                          "module m1x { requires auxiliary; }",
+                          "package test; public class Test { { auxiliary.Auxiliary.get().test(); } }");
+
+        tb.writeJavaFiles(auxiliary,
+                          "module auxiliary { exports auxiliary; }",
+                          "package auxiliary; public class Auxiliary { public static api.Api get() { return null; } }");
+
+        List<String> log = new JavacTask(tb)
+                .options("-classpath", jar.toString(),
+                         "-XDrawDiagnostics",
+                         "--add-reads", "auxiliary=ALL-UNNAMED",
+                         "--module-source-path", moduleSrc.toString())
+                .outdir(classes)
+                .files(findJavaFiles(moduleSrc))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:62: compiler.err.not.def.access.class.intf.cant.access.reason: test(), api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    private Path prepareTestJar(Path base, String code) throws Exception {
+        Path legacySrc = base.resolve("legacy-src");
+        tb.writeJavaFiles(legacySrc, code);
+        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 lib = base.resolve("lib");
+
+        Files.createDirectories(lib);
+
+        Path jar = lib.resolve("test-api-1.0.jar");
+
+        new JarTask(tb, jar)
+          .baseDir(legacyClasses)
+          .files("api/Api.class")
+          .run();
+
+        return jar;
+    }
+
+    @Test
+    public void testUnnamedModuleAccess(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports api to m2x; }",
+                          "package api; class Api { }",
+                          "package impl; class Impl { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { requires m1x; }");
+        Path modulepath = base.resolve("modulepath");
+        tb.createDirectories(modulepath);
+
+        new JavacTask(tb)
+                .options("--module-source-path", src.toString())
+                .outdir(modulepath)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        Path unnamedSrc = base.resolve("unnamedSrc");
+        tb.writeJavaFiles(unnamedSrc,
+                          "public class Test { api.Api api; impl.Impl impl; }");
+        Path unnamedClasses = base.resolve("unnamed-classes");
+        Files.createDirectories(unnamedClasses);
+
+        List<String> log = new JavacTask(tb)
+                .options("--module-path", modulepath.toString(),
+                         "-XDrawDiagnostics")
+                .outdir(unnamedClasses)
+                .files(findJavaFiles(unnamedSrc))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:21: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.from.unnamed: api, m1x)",
+                "Test.java:1:34: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.does.not.read.from.unnamed: impl, m1x)",
+                "2 errors"
+        );
+
+        if (!expected.equals(log)) {
+            throw new Exception("unexpected output: " + log);
+        }
+
+        log = new JavacTask(tb)
+                .options("--module-path", modulepath.toString(),
+                         "--add-modules", "m1x",
+                         "-XDrawDiagnostics")
+                .outdir(unnamedClasses)
+                .files(findJavaFiles(unnamedSrc))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList(
+                "Test.java:1:21: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported.to.module.from.unnamed: api, m1x)",
+                "Test.java:1:34: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported.from.unnamed: impl, m1x)",
+                "2 errors"
+        );
+
+        if (!expected.equals(log)) {
+            throw new Exception("unexpected output: " + log);
+        }
+    }
+
+    @Test
+    public void testInImport(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { }",
+                          "package api; public class Api { public String test() { return null; } }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { requires m1x; }",
+                          "package test; import api.Api; public class Test { Api api; { api.test().length(); } }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testInImportOnDemand(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { }",
+                          "package api; public class Api { public String test() { return null; } }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { requires m1x; }",
+                          "package test; import api.*; public class Test { Api api; { api.test().length(); } }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+                "Test.java:1:49: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+                "2 errors");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testUnusedImportOnDemand1(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package test; import javax.annotation.*; public class Test { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--add-modules", "java.compiler")
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList("");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testUnusedImportOnDemand2(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { }",
+                          "package api; public class Api { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { requires m1x; }",
+                          "package test; import api.*; public class Test { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testClassPackageConflict(Path base) throws Exception {
+        Path libSrc = base.resolve("libSrc");
+        tb.writeJavaFiles(libSrc,
+                          "package test.desktop; public class Any { }");
+        Path libClasses = base.resolve("libClasses");
+        tb.createDirectories(libClasses);
+
+        new JavacTask(tb)
+                .outdir(libClasses)
+                .files(findJavaFiles(libSrc))
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package test; public class desktop { public static class Action { } }",
+                          "package use; import test.desktop.*; public class Use { test.desktop.Action a; }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .classpath(libClasses)
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testClassPackageConflictInUnnamed(Path base) throws Exception {
+        Path libSrc = base.resolve("libSrc");
+        tb.writeJavaFiles(libSrc,
+                          "package desktop; public class Any { }");
+        Path libClasses = base.resolve("libClasses");
+        tb.createDirectories(libClasses);
+
+        new JavacTask(tb)
+                .outdir(libClasses)
+                .files(findJavaFiles(libSrc))
+                .run()
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "public class desktop { public static class Action { } }",
+                          "import desktop.*; public class Use { desktop.Action a; }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .classpath(libClasses)
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testUnresolvableInImport(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { }",
+                          "package api; import can.not.resolve; public class Api { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Api.java:1:28: compiler.err.doesnt.exist: can.not",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testMissingKnownClass(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports api; }",
+                          "package api; public class Base { }",
+                          "package api; public class Sub extends Base { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+        Path m1xClasses = classes.resolve("m1x");
+        tb.createDirectories(m1xClasses);
+
+        new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(m1xClasses)
+                .files(findJavaFiles(src_m1))
+                .run(Task.Expect.SUCCESS)
+                .writeAll();
+
+        Files.delete(m1xClasses.resolve("api").resolve("Base.class"));
+
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { requires m1x; }",
+                          "package test;\n" +
+                          "import api.Sub;\n" +
+                          "import api.Base;\n" +
+                          "public class Test {\n" +
+                          "    Sub a2;\n" +
+                          "    Base a;\n" +
+                          "}\n");
+        Path m2xClasses = classes.resolve("m2x");
+        tb.createDirectories(m2xClasses);
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-path", classes.toString(),
+                         "-XDdev")
+                .outdir(m2xClasses)
+                .files(findJavaFiles(src_m2))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:3:11: compiler.err.cant.resolve.location: kindname.class, Base, , , (compiler.misc.location: kindname.package, api, null)",
+                "Test.java:6:5: compiler.err.cant.resolve.location: kindname.class, Base, , , (compiler.misc.location: kindname.class, test.Test, null)",
+                "2 errors");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+}
--- a/langtools/test/tools/javac/modules/EdgeCases.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/EdgeCases.java	Fri Jan 13 01:35:30 2017 +0000
@@ -178,7 +178,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access: call(), api1.Api1") ||
+        if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access.reason: call(), api1.Api1, api1, (compiler.misc.not.def.access.does.not.read: m3x, api1, m1x)") ||
             !log.contains("Test.java:1:76: compiler.err.not.def.access.class.intf.cant.access: toString(), java.lang.Object"))
             throw new Exception("expected output not found");
     }
--- a/langtools/test/tools/javac/modules/GraphsTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/GraphsTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -134,9 +134,9 @@
                 .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
-                "Negative.java:1:43: compiler.err.doesnt.exist: closedO",
-                "Negative.java:1:56: compiler.err.doesnt.exist: closedN",
-                "Negative.java:1:69: compiler.err.doesnt.exist: closedL");
+                "Negative.java:1:36: compiler.err.package.not.visible: closedO, (compiler.misc.not.def.access.not.exported: closedO, O)",
+                "Negative.java:1:49: compiler.err.package.not.visible: closedN, (compiler.misc.not.def.access.not.exported: closedN, N)",
+                "Negative.java:1:62: compiler.err.package.not.visible: closedL, (compiler.misc.not.def.access.not.exported: closedL, L)");
         if (!log.containsAll(expected)) {
             throw new Exception("Expected output not found");
         }
@@ -153,9 +153,9 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
         expected = Arrays.asList(
-                "Negative.java:1:43: compiler.err.not.def.access.package.cant.access: closedO.O, closedO",
-                "Negative.java:1:56: compiler.err.not.def.access.package.cant.access: closedN.N, closedN",
-                "Negative.java:1:69: compiler.err.not.def.access.package.cant.access: closedL.L, closedL");
+                "Negative.java:1:36: compiler.err.package.not.visible: closedO, (compiler.misc.not.def.access.not.exported: closedO, O)",
+                "Negative.java:1:49: compiler.err.package.not.visible: closedN, (compiler.misc.not.def.access.not.exported: closedN, N)",
+                "Negative.java:1:62: compiler.err.package.not.visible: closedL, (compiler.misc.not.def.access.not.exported: closedL, L)");
         if (!out.containsAll(expected)) {
             throw new Exception("Expected output not found");
         }
@@ -201,7 +201,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        String expected = "A.java:1:35: compiler.err.not.def.access.package.cant.access: pack.Clazz, pack";
+        String expected = "A.java:1:31: compiler.err.package.not.visible: pack, (compiler.misc.not.def.access.not.exported.to.module: pack, N, L)";
         if (!log.contains(expected)) {
             throw new Exception("Expected output not found");
         }
--- a/langtools/test/tools/javac/modules/LimitModulesTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/LimitModulesTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -180,7 +180,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("C.java:1:41: compiler.err.doesnt.exist: com.sun.tools.javac"))
+        if (!log.contains("C.java:1:35: compiler.err.package.not.visible: com.sun.tools.javac, (compiler.misc.not.def.access.does.not.read.from.unnamed: com.sun.tools.javac, jdk.compiler)"))
             throw new Exception("expected output not found");
     }
 }
--- a/langtools/test/tools/javac/modules/OpenModulesTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/OpenModulesTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -117,7 +117,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
+        List<String> expected2 = Arrays.asList("Test.java:1:49: compiler.err.package.not.visible: api2, (compiler.misc.not.def.access.not.exported: api2, m1x)",
                                                "1 error");
         if (!Objects.equals(log2, expected2))
             throw new Exception("expected output not found: " + log2);
@@ -180,7 +180,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
+        List<String> expected2 = Arrays.asList("Test.java:1:49: compiler.err.package.not.visible: api2, (compiler.misc.not.def.access.not.exported: api2, m1x)",
                                                "1 error");
         if (!Objects.equals(log2, expected2))
             throw new Exception("expected output not found: " + log2);
--- a/langtools/test/tools/javac/modules/PackageMultipleModules.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/PackageMultipleModules.java	Fri Jan 13 01:35:30 2017 +0000
@@ -70,8 +70,8 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("A.java:1:26: compiler.err.not.def.access.package.cant.access: test.B, test",
-                                              "B.java:1:26: compiler.err.not.def.access.package.cant.access: test.A, test",
+        List<String> expected = Arrays.asList("A.java:1:22: compiler.err.package.not.visible: test, (compiler.misc.not.def.access.does.not.read: m1x, test, m2x)",
+                                              "B.java:1:22: compiler.err.package.not.visible: test, (compiler.misc.not.def.access.does.not.read: m2x, test, m1x)",
                                               "2 errors");
         if (!log.equals(expected))
             throw new Exception("expected output not found");
--- a/langtools/test/tools/javac/modules/RequiresStaticTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/RequiresStaticTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -88,7 +88,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
+        if (!log.contains("Test.java:1:22: compiler.err.package.not.visible: com.sun.source.tree, (compiler.misc.not.def.access.does.not.read: m, com.sun.source.tree, jdk.compiler)"))
             throw new Exception("expected output not found");
     }
 
@@ -124,18 +124,10 @@
                 .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)"
+            "C1.java:5:8: compiler.err.package.not.visible: p5, (compiler.misc.not.def.access.does.not.read: m1x, p5, m5x)",
+            "C1.java:5:22: compiler.err.package.not.visible: p6, (compiler.misc.not.def.access.does.not.read: m1x, p6, m6x)",
+            "C1.java:5:36: compiler.err.package.not.visible: p7, (compiler.misc.not.def.access.does.not.read: m1x, p7, m7x)",
+            "C1.java:5:50: compiler.err.package.not.visible: p8, (compiler.misc.not.def.access.does.not.read: m1x, p8, m8x)"
         };
 
         for (String e: expect) {
--- a/langtools/test/tools/javac/modules/RequiresTransitiveTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/RequiresTransitiveTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -85,7 +85,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
+        if (!log.contains("Test.java:1:22: compiler.err.package.not.visible: com.sun.source.tree, (compiler.misc.not.def.access.does.not.read: m, com.sun.source.tree, jdk.compiler)"))
             throw new Exception("expected output not found");
     }
 
@@ -121,15 +121,9 @@
                 .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)"
+            "C1.java:5:8: compiler.err.package.not.visible: p5, (compiler.misc.not.def.access.does.not.read: m1x, p5, m5x)",
+            "C1.java:5:22: compiler.err.package.not.visible: p6, (compiler.misc.not.def.access.does.not.read: m1x, p6, m6x)",
+            "C1.java:5:36: compiler.err.package.not.visible: p7, (compiler.misc.not.def.access.does.not.read: m1x, p7, m7x)"
         };
 
         for (String e: expect) {
--- a/langtools/test/tools/javac/modules/ResolveTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/ResolveTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -99,7 +99,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+        if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2x, p1, m1x)"))
             throw new Exception("expected output not found");
     }
 
@@ -123,7 +123,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+        if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported: p1, m1x)"))
             throw new Exception("expected output not found");
     }
 
@@ -149,7 +149,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+        if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported.to.module: p1, m1x, m2x)"))
             throw new Exception("expected output not found");
     }
 
@@ -173,7 +173,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+        if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2x, p1, m1x)"))
             throw new Exception("expected output not found");
     }
 
--- a/langtools/test/tools/javac/modules/UsesTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/UsesTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -262,7 +262,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
+        List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.package.not.visible: p, (compiler.misc.not.def.access.not.exported: p, m1x)",
                 "1 error");
         if (!output.containsAll(expected)) {
             throw new Exception("Expected output not found");
@@ -286,7 +286,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
+        List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.package.not.visible: p, (compiler.misc.not.def.access.not.exported: p, m1x)",
                 "1 error");
         if (!output.containsAll(expected)) {
             throw new Exception("Expected output not found");
--- a/langtools/test/tools/javac/modules/XModuleTest.java	Thu Jan 12 23:41:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/XModuleTest.java	Fri Jan 13 01:35:30 2017 +0000
@@ -288,7 +288,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("A.java:1:36: compiler.err.doesnt.exist: pkg2",
+        List<String> expected = Arrays.asList("A.java:1:32: compiler.err.package.not.visible: pkg2, (compiler.misc.not.def.access.does.not.read: m1, pkg2, m2)",
                 "1 error");
 
         if (!expected.equals(log))