changeset 4064:54c1167ba68a

Merge
author lana
date Thu, 23 Mar 2017 22:57:03 +0000
parents 8cfb71a78258 ee787e34231d
children b398971f7b6f
files
diffstat 31 files changed, 785 insertions(+), 131 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -28,6 +28,8 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.lang.model.element.Element;
+
 import com.sun.source.doctree.DocTree;
 
 /**
@@ -65,18 +67,34 @@
     String getName();
 
     /**
+     * Initializes this taglet with the given doclet environment and doclet.
+     *
+     * @apiNote
+     * The environment may be used to access utility classes for
+     * {@link javax.lang.model.util.Elements elements} and
+     * {@link javax.lang.model.util.Types types} if needed.
+     *
+     * @implSpec
+     * This implementation does nothing.
+     *
+     * @param env the environment in which the doclet and taglet are running
+     * @param doclet the doclet that instantiated this taglet
+     */
+    default void init(DocletEnvironment env, Doclet doclet) { }
+
+    /**
      * Returns the string representation of a series of instances of
      * this tag to be included in the generated output.
      * If this taglet is for an {@link #isInlineTag inline} tag} it will
      * be called once per instance of the tag, each time with a singleton list.
      * Otherwise, if this tag is a block tag, it will be called once per
-     * comment, with a list of all the instances of the tag in the comment.
-     * @param tags the list of {@code DocTree} containing one or more
-     *  instances of this tag
+     * comment, with a list of all the instances of the tag in a comment.
+     * @param tags the list of instances of this tag
+     * @param element the element to which the enclosing comment belongs
      * @return the string representation of the tags to be included in
      *  the generated output
      */
-    String toString(List<? extends DocTree> tags);
+    String toString(List<? extends DocTree> tags, Element element);
 
     /**
      * The kind of location in which a tag may be used.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Thu Mar 23 22:57:03 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -240,7 +240,8 @@
      * Constructor. Initializes resource for the
      * {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
      */
-    public ConfigurationImpl() {
+    public ConfigurationImpl(Doclet doclet) {
+        super(doclet);
         resources = new Resources(this,
                 Configuration.sharedResourceBundleName,
                 "jdk.javadoc.internal.doclets.formats.html.resources.standard");
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,7 +61,7 @@
 public class HtmlDoclet extends AbstractDoclet {
 
     public HtmlDoclet() {
-        configuration = new ConfigurationImpl();
+        configuration = new ConfigurationImpl(this);
     }
 
     @Override // defined by Doclet
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Thu Mar 23 22:57:03 2017 +0000
@@ -74,6 +74,10 @@
  * @author Jamie Ho
  */
 public abstract class Configuration {
+    /**
+     * The doclet that created this configuration.
+     */
+    public final Doclet doclet;
 
     /**
      * The factory for builders.
@@ -342,8 +346,10 @@
             "jdk.javadoc.internal.doclets.toolkit.resources.doclets";
     /**
      * Constructs the configurations needed by the doclet.
+     * @param doclet the doclet that created this configuration
      */
-    public Configuration() {
+    public Configuration(Doclet doclet) {
+        this.doclet = doclet;
         excludedDocFileDirs = new HashSet<>();
         excludedQualifiers = new HashSet<>();
         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Thu Mar 23 22:57:03 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
@@ -32,6 +32,12 @@
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.ExecutableType;
+import javax.lang.model.type.PrimitiveType;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.SimpleTypeVisitor9;
 
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.DocTree.Kind;
@@ -440,16 +446,10 @@
 
             if (null != setter) {
                 VariableElement param = setter.getParameters().get(0);
-                String typeName = utils.getTypeName(param.asType(), false);
-                // Removal of type parameters and package information.
-                typeName = typeName.split("<")[0];
-                if (typeName.contains(".")) {
-                    typeName = typeName.substring(typeName.lastIndexOf(".") + 1);
-                }
                 StringBuilder sb = new StringBuilder("#");
                 sb.append(utils.getSimpleName(setter));
                 if (!utils.isTypeVariable(param.asType())) {
-                    sb.append("(").append(typeName).append(")");
+                    sb.append("(").append(utils.getTypeSignature(param.asType(), false, true)).append(")");
                 }
                 blockTags.add(cmtutils.makeSeeTree(sb.toString(), setter));
             }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Thu Mar 23 22:57:03 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -26,6 +26,7 @@
 package jdk.javadoc.internal.doclets.toolkit.taglets;
 
 import java.io.*;
+import java.lang.reflect.InvocationTargetException;
 import java.util.*;
 
 import javax.lang.model.element.Element;
@@ -39,6 +40,8 @@
 import javax.tools.StandardJavaFileManager;
 
 import com.sun.source.doctree.DocTree;
+import jdk.javadoc.doclet.Doclet;
+import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
@@ -125,6 +128,9 @@
      */
     private List<Taglet> serializedFormTags;
 
+    private final DocletEnvironment docEnv;
+    private final Doclet doclet;
+
     private final Messages messages;
     private final Resources resources;
 
@@ -184,7 +190,7 @@
      * @param showversion true if we want to use @version tags.
      * @param showauthor true if we want to use @author tags.
      * @param javafx indicates whether javafx is active.
-     * @param message the message retriever to print warnings.
+     * @param configuration the configuration for this taglet manager
      */
     public TagletManager(boolean nosince, boolean showversion,
                          boolean showauthor, boolean javafx,
@@ -199,6 +205,8 @@
         this.showversion = showversion;
         this.showauthor = showauthor;
         this.javafx = javafx;
+        this.docEnv = configuration.docEnv;
+        this.doclet = configuration.doclet;
         this.messages = configuration.getMessages();
         this.resources = configuration.getResources();
         initStandardTaglets();
@@ -236,7 +244,7 @@
      */
     public void addCustomTag(String classname, JavaFileManager fileManager, String tagletPath) {
         try {
-            ClassLoader tagClassLoader = null;
+            ClassLoader tagClassLoader;
             if (!fileManager.hasLocation(TAGLET_PATH)) {
                 List<File> paths = new ArrayList<>();
                 if (tagletPath != null) {
@@ -249,9 +257,11 @@
                 }
             }
             tagClassLoader = fileManager.getClassLoader(TAGLET_PATH);
-            Class<?> customTagClass = tagClassLoader.loadClass(classname);
-            Object instance = customTagClass.getConstructor().newInstance();
-            Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.Taglet)instance);
+            Class<? extends jdk.javadoc.doclet.Taglet> customTagClass =
+                    tagClassLoader.loadClass(classname).asSubclass(jdk.javadoc.doclet.Taglet.class);
+            jdk.javadoc.doclet.Taglet instance = customTagClass.getConstructor().newInstance();
+            instance.init(docEnv, doclet);
+            Taglet newLegacy = new UserTaglet(instance);
             String tname = newLegacy.getName();
             Taglet t = customTags.get(tname);
             if (t != null) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/UserTaglet.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/UserTaglet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -132,7 +132,7 @@
      */
     public Content getTagletOutput(Element element, DocTree tag, TagletWriter writer){
         Content output = writer.getOutputInstance();
-        output.addContent(new RawHtml(userTaglet.toString(Collections.singletonList(tag))));
+        output.addContent(new RawHtml(userTaglet.toString(Collections.singletonList(tag), element)));
         return output;
     }
 
@@ -144,7 +144,7 @@
         Utils utils = writer.configuration().utils;
         List<? extends DocTree> tags = utils.getBlockTags(holder, getName());
         if (!tags.isEmpty()) {
-            String tagString = userTaglet.toString(tags);
+            String tagString = userTaglet.toString(tags, holder);
             if (tagString != null) {
                 output.addContent(new RawHtml(tagString));
             }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Thu Mar 23 22:57:03 2017 +0000
@@ -725,7 +725,7 @@
         return result.toString();
     }
 
-    private String getTypeSignature(TypeMirror t, boolean qualifiedName, boolean noTypeParameters) {
+    public String getTypeSignature(TypeMirror t, boolean qualifiedName, boolean noTypeParameters) {
         return new SimpleTypeVisitor9<StringBuilder, Void>() {
             final StringBuilder sb = new StringBuilder();
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Thu Mar 23 22:57:03 2017 +0000
@@ -30,6 +30,7 @@
 import java.util.Collections;
 import java.util.EnumMap;
 import java.util.EnumSet;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -75,6 +76,7 @@
 
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 
+import static javax.lang.model.util.Elements.Origin.*;
 import static javax.tools.JavaFileObject.Kind.*;
 
 import static jdk.javadoc.internal.tool.Main.Result.*;
@@ -520,15 +522,21 @@
         }
     }
 
-    private void addPackagesFromLocations(Location packageLocn, ModulePackage modpkg) throws ToolException {
-        Iterable<JavaFileObject> list = null;
+    /* Call fm.list and wrap any IOException that occurs in a ToolException */
+    private Iterable<JavaFileObject> fmList(Location location,
+                                            String packagename,
+                                            Set<JavaFileObject.Kind> kinds,
+                                            boolean recurse) throws ToolException {
         try {
-            list = fm.list(packageLocn, modpkg.packageName, sourceKinds, true);
+            return fm.list(location, packagename, kinds, recurse);
         } catch (IOException ioe) {
-            String text = messager.getText("main.file.manager.list", modpkg.packageName);
+            String text = messager.getText("main.file.manager.list", packagename);
             throw new ToolException(SYSERR, text, ioe);
         }
-        for (JavaFileObject fo : list) {
+    }
+
+    private void addPackagesFromLocations(Location packageLocn, ModulePackage modpkg) throws ToolException {
+        for (JavaFileObject fo : fmList(packageLocn, modpkg.packageName, sourceKinds, true)) {
             String binaryName = fm.inferBinaryName(packageLocn, fo);
             String pn = getPackageName(binaryName);
             String simpleName = getSimpleName(binaryName);
@@ -555,25 +563,51 @@
     /**
      * Returns the "requires" modules for the target module.
      * @param mdle the target module element
-     * @param isPublic true gets all the public requires, otherwise
-     *                 gets all the non-public requires
+     * @param onlyTransitive true gets all the requires transitive, otherwise
+     *                 gets all the non-transitive requires
      *
      * @return a set of modules
      */
-    private Set<ModuleElement> getModuleRequires(ModuleElement mdle, boolean isPublic) {
+    private Set<ModuleElement> getModuleRequires(ModuleElement mdle, boolean onlyTransitive) throws ToolException {
         Set<ModuleElement> result = new HashSet<>();
         for (RequiresDirective rd : ElementFilter.requiresIn(mdle.getDirectives())) {
-            if (isPublic && rd.isTransitive()) {
-                result.add(rd.getDependency());
-            }
-            if (!isPublic && !rd.isTransitive()) {
-                result.add(rd.getDependency());
+            ModuleElement dep = rd.getDependency();
+            if (result.contains(dep))
+                continue;
+            if (!isMandated(mdle, rd) && onlyTransitive == rd.isTransitive()) {
+                if (!haveModuleSources(dep)) {
+                    messager.printWarning(dep, "main.module_not_found", dep.getSimpleName());
+                }
+                result.add(dep);
+            } else if (isMandated(mdle, rd) && haveModuleSources(dep)) {
+                result.add(dep);
             }
         }
         return result;
     }
 
-    private void computeSpecifiedModules() {
+    private boolean isMandated(ModuleElement mdle, RequiresDirective rd) {
+        return toolEnv.elements.getOrigin(mdle, rd) == MANDATED;
+    }
+
+    Map<ModuleSymbol, Boolean> haveModuleSourcesCache = new HashMap<>();
+    private boolean haveModuleSources(ModuleElement mdle) throws ToolException {
+        ModuleSymbol msym =  (ModuleSymbol)mdle;
+        if (msym.sourceLocation != null) {
+            return true;
+        }
+        if (msym.patchLocation != null) {
+            Boolean value = haveModuleSourcesCache.get(msym);
+            if (value == null) {
+                value = fmList(msym.patchLocation, "", sourceKinds, true).iterator().hasNext();
+                haveModuleSourcesCache.put(msym, value);
+            }
+            return value;
+        }
+        return false;
+    }
+
+    private void computeSpecifiedModules() throws ToolException {
         if (expandRequires == null) { // no expansion requested
             specifiedModuleElements = Collections.unmodifiableSet(specifiedModuleElements);
             return;
@@ -617,20 +651,14 @@
         ModuleSymbol msym = (ModuleSymbol) mdle;
         List<Location> msymlocs = getModuleLocation(locations, msym.name.toString());
         for (Location msymloc : msymlocs) {
-            try {
-                for (JavaFileObject fo : fm.list(msymloc, "", sourceKinds, true)) {
-                    if (fo.getName().endsWith("module-info.java")) {
-                        continue;
-                    }
-                    String binaryName = fm.inferBinaryName(msymloc, fo);
-                    String pn = getPackageName(binaryName);
-                    PackageSymbol psym = syms.enterPackage(msym, names.fromString(pn));
-                    result.add((PackageElement) psym);
+            for (JavaFileObject fo : fmList(msymloc, "", sourceKinds, true)) {
+                if (fo.getName().endsWith("module-info.java")) {
+                    continue;
                 }
-
-            } catch (IOException ioe) {
-                String text = messager.getText("main.file.manager.list", msymloc.getName());
-                throw new ToolException(SYSERR, text, ioe);
+                String binaryName = fm.inferBinaryName(msymloc, fo);
+                String pn = getPackageName(binaryName);
+                PackageSymbol psym = syms.enterPackage(msym, names.fromString(pn));
+                result.add((PackageElement) psym);
             }
         }
         return result;
@@ -727,10 +755,9 @@
 
         Set<PackageElement> packlist = new LinkedHashSet<>();
         cmdLinePackages.forEach((modpkg) -> {
-            ModuleElement mdle = null;
             PackageElement pkg;
             if (modpkg.hasModule()) {
-                mdle = toolEnv.elements.getModuleElement(modpkg.moduleName);
+                ModuleElement mdle = toolEnv.elements.getModuleElement(modpkg.moduleName);
                 pkg = toolEnv.elements.getPackageElement(mdle, modpkg.packageName);
             } else {
                 pkg = toolEnv.elements.getPackageElement(modpkg.toString());
@@ -821,17 +848,12 @@
         }
         String pname = modpkg.packageName;
         for (Location packageLocn : locs) {
-            try {
-                for (JavaFileObject fo : fm.list(packageLocn, pname, sourceKinds, recurse)) {
-                    String binaryName = fm.inferBinaryName(packageLocn, fo);
-                    String simpleName = getSimpleName(binaryName);
-                    if (isValidClassName(simpleName)) {
-                        lb.append(fo);
-                    }
+            for (JavaFileObject fo : fmList(packageLocn, pname, sourceKinds, recurse)) {
+                String binaryName = fm.inferBinaryName(packageLocn, fo);
+                String simpleName = getSimpleName(binaryName);
+                if (isValidClassName(simpleName)) {
+                    lb.append(fo);
                 }
-            } catch (IOException ioe) {
-                String text = messager.getText("main.file.manager.list", pname);
-                throw new ToolException(SYSERR, text, ioe);
             }
         }
         return lb.toList();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties	Thu Mar 23 22:57:03 2017 +0000
@@ -85,10 +85,10 @@
 main.opt.expand.requires.desc=\
     Instructs the tool to expand the set of modules to be\n\
     documented. By default, only the modules given explicitly on\n\
-    the command line will be documented. A value of "transitive" will\n\
-    additionally include all "requires transitive" dependencies of\n\
-    those modules. A value of "all" will include all dependencies\n\
-    of those modules.
+    the command line will be documented. A value of "transitive"\n\
+    will additionally include all "requires transitive"\n\
+    dependencies of those modules. A value of "all" will include\n\
+    all dependencies of those modules.
 
 main.opt.help.desc=\
     Display command line options and exit
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Mar 23 22:57:03 2017 +0000
@@ -618,7 +618,6 @@
         public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.os_name_index);
             out.writeShort(attr.os_arch_index);
-            out.writeShort(attr.os_version_index);
             return null;
         }
 
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java	Thu Mar 23 22:57:03 2017 +0000
@@ -40,7 +40,6 @@
         super(name_index, length);
         os_name_index = cr.readUnsignedShort();
         os_arch_index = cr.readUnsignedShort();
-        os_version_index = cr.readUnsignedShort();
     }
 
     @Override
@@ -50,5 +49,4 @@
 
     public final int os_name_index;
     public final int os_arch_index;
-    public final int os_version_index;
 }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Mar 23 22:57:03 2017 +0000
@@ -680,12 +680,6 @@
             print("// " + getOSArch(attr));
         }
         println();
-        print("os_version: #" + attr.os_version_index);
-        if (attr.os_version_index != 0) {
-            tab();
-            print("// " + getOSVersion(attr));
-        }
-        println();
         indent(-1);
         return null;
     }
@@ -706,14 +700,6 @@
         }
     }
 
-    private String getOSVersion(ModuleTarget_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.os_version_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
     @Override
     public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleAnnotations:");
--- a/test/ProblemList.txt	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/ProblemList.txt	Thu Mar 23 22:57:03 2017 +0000
@@ -54,6 +54,7 @@
 tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java         8057687    generic-all    emit correct byte code an attributes for type annotations
 tools/javac/warnings/suppress/TypeAnnotations.java                              8057683    generic-all    improve ordering of errors with type annotations
 tools/javac/modules/T8159439/NPEForModuleInfoWithNonZeroSuperClassTest.java     8160396    generic-all    current version of jtreg needs a new promotion to include lastes version of ASM
+tools/javac/platform/PlatformProviderTest.java                                  8176801    generic-all    fails due to warnings printed to stderr
 
 ###########################################################################
 #
--- a/test/jdk/javadoc/doclet/testLegacyTaglet/Check.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/jdk/javadoc/doclet/testLegacyTaglet/Check.java	Thu Mar 23 22:57:03 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,6 +24,7 @@
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Set;
+import javax.lang.model.element.Element;
 
 import com.sun.source.doctree.DocTree;
 import jdk.javadoc.doclet.Taglet;
@@ -64,10 +65,11 @@
      * representation.
      *
      * @param tags the array of tags representing this custom tag.
+     * @param element the declaration to which the enclosing comment belongs
      * @return null to test if the javadoc throws an exception or not.
      */
     @Override
-    public String toString(List<? extends DocTree> tags) {
+    public String toString(List<? extends DocTree> tags, Element element) {
         return null;
     }
 }
--- a/test/jdk/javadoc/doclet/testLegacyTaglet/ToDoTaglet.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/jdk/javadoc/doclet/testLegacyTaglet/ToDoTaglet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -24,8 +24,8 @@
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
-
 import java.util.Set;
+import javax.lang.model.element.Element;
 
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.TextTree;
@@ -87,9 +87,10 @@
      * Given an array of <code>Tag</code>s representing this custom
      * tag, return its string representation.
      * @param tags  the array of <code>DocTree</code>s representing this custom tag.
+     * @param element the declaration to which the enclosing comment belongs
      */
     @Override
-    public String toString(List<? extends DocTree> tags) {
+    public String toString(List<? extends DocTree> tags, Element element) {
         if (tags.isEmpty()) {
             return "";
         }
--- a/test/jdk/javadoc/doclet/testLegacyTaglet/UnderlineTaglet.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/jdk/javadoc/doclet/testLegacyTaglet/UnderlineTaglet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -24,6 +24,7 @@
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Set;
+import javax.lang.model.element.Element;
 
 import com.sun.source.doctree.DocTree;
 import jdk.javadoc.doclet.Taglet;
@@ -70,9 +71,10 @@
      * Given the <code>DocTree</code> representation of this custom
      * tag, return its string representation.
      * @param tags the <code>DocTree</code> representation of this custom tag.
+     * @param element the declaration to which the enclosing comment belongs
      */
     @Override
-    public String toString(List<? extends DocTree> tags) {
+    public String toString(List<? extends DocTree> tags, Element element) {
         return "<u>" + ToDoTaglet.getText(tags.get(0)) + "</u>";
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testProperty/TestProperty.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug      8176231
+ * @summary  Test JavaFX property.
+ * @library  ../lib/
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build    JavadocTester TestProperty
+ * @run main TestProperty
+ */
+
+public class TestProperty extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestProperty tester = new TestProperty();
+        tester.runTests();
+    }
+
+    @Test
+    void testArrays() {
+        javadoc("-d", "out",
+                "-javafx",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg/MyClass.html", true,
+                "<pre>public final&nbsp;<a href=\"../pkg/ObjectProperty.html\" "
+                + "title=\"class in pkg\">ObjectProperty</a>"
+                + "&lt;<a href=\"../pkg/MyObj.html\" "
+                + "title=\"class in pkg\">MyObj</a>&gt; goodProperty</pre>\n"
+                + "<div class=\"block\">This is an Object property where the "
+                + "Object is a single Object.</div>\n"
+                + "<dl>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg/MyClass.html#getGood--\"><code>getGood()</code></a>, \n"
+                + "<a href=\"../pkg/MyClass.html#setGood-pkg.MyObj-\">"
+                + "<code>setGood(MyObj)</code></a></dd>\n"
+                + "</dl>",
+
+                "<pre>public final&nbsp;<a href=\"../pkg/ObjectProperty.html\" "
+                + "title=\"class in pkg\">ObjectProperty</a>"
+                + "&lt;<a href=\"../pkg/MyObj.html\" "
+                + "title=\"class in pkg\">MyObj</a>[]&gt; badProperty</pre>\n"
+                + "<div class=\"block\">This is an Object property where the "
+                + "Object is an array.</div>\n"
+                + "<dl>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg/MyClass.html#getBad--\"><code>getBad()</code></a>, \n"
+                + "<a href=\"../pkg/MyClass.html#setBad-pkg.MyObj:A-\">"
+                + "<code>setBad(MyObj[])</code></a></dd>\n"
+                + "</dl>"
+        );
+
+        checkOutput("pkg/MyClassT.html", true,
+                "<pre>public final&nbsp;<a href=\"../pkg/ObjectProperty.html\" "
+                + "title=\"class in pkg\">ObjectProperty</a>"
+                + "&lt;java.util.List&lt;<a href=\"../pkg/MyClassT.html\" "
+                + "title=\"type parameter in MyClassT\">T</a>&gt;&gt; "
+                + "listProperty</pre>\n"
+                + "<div class=\"block\">This is an Object property where the "
+                + "Object is a single <code>List&lt;T&gt;</code>.</div>\n"
+                + "<dl>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg/MyClassT.html#getList--\">"
+                + "<code>getList()</code></a>, \n"
+                + "<a href=\"../pkg/MyClassT.html#setList-java.util.List-\">"
+                + "<code>setList(List)</code></a></dd>\n"
+                + "</dl>"
+        );
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testProperty/pkg/MyClass.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+/**
+ * Test program for javadoc properties.
+ */
+public class MyClass {
+
+    private SimpleObjectProperty<MyObj> good
+            = new SimpleObjectProperty<MyObj>();
+
+    /**
+     * This is an Object property where the Object is a single Object.
+     *
+     * @return the good
+     */
+    public final ObjectProperty<MyObj> goodProperty() {
+        return good;
+    }
+
+    public final void setGood(MyObj good) {
+    }
+
+    public final MyObj getGood() {
+        return good.get();
+    }
+
+
+    private SimpleObjectProperty<MyObj[]> bad
+            = new SimpleObjectProperty<MyObj[]>();
+
+    /**
+     * This is an Object property where the Object is an array.
+     *
+     * @return the bad
+     */
+    public final ObjectProperty<MyObj[]> badProperty() {
+        return bad;
+    }
+
+    public final void setBad(MyObj[] bad) {
+    }
+
+    public final MyObj[] getBad() {
+        return bad.get();
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testProperty/pkg/MyClassT.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,32 @@
+package pkg;
+
+import java.util.List;
+
+//import javafx.beans.property.*;
+
+/**
+ * Test program for javadoc properties.
+ */
+public class MyClassT<T> {
+
+    private SimpleObjectProperty<List<T>> list
+            = new SimpleObjectProperty<List<T>>();
+
+    /**
+     * This is an Object property where the Object is a single {@code List<T>}.
+     *
+     * @return the list
+     */
+    public final ObjectProperty<List<T>> listProperty() {
+        return list;
+    }
+
+    public final void setList(List<T> list) {
+    }
+
+    public final List<T> getList() {
+        return list.get();
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testProperty/pkg/MyObj.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public class MyObj {
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testProperty/pkg/ObjectProperty.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public class ObjectProperty<T> { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testProperty/pkg/SimpleObjectProperty.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public class SimpleObjectProperty<T> { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testUserTaglet/InfoTaglet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.element.Element;
+
+import jdk.javadoc.doclet.Doclet;
+import jdk.javadoc.doclet.DocletEnvironment;
+import jdk.javadoc.doclet.Taglet;
+import static jdk.javadoc.doclet.Taglet.Location.*;
+
+import com.sun.source.doctree.DocTree;
+
+/**
+ * A taglet to test access to a taglet's context.
+ */
+public class InfoTaglet implements Taglet {
+    private DocletEnvironment env;
+    private Doclet doclet;
+
+    @Override
+    public void init(DocletEnvironment env, Doclet doclet) {
+        this.env = env;
+        this.doclet = doclet;
+    }
+
+    @Override
+    public Set<Location> getAllowedLocations() {
+        return EnumSet.of(TYPE);
+    }
+
+    @Override
+    public boolean isInlineTag() {
+        return false;
+    }
+
+    @Override
+    public String getName() {
+        return "info";
+    }
+
+    @Override
+    public String toString(List<? extends DocTree> tags, Element element) {
+        // The content lines below are primarily to help verify the element
+        // and the values passed to init.
+        return "<dt>"
+                +"<span class=\"simpleTagLabel\">Info:</span>\n"
+                + "</dt>"
+                + "<dd>"
+                + "<ul>\n"
+                + "<li>Element: " + element.getKind() + " " + element.getSimpleName() + "\n"
+                + "<li>Element supertypes: " +
+                        env.getTypeUtils().directSupertypes(element.asType()) + "\n"
+                + "<li>Doclet: " + doclet.getClass() + "\n"
+                + "</ul>\n"
+                + "</dd>";
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testUserTaglet/TestUserTaglet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug      8176836
+ * @summary  Provide Taglet with context
+ * @library  ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build    JavadocTester InfoTaglet
+ * @run main TestUserTaglet
+ */
+
+public class TestUserTaglet extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestUserTaglet tester = new TestUserTaglet();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-tagletpath", System.getProperty("test.class.path"),
+                "-taglet", "InfoTaglet",
+                "pkg");
+        checkExit(Exit.OK);
+
+        // The following checks verify that information was successfully
+        // derived from the context information available to the taglet.
+        checkOutput("pkg/C.html", true,
+            "<li>Element: CLASS C",
+            "<li>Element supertypes: [java.lang.Object]",
+            "<li>Doclet: class jdk.javadoc.internal.doclets.formats.html.HtmlDoclet"
+        );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testUserTaglet/pkg/C.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+/** @info */
+public class C { }
+
--- a/test/jdk/javadoc/tool/EnsureNewOldDoclet.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/jdk/javadoc/tool/EnsureNewOldDoclet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -40,6 +40,7 @@
 import java.util.Set;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
+import javax.lang.model.element.Element;
 
 import com.sun.javadoc.Tag;
 import com.sun.source.doctree.DocTree;
@@ -186,7 +187,7 @@
                 "-tagletpath",
                 testClasses,
                 testSrc.toString());
-        Task.Result tr = task.run(Task.Expect.FAIL, 1);
+        Task.Result tr = task.run(Task.Expect.FAIL, 1).writeAll();
         //Task.Result tr = task.run();
         List<String> out = tr.getOutputLines(Task.OutputKind.STDOUT);
         List<String> err = tr.getOutputLines(Task.OutputKind.STDERR);
@@ -358,7 +359,7 @@
         }
 
         @Override
-        public String toString(List<? extends DocTree> tags) {
+        public String toString(List<? extends DocTree> tags, Element element) {
             return tags.toString();
         }
 
--- a/test/jdk/javadoc/tool/api/basic/taglets/UnderlineTaglet.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/jdk/javadoc/tool/api/basic/taglets/UnderlineTaglet.java	Thu Mar 23 22:57:03 2017 +0000
@@ -1,44 +1,30 @@
 /*
  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
  *
- * -Redistributions of source code must retain the above copyright
- *  notice, this list of conditions and the following disclaimer.
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * -Redistribution in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in
- *  the documentation and/or other materials provided with the
- *  distribution.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Neither the name of Oracle nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any
- * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
- * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
- * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
- * DAMAGES OR LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF OR
- * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
- * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE
- * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,
- * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
- * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed, licensed or
- * intended for use in the design, construction, operation or
- * maintenance of any nuclear facility.
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Set;
+import javax.lang.model.element.Element;
 
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.TextTree;
@@ -88,8 +74,9 @@
      * Given the <code>DocTree</code> representation of this custom
      * tag, return its string representation.
      * @param tags the list of trees representing of this custom tag.
+     * @param element the declaration to which the enclosing comment belongs
      */
-    public String toString(List<? extends DocTree> tags) {
+    public String toString(List<? extends DocTree> tags, Element element) {
         return "<u>" + getText(tags.get(0)) + "</u>";
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/tool/modules/MissingSourceModules.java	Thu Mar 23 22:57:03 2017 +0000
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8176481
+ * @summary Tests behavior of the tool, when modules are present as
+ *          binaries.
+ * @modules
+ *      jdk.javadoc/jdk.javadoc.internal.api
+ *      jdk.javadoc/jdk.javadoc.internal.tool
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ * @library /tools/lib
+ * @build toolbox.ToolBox toolbox.TestRunner
+ * @run main MissingSourceModules
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.*;
+
+public class MissingSourceModules extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        new MissingSourceModules().runTests();
+    }
+
+    @Test
+    public void testExplicitBinaryModuleOnModulePath(Path base) throws Exception {
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder ma = new ModuleBuilder(tb, "ma");
+        ma.comment("Module ma.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class A */ public class A { }")
+                .classes("package pkg1.pkg2; /** Class B */ public class B { }")
+                .build(modulePath);
+
+        execNegativeTask("--module-path", modulePath.toString(),
+                "--module", "ma");
+        assertMessagePresent("module ma not found.");
+    }
+
+    @Test
+    public void testExplicitBinaryModuleOnLegacyPaths(Path base) throws Exception {
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder ma = new ModuleBuilder(tb, "ma");
+        ma.comment("Module ma.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class A */ public class A { }")
+                .classes("package pkg1.pkg2; /** Class B */ public class B { }")
+                .build(modulePath);
+
+        Path mPath = Paths.get(modulePath.toString(), "ma");
+        execNegativeTask("--source-path", mPath.toString(),
+                "--module", "ma");
+        assertMessagePresent("module ma not found.");
+
+        execNegativeTask("--class-path", mPath.toString(),
+                "--module", "ma");
+        assertMessagePresent("module ma not found.");
+    }
+
+    @Test
+    public void testImplicitBinaryRequiresModule(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder mb = new ModuleBuilder(tb, "mb");
+        mb.comment("Module mb.")
+                .exports("pkgb")
+                .classes("package pkgb; /** Class A */ public class A { }")
+                .build(modulePath);
+
+        ModuleBuilder ma = new ModuleBuilder(tb, "ma");
+        ma.comment("Module ma.")
+                .exports("pkga")
+                .requires("mb", modulePath)
+                .classes("package pkga; /** Class A */ public class A { }")
+                .write(src);
+
+        execTask("--module-path", modulePath.toString(),
+                "--module-source-path", src.toString(),
+                "--expand-requires", "all",
+                "--module", "ma");
+        assertMessagePresent("module mb not found.");
+    }
+
+    @Test
+    public void testImplicitBinaryTransitiveModule(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder mb = new ModuleBuilder(tb, "mb");
+        mb.comment("Module mb.")
+                .exports("pkgb")
+                .classes("package pkgb; /** Class A */ public class A { }")
+                .build(modulePath);
+
+        ModuleBuilder ma = new ModuleBuilder(tb, "ma");
+        ma.comment("Module ma.")
+                .exports("pkga")
+                .requiresTransitive("mb", modulePath)
+                .classes("package pkga; /** Class A */ public class A { }")
+                .write(src);
+
+        execTask("--module-path", modulePath.toString(),
+                "--module-source-path", src.toString(),
+                "--expand-requires", "transitive",
+                "--module", "ma");
+        assertMessagePresent("module mb not found.");
+    }
+}
--- a/test/jdk/javadoc/tool/modules/Modules.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/jdk/javadoc/tool/modules/Modules.java	Thu Mar 23 22:57:03 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8159305 8166127 8175860
+ * @bug 8159305 8166127 8175860 8176481
  * @summary Tests primarily the module graph computations.
  * @modules
  *      jdk.javadoc/jdk.javadoc.internal.api
@@ -35,7 +35,6 @@
  * @run main Modules
  */
 
-import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -421,6 +420,7 @@
         checkPackagesIncluded("p");
         checkTypesIncluded("p.Main");
         checkPackagesNotIncluded(".*open.*");
+        assertMessageNotPresent("warning");
     }
 
     @Test
@@ -442,9 +442,46 @@
                 "--expand-requires", "transitive");
 
         checkModulesSpecified("M", "N", "O");
+        checkModulesNotSpecified("java.base");
         checkModulesIncluded("M", "N", "O");
+        checkModulesNotIncluded("java.base");
         checkPackagesIncluded("p", "openN", "openO");
         checkTypesIncluded("p.Main", "openN.N", "openO.O");
+        assertMessageNotPresent("warning");
+    }
+
+    @Test
+    public void testExpandRequiresTransitiveWithMandated(Path base) throws Exception {
+        Path src = base.resolve("src");
+
+        createAuxiliaryModules(src);
+
+        Path patchSrc = Paths.get(src.toString(), "patch");
+
+        new ModuleBuilder(tb, "M")
+                .comment("The M module.")
+                .requiresTransitive("N", src)
+                .requires("L", src)
+                .exports("p")
+                .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
+                .write(src);
+
+        // build the patching module
+        tb.writeJavaFiles(patchSrc, "package pkg1;\n" +
+                "/** Class A */ public class A extends java.util.ArrayList { }");
+        tb.writeJavaFiles(patchSrc, "package pkg1;\n"
+                + "/** Class B */ public class B { }");
+
+        execTask("--module-source-path", src.toString(),
+                "--patch-module", "java.base=" + patchSrc.toString(),
+                "--module", "M",
+                "--expand-requires", "transitive");
+
+        checkModulesSpecified("java.base", "M", "N", "O");
+        checkModulesIncluded("java.base", "M", "N", "O");
+        checkPackagesIncluded("p", "openN", "openO");
+        checkTypesIncluded("p.Main", "openN.N", "openO.O");
+        assertMessageNotPresent("warning");
     }
 
     @Test
@@ -466,13 +503,14 @@
                 "--module", "M",
                 "--expand-requires", "all");
 
-        checkModulesSpecified("M", "java.base", "N", "L", "O");
-        checkModulesIncluded("M", "java.base", "N", "L", "O");
+        checkModulesSpecified("M", "N", "L", "O");
+        checkModulesIncluded("M", "N", "L", "O");
         checkModulesNotIncluded("P", "J", "Q");
         checkPackagesIncluded("p", "openN", "openL", "openO");
         checkPackagesNotIncluded(".*openP.*", ".*openJ.*");
         checkTypesIncluded("p.Main", "openN.N", "openL.L", "openO.O");
         checkTypesNotIncluded(".*openP.*", ".*openJ.*");
+        assertMessageNotPresent("warning");
     }
 
     @Test
@@ -577,7 +615,7 @@
         new ModuleBuilder(tb, "L")
                 .comment("The L module.")
                 .exports("openL")
-                . requiresTransitive("P")
+                .requiresTransitive("P")
                 .classes("package openL; /** Class L open */ public class L { }")
                 .classes("package closedL;  /** Class L closed */ public class L { }")
                 .write(src);
@@ -599,7 +637,7 @@
                 .write(src);
 
         new ModuleBuilder(tb, "P")
-                .comment("The O module.")
+                .comment("The P module.")
                 .exports("openP")
                 .requires("J")
                 .classes("package openP; /** Class O open. */ public class O { openJ.J j; }")
--- a/test/jdk/javadoc/tool/modules/PatchModules.java	Thu Mar 23 22:31:14 2017 +0000
+++ b/test/jdk/javadoc/tool/modules/PatchModules.java	Thu Mar 23 22:57:03 2017 +0000
@@ -129,7 +129,6 @@
     // Case B.1: (jsr166) augment and override system module
     @Test
     public void testPatchModuleModifyingSystemModule(Path base) throws Exception {
-        Path src = base.resolve("src");
         Path patchSrc = base.resolve("patch");
 
         // build the patching sources