changeset 3454:3f60a4808377 jdk-9+104

Merge
author lana
date Thu, 28 Jan 2016 15:42:06 -0800
parents 91bf4c9a4806 b5d08bc0d224
children d10e29115134 d3411a81ad65
files src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTaskImpl.java src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java test/tools/javadoc/api/basic/JavadocTaskImplTest.java test/tools/javadoc/api/basic/RunTest.java test/tools/javadoc/doclint/DocLintTest.java test/tools/javadoc/doclint/ImplicitHeadersTest.java
diffstat 1022 files changed, 130645 insertions(+), 1038 deletions(-) [+]
line wrap: on
line diff
--- a/make/CompileInterim.gmk	Thu Jan 28 09:43:12 2016 -0800
+++ b/make/CompileInterim.gmk	Thu Jan 28 15:42:06 2016 -0800
@@ -46,7 +46,7 @@
       $(SUPPORT_OUTPUTDIR)/gensrc/jdk.compiler \
       $(SUPPORT_OUTPUTDIR)/gensrc/jdk.javadoc \
       $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdeps, \
-    EXCLUDES := sun jdk, \
+    EXCLUDES := sun, \
     COPY := .gif .png .xml .css .js javax.tools.JavaCompilerTool, \
     BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_interim_classes, \
     JAR := $(INTERIM_LANGTOOLS_JAR)))
--- a/make/gensrc/Gensrc-jdk.javadoc.gmk	Thu Jan 28 09:43:12 2016 -0800
+++ b/make/gensrc/Gensrc-jdk.javadoc.gmk	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,11 @@
 
 include GensrcCommon.gmk
 
+$(eval $(call SetupVersionProperties,OLD_JAVADOC_VERSION,\
+    com/sun/tools/javadoc/resources/version.properties))
+
 $(eval $(call SetupVersionProperties,JAVADOC_VERSION,\
-    com/sun/tools/javadoc/resources/version.properties))
+    jdk/javadoc/internal/tool/resources/version.properties))
 
 $(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, $(JAVADOC_VERSION)))
 
--- a/make/netbeans/langtools/build.xml	Thu Jan 28 09:43:12 2016 -0800
+++ b/make/netbeans/langtools/build.xml	Thu Jan 28 15:42:06 2016 -0800
@@ -93,7 +93,11 @@
         <macrodef name="resolve-main-class">
           <attribute name="tool.name"/>
           <sequential>
-            <property name="langtools.main.class" value="${tool.@{tool.name}.main.class}"/>
+            <condition property="langtools.main.class"
+                    value="jdk.javadoc.internal.tool.Main"
+                    else="${tool.@{tool.name}.main.class}">
+                <equals arg1="${langtools.tool.name}" arg2="javadoc"/>
+            </condition>
           </sequential>
         </macrodef>
     </target>
--- a/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Thu Jan 28 15:42:06 2016 -0800
@@ -104,7 +104,7 @@
     }
 
     private static final String systemDocumentationToolName
-        = "com.sun.tools.javadoc.api.JavadocTool";
+        = "jdk.javadoc.internal.api.JavadocTool";
 
     /**
      * Returns the Java&trade; programming language documentation tool provided
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Jan 28 15:42:06 2016 -0800
@@ -26,9 +26,7 @@
 package com.sun.tools.javac.code;
 
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 
 import javax.lang.model.element.ElementVisitor;
 import javax.tools.JavaFileObject;
@@ -39,7 +37,6 @@
 import com.sun.tools.javac.code.Symbol.Completer;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Symbol.OperatorSymbol;
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.code.Symbol.TypeSymbol;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
@@ -50,7 +47,6 @@
 import com.sun.tools.javac.code.Type.JCVoidType;
 import com.sun.tools.javac.code.Type.MethodType;
 import com.sun.tools.javac.code.Type.UnknownType;
-import com.sun.tools.javac.jvm.ByteCodes;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
@@ -65,7 +61,6 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
-import static com.sun.tools.javac.jvm.ByteCodes.*;
 import static com.sun.tools.javac.code.TypeTag.*;
 
 /** A class that defines all predefined constants and operators
@@ -193,6 +188,7 @@
     public final Type autoCloseableType;
     public final Type trustMeType;
     public final Type lambdaMetafactory;
+    public final Type stringConcatFactory;
     public final Type repeatableType;
     public final Type documentedType;
     public final Type elementTypeType;
@@ -472,6 +468,7 @@
         trustMeType = enterClass("java.lang.SafeVarargs");
         nativeHeaderType = enterClass("java.lang.annotation.Native");
         lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
+        stringConcatFactory = enterClass("java.lang.invoke.StringConcatFactory");
         functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
 
         synthesizeEmptyInterfaceIfMissing(autoCloseableType);
@@ -479,6 +476,7 @@
         synthesizeEmptyInterfaceIfMissing(serializableType);
         synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
         synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
+        synthesizeEmptyInterfaceIfMissing(stringConcatFactory);
         synthesizeBoxTypeIfMissing(doubleType);
         synthesizeBoxTypeIfMissing(floatType);
         synthesizeBoxTypeIfMissing(voidType);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Thu Jan 28 15:42:06 2016 -0800
@@ -68,6 +68,7 @@
 import java.util.function.Function;
 import java.util.function.Supplier;
 
+import static com.sun.tools.javac.code.TypeTag.ARRAY;
 import static com.sun.tools.javac.code.TypeTag.DEFERRED;
 import static com.sun.tools.javac.code.TypeTag.FORALL;
 import static com.sun.tools.javac.code.TypeTag.METHOD;
@@ -275,7 +276,7 @@
                 res.type != null && res.type.hasTag(FORALL) ||
                 (res.flags() & Flags.VARARGS) != 0 ||
                 (TreeInfo.isStaticSelector(exprTree, tree.name.table.names) &&
-                exprTree.type.isRaw())) {
+                exprTree.type.isRaw() && !exprTree.type.hasTag(ARRAY))) {
             tree.overloadKind = JCMemberReference.OverloadKind.OVERLOADED;
         } else {
             tree.overloadKind = JCMemberReference.OverloadKind.UNOVERLOADED;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jan 28 15:42:06 2016 -0800
@@ -239,7 +239,7 @@
             //this means we are dealing with a partially inferred poly expression
             owntype = shouldCheck ? resultInfo.pt : found;
             if (resultInfo.checkMode.installPostInferenceHook()) {
-                inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt),
+                inferenceContext.addFreeTypeListener(List.of(found),
                         instantiatedContext -> {
                             ResultInfo pendingResult =
                                     resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1812,7 +1812,7 @@
 
             TranslationContext(T tree) {
                 this.tree = tree;
-                this.owner = owner();
+                this.owner = owner(true);
                 this.depth = frameStack.size() - 1;
                 this.prev = context();
                 ClassSymbol csym =
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jan 28 15:42:06 2016 -0800
@@ -25,8 +25,6 @@
 
 package com.sun.tools.javac.jvm;
 
-import java.util.*;
-
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
@@ -45,7 +43,6 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.jvm.ByteCodes.*;
 import static com.sun.tools.javac.jvm.CRTFlags.*;
@@ -69,12 +66,12 @@
     private final TreeMaker make;
     private final Names names;
     private final Target target;
-    private final Map<Type,Symbol> stringBufferAppend;
     private Name accessDollar;
     private final Types types;
     private final Lower lower;
     private final Flow flow;
     private final Annotate annotate;
+    private final StringConcat concat;
 
     /** Format of stackmap tables to be generated. */
     private final Code.StackMapFormat stackMap;
@@ -105,8 +102,9 @@
         make = TreeMaker.instance(context);
         target = Target.instance(context);
         types = Types.instance(context);
+        concat = StringConcat.instance(context);
+
         methodType = new MethodType(null, null, null, syms.methodClass);
-        stringBufferAppend = new HashMap<>();
         accessDollar = names.
             fromString("access" + target.syntheticNameChar());
         flow = Flow.instance(context);
@@ -753,6 +751,18 @@
         }
     }
 
+    public Code getCode() {
+        return code;
+    }
+
+    public Items getItems() {
+        return items;
+    }
+
+    public Env<AttrContext> getAttrEnv() {
+        return attrEnv;
+    }
+
     /** Visitor class for expressions which might be constant expressions.
      *  This class is a subset of TreeScanner. Intended to visit trees pruned by
      *  Lower as long as constant expressions looking for references to any
@@ -1895,25 +1905,7 @@
         OperatorSymbol operator = (OperatorSymbol) tree.operator;
         Item l;
         if (operator.opcode == string_add) {
-            // Generate code to make a string buffer
-            makeStringBuffer(tree.pos());
-
-            // Generate code for first string, possibly save one
-            // copy under buffer
-            l = genExpr(tree.lhs, tree.lhs.type);
-            if (l.width() > 0) {
-                code.emitop0(dup_x1 + 3 * (l.width() - 1));
-            }
-
-            // Load first string and append to buffer.
-            l.load();
-            appendString(tree.lhs);
-
-            // Append all other strings to buffer.
-            appendStrings(tree.rhs);
-
-            // Convert buffer to string.
-            bufferToString(tree.pos());
+            l = concat.makeConcat(tree);
         } else {
             // Generate code for first expression
             l = genExpr(tree.lhs, tree.lhs.type);
@@ -2026,13 +2018,7 @@
     public void visitBinary(JCBinary tree) {
         OperatorSymbol operator = (OperatorSymbol)tree.operator;
         if (operator.opcode == string_add) {
-            // Create a string buffer.
-            makeStringBuffer(tree.pos());
-            // Append all strings to buffer.
-            appendStrings(tree);
-            // Convert buffer to string.
-            bufferToString(tree.pos());
-            result = items.makeStackItem(syms.stringType);
+            result = concat.makeConcat(tree);
         } else if (tree.hasTag(AND)) {
             CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER);
             if (!lcond.isFalse()) {
@@ -2066,67 +2052,7 @@
             result = completeBinop(tree.lhs, tree.rhs, operator);
         }
     }
-//where
-        /** Make a new string buffer.
-         */
-        void makeStringBuffer(DiagnosticPosition pos) {
-            code.emitop2(new_, makeRef(pos, syms.stringBuilderType));
-            code.emitop0(dup);
-            callMethod(
-                    pos, syms.stringBuilderType, names.init, List.<Type>nil(), false);
-        }
 
-        /** Append value (on tos) to string buffer (on tos - 1).
-         */
-        void appendString(JCTree tree) {
-            Type t = tree.type.baseType();
-            if (!t.isPrimitive() && t.tsym != syms.stringType.tsym) {
-                t = syms.objectType;
-            }
-            items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
-        }
-        Symbol getStringBufferAppend(JCTree tree, Type t) {
-            Assert.checkNull(t.constValue());
-            Symbol method = stringBufferAppend.get(t);
-            if (method == null) {
-                method = rs.resolveInternalMethod(tree.pos(),
-                                                  attrEnv,
-                                                  syms.stringBuilderType,
-                                                  names.append,
-                                                  List.of(t),
-                                                  null);
-                stringBufferAppend.put(t, method);
-            }
-            return method;
-        }
-
-        /** Add all strings in tree to string buffer.
-         */
-        void appendStrings(JCTree tree) {
-            tree = TreeInfo.skipParens(tree);
-            if (tree.hasTag(PLUS) && tree.type.constValue() == null) {
-                JCBinary op = (JCBinary) tree;
-                if (op.operator.kind == MTH &&
-                    ((OperatorSymbol) op.operator).opcode == string_add) {
-                    appendStrings(op.lhs);
-                    appendStrings(op.rhs);
-                    return;
-                }
-            }
-            genExpr(tree, tree.type).load();
-            appendString(tree);
-        }
-
-        /** Convert string buffer on tos to string.
-         */
-        void bufferToString(DiagnosticPosition pos) {
-            callMethod(
-                    pos,
-                    syms.stringBuilderType,
-                    names.toString,
-                    List.<Type>nil(),
-                    false);
-        }
 
         /** Complete generating code for operation, with left operand
          *  already on stack.
@@ -2173,8 +2099,8 @@
         }
 
     public void visitTypeCast(JCTypeCast tree) {
+        result = genExpr(tree.expr, tree.clazz.type).load();
         setTypeAnnotationPositions(tree.pos);
-        result = genExpr(tree.expr, tree.clazz.type).load();
         // Additional code is only needed if we cast to a reference type
         // which is not statically a supertype of the expression's type.
         // For basic types, the coerce(...) in genExpr(...) will do
@@ -2191,8 +2117,8 @@
     }
 
     public void visitTypeTest(JCInstanceOf tree) {
+        genExpr(tree.expr, tree.expr.type).load();
         setTypeAnnotationPositions(tree.pos);
-        genExpr(tree.expr, tree.expr.type).load();
         code.emitop2(instanceof_, makeRef(tree.pos(), tree.clazz.type));
         result = items.makeStackItem(syms.booleanType);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,485 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.jvm;
+
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.comp.Resolve;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.*;
+
+import static com.sun.tools.javac.code.Kinds.Kind.MTH;
+import static com.sun.tools.javac.code.TypeTag.DOUBLE;
+import static com.sun.tools.javac.code.TypeTag.LONG;
+import static com.sun.tools.javac.jvm.ByteCodes.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.PLUS;
+import com.sun.tools.javac.jvm.Items.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/** This lowers the String concatenation to something that JVM can understand.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public abstract class StringConcat {
+
+    /**
+     * Maximum number of slots for String Concat call.
+     * JDK's StringConcatFactory does not support more than that.
+     */
+    private static final int MAX_INDY_CONCAT_ARG_SLOTS = 200;
+    private static final char TAG_ARG   = '\u0001';
+    private static final char TAG_CONST = '\u0002';
+
+    protected final Gen gen;
+    protected final Symtab syms;
+    protected final Names names;
+    protected final TreeMaker make;
+    protected final Types types;
+    protected final Map<Type, Symbol> sbAppends;
+    protected final Resolve rs;
+
+    protected static final Context.Key<StringConcat> concatKey = new Context.Key<>();
+
+    public static StringConcat instance(Context context) {
+        StringConcat instance = context.get(concatKey);
+        if (instance == null) {
+            instance = makeConcat(context);
+        }
+        return instance;
+    }
+
+    private static StringConcat makeConcat(Context context) {
+        Target target = Target.instance(context);
+        String opt = Options.instance(context).get("stringConcat");
+        if (target.hasStringConcatFactory()) {
+            if (opt == null) {
+                opt = "indyWithConstants";
+            }
+        } else {
+            if (opt != null && !"inline".equals(opt)) {
+                Assert.error("StringConcatFactory-based string concat is requested on a platform that does not support it.");
+            }
+            opt = "inline";
+        }
+
+        switch (opt) {
+            case "inline":
+                return new Inline(context);
+            case "indy":
+                return new IndyPlain(context);
+            case "indyWithConstants":
+                return new IndyConstants(context);
+            default:
+                Assert.error("Unknown stringConcat: " + opt);
+                throw new IllegalStateException("Unknown stringConcat: " + opt);
+        }
+    }
+
+    protected StringConcat(Context context) {
+        context.put(concatKey, this);
+        gen = Gen.instance(context);
+        syms = Symtab.instance(context);
+        types = Types.instance(context);
+        names = Names.instance(context);
+        make = TreeMaker.instance(context);
+        rs = Resolve.instance(context);
+        sbAppends = new HashMap<>();
+    }
+
+    public abstract Item makeConcat(JCTree.JCAssignOp tree);
+    public abstract Item makeConcat(JCTree.JCBinary tree);
+
+    protected List<JCTree> collectAll(JCTree tree) {
+        return collect(tree, List.nil());
+    }
+
+    protected List<JCTree> collectAll(JCTree.JCExpression lhs, JCTree.JCExpression rhs) {
+        return List.<JCTree>nil()
+                .appendList(collectAll(lhs))
+                .appendList(collectAll(rhs));
+    }
+
+    private List<JCTree> collect(JCTree tree, List<JCTree> res) {
+        tree = TreeInfo.skipParens(tree);
+        if (tree.hasTag(PLUS) && tree.type.constValue() == null) {
+            JCTree.JCBinary op = (JCTree.JCBinary) tree;
+            if (op.operator.kind == MTH &&
+                    ((Symbol.OperatorSymbol) op.operator).opcode == string_add) {
+                return res
+                        .appendList(collect(op.lhs, res))
+                        .appendList(collect(op.rhs, res));
+            }
+        }
+        return res.append(tree);
+    }
+
+    /**
+     * "Legacy" bytecode flavor: emit the StringBuilder.append chains for string
+     * concatenation.
+     */
+    private static class Inline extends StringConcat {
+        public Inline(Context context) {
+            super(context);
+        }
+
+        @Override
+        public Item makeConcat(JCTree.JCAssignOp tree) {
+            // Generate code to make a string builder
+            JCDiagnostic.DiagnosticPosition pos = tree.pos();
+
+            // Create a string builder.
+            newStringBuilder(tree);
+
+            // Generate code for first string, possibly save one
+            // copy under builder
+            Item l = gen.genExpr(tree.lhs, tree.lhs.type);
+            if (l.width() > 0) {
+                gen.getCode().emitop0(dup_x1 + 3 * (l.width() - 1));
+            }
+
+            // Load first string and append to builder.
+            l.load();
+            appendString(tree.lhs);
+
+            // Append all other strings to builder.
+            List<JCTree> args = collectAll(tree.rhs);
+            for (JCTree t : args) {
+                gen.genExpr(t, t.type).load();
+                appendString(t);
+            }
+
+            // Convert builder to string.
+            builderToString(pos);
+
+            return l;
+        }
+
+        @Override
+        public Item makeConcat(JCTree.JCBinary tree) {
+            JCDiagnostic.DiagnosticPosition pos = tree.pos();
+
+            // Create a string builder.
+            newStringBuilder(tree);
+
+            // Append all strings to builder.
+            List<JCTree> args = collectAll(tree);
+            for (JCTree t : args) {
+                gen.genExpr(t, t.type).load();
+                appendString(t);
+            }
+
+            // Convert builder to string.
+            builderToString(pos);
+
+            return gen.getItems().makeStackItem(syms.stringType);
+        }
+
+        private JCDiagnostic.DiagnosticPosition newStringBuilder(JCTree tree) {
+            JCDiagnostic.DiagnosticPosition pos = tree.pos();
+            gen.getCode().emitop2(new_, gen.makeRef(pos, syms.stringBuilderType));
+            gen.getCode().emitop0(dup);
+            gen.callMethod(pos, syms.stringBuilderType, names.init, List.<Type>nil(), false);
+            return pos;
+        }
+
+        private void appendString(JCTree tree) {
+            Type t = tree.type.baseType();
+            if (!t.isPrimitive() && t.tsym != syms.stringType.tsym) {
+                t = syms.objectType;
+            }
+
+            Assert.checkNull(t.constValue());
+            Symbol method = sbAppends.get(t);
+            if (method == null) {
+                method = rs.resolveInternalMethod(tree.pos(), gen.getAttrEnv(), syms.stringBuilderType, names.append, List.of(t), null);
+                sbAppends.put(t, method);
+            }
+
+            gen.getItems().makeMemberItem(method, false).invoke();
+        }
+
+        private void builderToString(JCDiagnostic.DiagnosticPosition pos) {
+            gen.callMethod(pos, syms.stringBuilderType, names.toString, List.<Type>nil(), false);
+        }
+    }
+
+    /**
+     * Base class for indified concatenation bytecode flavors.
+     */
+    private static abstract class Indy extends StringConcat {
+        public Indy(Context context) {
+            super(context);
+        }
+
+        @Override
+        public Item makeConcat(JCTree.JCAssignOp tree) {
+            List<JCTree> args = collectAll(tree.lhs, tree.rhs);
+            Item l = gen.genExpr(tree.lhs, tree.lhs.type);
+            emit(args, tree.type, tree.pos());
+            return l;
+        }
+
+        @Override
+        public Item makeConcat(JCTree.JCBinary tree) {
+            List<JCTree> args = collectAll(tree.lhs, tree.rhs);
+            emit(args, tree.type, tree.pos());
+            return gen.getItems().makeStackItem(syms.stringType);
+        }
+
+        protected abstract void emit(List<JCTree> args, Type type, JCDiagnostic.DiagnosticPosition pos);
+
+        /** Peel the argument list into smaller chunks. */
+        protected List<List<JCTree>> split(List<JCTree> args) {
+            ListBuffer<List<JCTree>> splits = new ListBuffer<>();
+
+            int slots = 0;
+
+            // Need to peel, so that neither call has more than acceptable number
+            // of slots for the arguments.
+            ListBuffer<JCTree> cArgs = new ListBuffer<>();
+            for (JCTree t : args) {
+                int needSlots = (t.type.getTag() == LONG || t.type.getTag() == DOUBLE) ? 2 : 1;
+                if (slots + needSlots >= MAX_INDY_CONCAT_ARG_SLOTS) {
+                    splits.add(cArgs.toList());
+                    cArgs.clear();
+                    slots = 0;
+                }
+                cArgs.add(t);
+                slots += needSlots;
+            }
+
+            // Flush the tail slice
+            if (!cArgs.isEmpty()) {
+                splits.add(cArgs.toList());
+            }
+
+            return splits.toList();
+        }
+    }
+
+    /**
+     * Emits the invokedynamic call to JDK java.lang.invoke.StringConcatFactory,
+     * without handling constants specially.
+     *
+     * We bypass empty strings, because they have no meaning at this level. This
+     * captures the Java language trick to force String concat with e.g. ("" + int)-like
+     * expression. Down here, we already know we are in String concat business, and do
+     * not require these markers.
+     */
+    private static class IndyPlain extends Indy {
+        public IndyPlain(Context context) {
+            super(context);
+        }
+
+        /** Emit the indy concat for all these arguments, possibly peeling along the way */
+        protected void emit(List<JCTree> args, Type type, JCDiagnostic.DiagnosticPosition pos) {
+            List<List<JCTree>> split = split(args);
+
+            for (List<JCTree> t : split) {
+                Assert.check(!t.isEmpty(), "Arguments list is empty");
+
+                ListBuffer<Type> dynamicArgs = new ListBuffer<>();
+                for (JCTree arg : t) {
+                    Object constVal = arg.type.constValue();
+                    if ("".equals(constVal)) continue;
+                    if (arg.type == syms.botType) {
+                        dynamicArgs.add(types.boxedClass(syms.voidType).type);
+                    } else {
+                        dynamicArgs.add(arg.type);
+                    }
+                    gen.genExpr(arg, arg.type).load();
+                }
+
+                doCall(type, pos, dynamicArgs.toList());
+            }
+
+            // More that one peel slice produced: concatenate the results
+            if (split.size() > 1) {
+                ListBuffer<Type> argTypes = new ListBuffer<>();
+                for (int c = 0; c < split.size(); c++) {
+                    argTypes.append(syms.stringType);
+                }
+                doCall(type, pos, argTypes.toList());
+            }
+        }
+
+        /** Produce the actual invokedynamic call to StringConcatFactory */
+        private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, List<Type> dynamicArgTypes) {
+            Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
+                    type,
+                    List.<Type>nil(),
+                    syms.methodClass);
+
+            int prevPos = make.pos;
+            try {
+                make.at(pos);
+
+                List<Type> bsm_staticArgs = List.of(syms.methodHandleLookupType,
+                        syms.stringType,
+                        syms.methodTypeType);
+
+                Symbol bsm = rs.resolveInternalMethod(pos,
+                        gen.getAttrEnv(),
+                        syms.stringConcatFactory,
+                        names.makeConcat,
+                        bsm_staticArgs,
+                        null);
+
+                Symbol.DynamicMethodSymbol dynSym = new Symbol.DynamicMethodSymbol(names.makeConcat,
+                        syms.noSymbol,
+                        ClassFile.REF_invokeStatic,
+                        (Symbol.MethodSymbol)bsm,
+                        indyType,
+                        List.nil().toArray());
+
+                Items.Item item = gen.getItems().makeDynamicItem(dynSym);
+                item.invoke();
+            } finally {
+                make.at(prevPos);
+            }
+        }
+    }
+
+    /**
+     * Emits the invokedynamic call to JDK java.lang.invoke.StringConcatFactory.
+     * This code concatenates all known constants into the recipe, possibly escaping
+     * some constants separately.
+     *
+     * We also bypass empty strings, because they have no meaning at this level. This
+     * captures the Java language trick to force String concat with e.g. ("" + int)-like
+     * expression. Down here, we already know we are in String concat business, and do
+     * not require these markers.
+     */
+    private static final class IndyConstants extends Indy {
+        public IndyConstants(Context context) {
+            super(context);
+        }
+
+        @Override
+        protected void emit(List<JCTree> args, Type type, JCDiagnostic.DiagnosticPosition pos) {
+            List<List<JCTree>> split = split(args);
+
+            for (List<JCTree> t : split) {
+                Assert.check(!t.isEmpty(), "Arguments list is empty");
+
+                StringBuilder recipe = new StringBuilder(t.size());
+                ListBuffer<Type> dynamicArgs = new ListBuffer<>();
+                ListBuffer<Object> staticArgs = new ListBuffer<>();
+
+                for (JCTree arg : t) {
+                    Object constVal = arg.type.constValue();
+                    if ("".equals(constVal)) continue;
+                    if (arg.type == syms.botType) {
+                        // Concat the null into the recipe right away
+                        recipe.append((String) null);
+                    } else if (constVal != null) {
+                        // Concat the String representation of the constant, except
+                        // for the case it contains special tags, which requires us
+                        // to expose it as detached constant.
+                        String a = arg.type.stringValue();
+                        if (a.indexOf(TAG_CONST) != -1 || a.indexOf(TAG_ARG) != -1) {
+                            recipe.append(TAG_CONST);
+                            staticArgs.add(a);
+                        } else {
+                            recipe.append(a);
+                        }
+                    } else {
+                        // Ordinary arguments come through the dynamic arguments.
+                        recipe.append(TAG_ARG);
+                        dynamicArgs.add(arg.type);
+                        gen.genExpr(arg, arg.type).load();
+                    }
+                }
+
+                doCall(type, pos, recipe.toString(), staticArgs.toList(), dynamicArgs.toList());
+            }
+
+            // More that one peel slice produced: concatenate the results
+            // All arguments are assumed to be non-constant Strings.
+            if (split.size() > 1) {
+                ListBuffer<Type> argTypes = new ListBuffer<>();
+                StringBuilder recipe = new StringBuilder();
+                for (int c = 0; c < split.size(); c++) {
+                    argTypes.append(syms.stringType);
+                    recipe.append(TAG_ARG);
+                }
+                doCall(type, pos, recipe.toString(), List.nil(), argTypes.toList());
+            }
+        }
+
+        /** Produce the actual invokedynamic call to StringConcatFactory */
+        private void doCall(Type type, JCDiagnostic.DiagnosticPosition pos, String recipe, List<Object> staticArgs, List<Type> dynamicArgTypes) {
+            Type.MethodType indyType = new Type.MethodType(dynamicArgTypes,
+                    type,
+                    List.<Type>nil(),
+                    syms.methodClass);
+
+            int prevPos = make.pos;
+            try {
+                make.at(pos);
+
+                ListBuffer<Type> constTypes = new ListBuffer<>();
+                ListBuffer<Object> constants = new ListBuffer<>();
+                for (Object t : staticArgs) {
+                    constants.add(t);
+                    constTypes.add(syms.stringType);
+                }
+
+                List<Type> bsm_staticArgs = List.of(syms.methodHandleLookupType,
+                        syms.stringType,
+                        syms.methodTypeType)
+                        .append(syms.stringType)
+                        .appendList(constTypes);
+
+                Symbol bsm = rs.resolveInternalMethod(pos,
+                        gen.getAttrEnv(),
+                        syms.stringConcatFactory,
+                        names.makeConcatWithConstants,
+                        bsm_staticArgs,
+                        null);
+
+                Symbol.DynamicMethodSymbol dynSym = new Symbol.DynamicMethodSymbol(names.makeConcatWithConstants,
+                        syms.noSymbol,
+                        ClassFile.REF_invokeStatic,
+                        (Symbol.MethodSymbol)bsm,
+                        indyType,
+                        List.<Object>of(recipe).appendList(constants).toArray());
+
+                Items.Item item = gen.getItems().makeDynamicItem(dynSym);
+                item.invoke();
+            } finally {
+                make.at(prevPos);
+            }
+        }
+    }
+
+}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Jan 28 15:42:06 2016 -0800
@@ -135,4 +135,10 @@
         return hasInvokedynamic();
     }
 
+    /** Does the target JDK contain StringConcatFactory class?
+     */
+    public boolean hasStringConcatFactory() {
+        return compareTo(JDK1_9) >= 0;
+    }
+
 }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Thu Jan 28 15:42:06 2016 -0800
@@ -179,6 +179,10 @@
     public final Name altMetafactory;
     public final Name dollarThis;
 
+    // string concat
+    public final Name makeConcat;
+    public final Name makeConcatWithConstants;
+
     public final Name.Table table;
 
     public Names(Context context) {
@@ -316,6 +320,10 @@
         lambda = fromString("lambda$");
         metafactory = fromString("metafactory");
         altMetafactory = fromString("altMetafactory");
+
+        // string concat
+        makeConcat = fromString("makeConcat");
+        makeConcatWithConstants = fromString("makeConcatWithConstants");
     }
 
     protected Name.Table createTable(Options options) {
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,11 @@
  */
 
 /**
+<p style="font-style: italic; font-size:larger">
+<b>Note:</b> The declarations in this package have been superseded by those
+in the package {@code jdk.javadoc.doclet}.
+</p>
+
 The Doclet API (also called the Javadoc API) provides a mechanism
 for clients to inspect the source-level structure of programs and
 libraries, including javadoc comments embedded in the source.
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/Taglet.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/Taglet.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,14 @@
 
 /**
  * The interface for a custom tag used by Doclets. A custom
- * tag must implement this interface.  To be loaded and used by
+ * tag must implement this interface.
+ *
+ * <p style="font-style: italic; font-size:larger">
+ * <b>Note:</b> This interface has been superseded by one
+ * in the new package {@code jdk.javadoc.doclet.taglet}.
+ * </p>
+ *
+ * To be loaded and used by
  * doclets at run-time, the taglet must have a static method called
  * <code>register</code> that accepts a {@link java.util.Map} as an
  * argument with the following signature:
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -31,4 +31,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
  */
+
 package com.sun.tools.doclets.formats.html.markup;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +24,7 @@
  */
 
 /**
-    This is the default doclet provided with JDK that produces Javadoc's
-    default HTML-formatted API output.  For more documentation
+    This produces Javadoc's HTML-formatted API output.  For more documentation
     on this doclet, please refer to the link below.
 
     @see <a href="http://www.java.sun.com/javadoc/standard-doclet.html">
@@ -36,4 +35,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
 */
+
 package com.sun.tools.doclets.formats.html;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
 import javax.tools.JavaFileManager;
 
 import com.sun.javadoc.*;
@@ -37,6 +38,7 @@
 import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclets.internal.toolkit.util.VisibleMemberMap.GetterSetter;
 import com.sun.tools.javac.util.StringUtils;
 
 /**
@@ -304,6 +306,13 @@
      */
     public SortedSet<PackageDoc> packages;
 
+    // The following three fields provide caches for use by all instances of VisibleMemberMap.
+    public final Map<ClassDoc, ProgramElementDoc[]> propertiesCache = new HashMap<>();
+    public final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap = new HashMap<>();
+    public final Map<ProgramElementDoc, GetterSetter> getterSetterMap = new HashMap<>();
+
+    public DocFileFactory docFileFactory;
+
     /**
      * Constructor. Constructs the message retriever with resource file.
      */
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -37,4 +37,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
 */
+
 package com.sun.tools.doclets.internal.toolkit.builders;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -53,4 +53,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
 */
+
 package com.sun.tools.doclets.internal.toolkit;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -48,4 +48,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
 */
+
 package com.sun.tools.doclets.internal.toolkit.taglets;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,6 @@
 
 package com.sun.tools.doclets.internal.toolkit.util;
 
-import java.util.Map;
-import java.util.WeakHashMap;
-
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileManager.Location;
 import javax.tools.StandardJavaFileManager;
@@ -45,15 +42,13 @@
  *
  * @since 1.8
  */
-abstract class DocFileFactory {
-    private static final Map<Configuration, DocFileFactory> factories = new WeakHashMap<>();
-
+public abstract class DocFileFactory {
     /**
      * Get the appropriate factory, based on the file manager given in the
      * configuration.
      */
     static synchronized DocFileFactory getFactory(Configuration configuration) {
-        DocFileFactory f = factories.get(configuration);
+        DocFileFactory f = configuration.docFileFactory;
         if (f == null) {
             JavaFileManager fm = configuration.getFileManager();
             if (fm instanceof StandardJavaFileManager) {
@@ -61,7 +56,7 @@
             } else {
                 throw new IllegalStateException();
             }
-            factories.put(configuration, f);
+            configuration.docFileFactory = f;
         }
         return f;
     }
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Thu Jan 28 15:42:06 2016 -0800
@@ -101,9 +101,9 @@
     private final Configuration configuration;
     private final Utils utils;
 
-    private static final Map<ClassDoc, ProgramElementDoc[]> propertiesCache = new HashMap<>();
-    private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap = new HashMap<>();
-    private static final Map<ProgramElementDoc, GetterSetter> getterSetterMap = new HashMap<>();
+    private final Map<ClassDoc, ProgramElementDoc[]> propertiesCache;
+    private final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap;
+    private final Map<ProgramElementDoc, GetterSetter> getterSetterMap;
 
     /**
      * Construct a VisibleMemberMap of the given type for the given
@@ -123,6 +123,9 @@
         this.kind = kind;
         this.configuration = configuration;
         this.utils = configuration.utils;
+        propertiesCache = configuration.propertiesCache;
+        classPropertiesMap = configuration.classPropertiesMap;
+        getterSetterMap = configuration.getterSetterMap;
         new ClassMembers(classdoc, STARTLEVEL).build();
     }
 
@@ -713,7 +716,7 @@
         }
     }
 
-    private class GetterSetter {
+    public class GetterSetter {
         private final ProgramElementDoc getter;
         private final ProgramElementDoc setter;
 
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -31,4 +31,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
 */
+
 package com.sun.tools.doclets.internal.toolkit.util.links;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -32,4 +32,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
 */
+
 package com.sun.tools.doclets.internal.toolkit.util;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/package-info.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,11 @@
  */
 
 /**
+<p style="font-style: italic; font-size:larger">
+<b>Note:</b> The declarations in this package have been superseded by those
+in the new package {@code jdk.javadoc.doclet}.
+</p>
+
     As of JDK version 1.5, replaced by
     {@code com.sun.tools.doclets.internal.toolkit.util}.
 
@@ -32,4 +37,5 @@
     This code and its internal interfaces are subject to change or
     deletion without notice.</b>
 */
+
 package com.sun.tools.doclets;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java	Thu Jan 28 09:43:12 2016 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java	Thu Jan 28 15:42:06 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,7 +103,11 @@
         this(programName, errWriter, warnWriter, noticeWriter, defaultDocletClassName, null);
     }
 
-    Start(String programName,
+    public Start(PrintWriter pw) {
+        this(javadocName, pw, pw, pw, standardDocletClassName);
+    }
+
+    public Start(String programName,
           PrintWriter errWriter,
           PrintWriter warnWriter,
           PrintWriter noticeWriter,
@@ -139,7 +143,7 @@
         this(javadocName, docletParentClassLoader);
     }
 
-    Start() {
+    public Start() {
         this(javadocName);
     }
 
@@ -212,7 +216,7 @@
     /**
      * Main program - external wrapper
      */
-    int begin(String... argv) {
+    public int begin(String... argv) {
         boolean ok = begin(null, argv, Collections.<JavaFileObject> emptySet());
         return ok ? 0 : 1;
     }
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTaskImpl.java	Thu Jan 28 09:43:12 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.javadoc.api;
-
-import com.sun.tools.javac.util.ClientCodeException;
-import java.util.Locale;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javadoc.Start;
-import java.util.Collections;
-
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-
-/**
- * Provides access to functionality specific to the JDK documentation tool,
- * javadoc.
- *
- * <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>
- */
-public class JavadocTaskImpl implements DocumentationTask {
-    private final AtomicBoolean used = new AtomicBoolean();
-
-    private final Context context;
-    private Class<?> docletClass;
-    private Iterable<String> options;
-    private Iterable<? extends JavaFileObject> fileObjects;
-    private Locale locale;
-
-    public JavadocTaskImpl(Context context, Class<?> docletClass,
-            Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) {
-        this.context = context;
-        this.docletClass = docletClass;
-
-        this.options = (options == null) ? Collections.<String>emptySet()
-                : nullCheck(options);
-        this.fileObjects = (fileObjects == null) ? Collections.<JavaFileObject>emptySet()
-                : nullCheck(fileObjects);
-        setLocale(Locale.getDefault());
-    }
-
-    @DefinedBy(Api.COMPILER)
-    public void setLocale(Locale locale) {
-        if (used.get())
-            throw new IllegalStateException();
-        this.locale = locale;
-    }
-
-    @DefinedBy(Api.COMPILER)
-    public Boolean call() {
-        if (!used.getAndSet(true)) {
-            initContext();
-            Start jdoc = new Start(context);
-            try {
-                return jdoc.begin(docletClass, options, fileObjects);
-            } catch (ClientCodeException e) {
-                throw new RuntimeException(e.getCause());
-            }
-        } else {
-            throw new IllegalStateException("multiple calls to method 'call'");
-        }
-    }
-
-    private void initContext() {
-        //initialize compiler's default locale
-        context.put(Locale.class, locale);
-    }
-
-    private static <T> Iterable<T> nullCheck(Iterable<T> items) {
-        for (T item: items) {
-            if (item == null)
-                throw new NullPointerException();
-        }
-        return items;
-    }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Thu Jan 28 09:43:12 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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.javadoc.api;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.Locale;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.lang.model.SourceVersion;
-import javax.tools.DiagnosticListener;
-import javax.tools.DocumentationTool;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-
-import com.sun.tools.javac.api.ClientCodeWrapper;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.file.BaseFileManager;
-import com.sun.tools.javac.util.ClientCodeException;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javadoc.ToolOption;
-
-/**
- * Provides access to functionality specific to the JDK documentation tool,
- * javadoc.
- *
- * <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>
- */
-public class JavadocTool implements DocumentationTool {
-    @Override @DefinedBy(Api.COMPILER)
-    public DocumentationTask getTask(
-            Writer out,
-            JavaFileManager fileManager,
-            DiagnosticListener<? super JavaFileObject> diagnosticListener,
-            Class<?> docletClass,
-            Iterable<String> options,
-            Iterable<? extends JavaFileObject> compilationUnits) {
-        Context context = new Context();
-        return getTask(out, fileManager, diagnosticListener,
-                docletClass, options, compilationUnits, context);
-    }
-
-    public DocumentationTask getTask(
-            Writer out,
-            JavaFileManager fileManager,
-            DiagnosticListener<? super JavaFileObject> diagnosticListener,
-            Class<?> docletClass,
-            Iterable<String> options,
-            Iterable<? extends JavaFileObject> compilationUnits,
-            Context context) {
-        try {
-            ClientCodeWrapper ccw = ClientCodeWrapper.instance(context);
-
-            if (options != null) {
-                for (String option : options)
-                    Objects.requireNonNull(option);
-            }
-
-            if (compilationUnits != null) {
-                compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check
-                for (JavaFileObject cu : compilationUnits) {
-                    if (cu.getKind() != JavaFileObject.Kind.SOURCE) {
-                        final String kindMsg = "All compilation units must be of SOURCE kind";
-                        throw new IllegalArgumentException(kindMsg);
-                    }
-                }
-            }
-
-            if (diagnosticListener != null)
-                context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));
-
-            if (out == null)
-                context.put(Log.outKey, new PrintWriter(System.err, true));
-            else if (out instanceof PrintWriter)
-                context.put(Log.outKey, ((PrintWriter) out));
-            else
-                context.put(Log.outKey, new PrintWriter(out, true));
-
-            if (fileManager == null) {
-                fileManager = getStandardFileManager(diagnosticListener, null, null);
-                if (fileManager instanceof BaseFileManager) {
-                    ((BaseFileManager) fileManager).autoClose = true;
-                }
-            }
-            fileManager = ccw.wrap(fileManager);
-            context.put(JavaFileManager.class, fileManager);
-
-            return new JavadocTaskImpl(context, docletClass, options, compilationUnits);
-        } catch (ClientCodeException ex) {
-            throw new RuntimeException(ex.getCause());
-        }
-    }
-
-    // TODO: used shared static method in JavacFileManager
-    @Override @DefinedBy(Api.COMPILER)
-    public StandardJavaFileManager getStandardFileManager(
-            DiagnosticListener<? super JavaFileObject> diagnosticListener,
-            Locale locale,
-            Charset charset) {
-        Context context = new Context();
-        context.put(Locale.class, locale);
-        if (diagnosticListener != null)
-            context.put(DiagnosticListener.class, diagnosticListener);
-        PrintWriter pw = (charset == null)
-                ? new PrintWriter(System.err, true)
-                : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
-        context.put(Log.outKey, pw);
-        return new JavacFileManager(context, true, charset);
-    }
-
-    @Override @DefinedBy(Api.COMPILER)
-    public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
-        PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
-        PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
-        try {
-            String standardDocletName = "com.sun.tools.doclets.standard.Standard";
-            ClassLoader cl = getClass().getClassLoader();
-            return com.sun.tools.javadoc.Main.execute(
-                    "javadoc", err_pw, err_pw, out_pw, standardDocletName, cl, arguments);
-        } finally {
-            err_pw.flush();
-            out_pw.flush();
-        }
-    }
-
-    @Override @DefinedBy(Api.COMPILER)
-    public Set<SourceVersion> getSourceVersions() {
-        return Collections.unmodifiableSet(
-                EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest()));
-    }
-
-    @Override @DefinedBy(Api.COMPILER)
-    public int isSupportedOption(String option) {
-        if (option == null)
-            throw new NullPointerException();
-        for (ToolOption o: ToolOption.values()) {
-            if (o.opt.equals(option))
-                return o.hasArg ? 1 : 0;
-        }
-        return -1;
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Doclet.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.doclet;
+
+import java.util.ListIterator;
+import java.util.Locale;
+import java.util.Set;
+
+import javax.lang.model.SourceVersion;
+
+/**
+ * The user doclet must implement this interface, as described in the
+ * <a href="package-summary.html#package_description">package description</a>.
+ * Each implementation of a Doclet must provide a public no-argument constructor
+ * to be used by tools to instantiate the doclet. The tool infrastructure will
+ * interact with classes implementing this interface as follows:
+ * <ol>
+ * <li> The tool will create an instance of a doclet using the no-arg constructor
+ *  of the doclet class.
+ * <li> Next, the tool calls the {@link #init init} method with an appropriate locale
+ *  and reporter.
+ * <li> Afterwards, the tool calls {@link #getSupportedOptions getSupportedOptions},
+ * and {@link #getSupportedSourceVersion getSupportedSourceVersion}.
+ * These methods are only called once.
+ * <li> As appropriate, the tool calls the {@link #run run} method on the doclet
+ * object, giving it a DocletEnvironment object, from which the doclet can determine
+ * the elements to be included in the documentation.
+ * </ol>
+ * <p>
+ * If a doclet object is created and used without the above protocol being followed,
+ * then the doclet's behavior is not defined by this interface specification.
+ * <p> To start the doclet, pass {@code -doclet} followed by the fully-qualified
+ * name of the entry point class (i.e. the implementation of this interface) on
+ * the javadoc tool command line.
+ *
+ * @since 9
+ */
+public interface Doclet {
+
+    /**
+     * Initializes this doclet with the given locale and error reporter.
+     * This locale will be used by the reporter and the doclet components.
+     * It is recommended to call this as early as possible, for a
+     * uniform localized user experience,
+     * @param locale the locale to be used
+     * @param reporter the reporter to be used
+     */
+    public void init(Locale locale, Reporter reporter);
+
+    /**
+     * Returns a name identifying the doclet. A name is a simple identifier
+     * without white spaces, as defined in <cite>The Java&trade; Language Specification</cite>,
+     * section 6.2 "Names and Identifiers".
+     * @return name of the Doclet
+     */
+    public abstract String getName();
+
+    /**
+     * Returns all the supported options.
+     *
+     * @return a Set containing all the supported options, an empty set if none.
+     */
+    public Set<Option> getSupportedOptions();
+
+    /**
+     * Returns the version of the Java Programming Language supported
+     * by this doclet.
+     *
+     * @return  the language version supported by this doclet, usually
+     * the latest version.
+     */
+    public SourceVersion getSupportedSourceVersion();
+
+    /**
+     * The entry point of the doclet. Further processing will commence as
+     * instructed by this method.
+     *
+     * @param environment from which essential information can be extracted
+     * @return true on success
+     */
+    public boolean run(DocletEnvironment environment);
+
+    /**
+     * An encapsulation of option name, aliases, parameters and descriptions
+     * as used by the Doclet.
+     */
+    interface Option {
+        /**
+         * Returns the number of arguments, this option will consume.
+         * @return number of consumed arguments
+         */
+        int getArgumentCount();
+
+        /**
+         * Returns the description of the option. For instance, the option "group", would
+         * return the synopsis of the option such as, "groups the documents".
+         * @return description if set, otherwise an empty String
+         */
+        String getDescription();
+
+        /**
+         * Returns the option kind.
+         * @return the kind of this option
+         */
+        Option.Kind getKind();
+
+        /**
+         * Returns the option name. For instance for option "-group", will return "group"
+         * @return name of the option, if set, otherwise an empty String
+         */
+        String getName();
+
+        /**
+         * Returns the parameters of the option. For instance "name &lt;p1&gt;:&lt;p2&gt;.."
+         * @return parameters if set, otherwise an empty String
+         */
+        String getParameters();
+
+        /**
+         * Checks if the given option name is handled by this option.
+         * @param option the option name with or without the leading "-"
+         * @return true if same
+         */
+        boolean matches(String option);
+
+        /**
+         * Processes the option and arguments as needed. This method will
+         * be invoked if the given option name matches the option.
+         * @param option the option
+         * @param arguments a ListIterator encapsulating the arguments
+         * @return true if operation succeeded, false otherwise
+         */
+        boolean process(String option, ListIterator<String> arguments);
+
+        /**
+         * The kind of an option.
+         */
+        public static enum Kind {
+            /** an extended option, such as those prefixed with -X */
+            EXTENDED,
+            /** a standard option */
+            STANDARD,
+            /** an implementation reserved option */
+            OTHER;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/DocletEnvironment.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.doclet;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+import javax.tools.JavaFileManager;
+
+import com.sun.source.util.DocTrees;
+
+/**
+ * Represents the operating environment of a single invocation
+ * of the doclet. This object can be used to access the program
+ * structures, various utilities and the user specified elements
+ * on the command line.
+ *
+ * @since 9
+ */
+public interface DocletEnvironment {
+    /**
+     * Returns the <a href="package-summary.html#included">included</a>
+     * classes, interfaces and enums in all packages.
+     *
+     * @return a Set containing {@link javax.lang.model.element.TypeElement TypeElements}.
+     */
+    Set<TypeElement> getIncludedClasses();
+
+    /**
+     * Returns an instance of the {@code DocTrees} utility class.
+     * This class provides methods to access {@code TreePath}s, {@code DocCommentTree}s
+     * and so on.
+     * @return a utility class to operate on doc trees.
+     */
+    DocTrees getDocTrees();
+
+    /**
+     * Returns an instance of the {@code Elements} utility class.
+     * This class provides methods for operating on
+     * {@link javax.lang.model.element.Element elements}.
+     * @return a utility class to operate on elements
+     */
+    Elements getElementUtils();
+
+    /**
+     * Returns the selected elements that can be documented.
+     *
+     * @param elements those that need to be checked
+     * @return elements selected, an empty list if none.
+     */
+    List<Element> getSelectedElements(List<? extends Element> elements);
+
+    /**
+     * Returns the elements <a href="package-summary.html#included">specified</a>
+     * on the command line, usually PackageElements and TypeElements.
+     * If {@code -subpackages} and {@code -exclude} options
+     * are used, return all the non-excluded packages.
+     *
+     * @return elements specified on the command line.
+     */
+    Set<Element> getSpecifiedElements();
+
+    /**
+     * Returns an instance of the {@code Types} utility class.
+     * This class provides methods for operating on
+     * {@link javax.lang.model.type.TypeMirror type mirrors}.
+     * @return a utility class to operate on type mirrors
+     */
+    Types getTypeUtils();
+
+    /**
+     * Indicates if an element is <a href="package-summary.html#included">included</a>.
+     *
+     * @param e the Element in question
+     * @return true if included, false otherwise
+     */
+    boolean isIncluded(Element e);
+
+    /**
+     * Returns the file manager used to read and write files.
+     *
+     * @return the file manager used to read and write files
+     */
+    JavaFileManager getJavaFileManager();
+
+    /**
+     * Returns the source version of the source files that were read.
+     *
+     * @return the source version
+     */
+    SourceVersion getSourceVersion();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Reporter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.doclet;
+
+import javax.lang.model.element.Element;
+import javax.tools.Diagnostic;
+
+import com.sun.source.util.DocTreePath;
+
+/**
+ * This interface provides error, warning and notice reporting.
+ *
+ * @since 9
+ */
+public interface Reporter {
+
+    /**
+     * Print error message and increment error count.
+     *
+     * @param kind specify the diagnostic kind
+     * @param msg message to print
+     */
+    void print(Diagnostic.Kind kind, String msg);
+
+    /**
+     * Print an error message and increment error count.
+     *
+     * @param kind specify the diagnostic kind
+     * @param path the DocTreePath of item where the error occurs
+     * @param msg message to print
+     */
+    void print(Diagnostic.Kind kind, DocTreePath path, String msg);
+
+    /**
+     * Print an error message and increment error count.
+     *
+     * @param kind specify the diagnostic kind
+     * @param e the Element for which  the error occurs
+     * @param msg message to print
+     */
+    void print(Diagnostic.Kind kind, Element e, String msg);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/**
+ * The Doclet API provides an environment which, in conjunction with
+ * the Language Model API and Compiler Tree API, allows clients
+ * to inspect the source-level structures of programs and
+ * libraries, including javadoc comments embedded in the source.
+ *
+ * <p style="font-style: italic">
+ * <b>Note:</b> The declarations in this package supersede those
+ * in the older package {@code com.sun.javadoc}. For details on the
+ * mapping of old types to new types, see the
+ * <a href="#migration">Migration Guide</a>.
+ * </p>
+ *
+ * <p>
+ * Doclets are invoked by javadoc and this API can be used to write out
+ * program information to files.  For example, the standard doclet is
+ * invoked by default, to generate HTML documentation.
+ * <p>
+
+ * The invocation is defined by the interface {@link jdk.javadoc.doclet.Doclet}
+ * -- the {@link jdk.javadoc.doclet.Doclet#run(DocletEnvironment) run} interface
+ * method, defines the entry point.
+ * <pre>
+ *    public boolean <b>run</b>(DocletEnvironment environment)
+ * </pre>
+ * The {@link jdk.javadoc.doclet.DocletEnvironment} instance holds the environment that the
+ * doclet will be initialized with. From this environment all other information can be
+ * extracted, in the form of {@link javax.lang.model} elements. One can further use the
+ * APIs and utilities described by {@link javax.lang.model} to query Elements and Types.
+ * <p>
+ *
+ * <a name="terminology"></a>
+ * <h3>Terminology</h3>
+ *
+ * <a name="included"></a>
+ * When calling javadoc, one can pass in package names and source file names --
+ * these are called the <em>specified</em> PackageElements and TypeElements.
+ * Javadoc options are also passed in; the <em>access control</em> Javadoc options
+ * ({@code -public}, {@code -protected}, {@code -package},
+ * and {@code -private}) are used to filter program elements, producing a
+ * result set, called the <em>included</em> set, or "selected" set.
+ * <p>
+
+ * <a name="qualified"></a>
+ * A <em>qualified</em> element name is one that has its package
+ * name prepended to it, such as {@code java.lang.String}.  A non-qualified
+ * name has no package name, such as {@code String}.
+ * <p>
+ *
+ * <a name="example"></a>
+ * <h3>Example</h3>
+ *
+ * The following is an example doclet that displays information of a class
+ * and its members, supporting an option "someoption".
+ * <pre>
+ * import com.sun.source.doctree.DocCommentTree;
+ * import com.sun.source.util.DocTrees;
+ * import java.io.IOException;
+ * import java.util.Collections;
+ * import java.util.Set;
+ * import javax.lang.model.SourceVersion;
+ * import javax.lang.model.element.Element;
+ * import javax.lang.model.element.TypeElement;
+ * import jdk.javadoc.doclet.*;
+ *
+ * public class Example implements Doclet {
+ *
+ *     &#64;Override
+ *     public void init(Locale locale, Reporter reporter) {
+ *        return;
+ *     }
+ *
+ *     &#64;Override
+ *     public boolean run(RootDoc root) {
+ *         // cache the DocTrees utility class to access DocComments
+ *         DocTrees docTrees = root.getDocTrees();
+ *
+ *         // location of an element in the same directory as overview.html
+ *         try {
+ *             Element barElement = null;
+ *             for (Element e : root.getIncludedClasses()) {
+ *                 if (e.getSimpleName().toString().equals("FooBar")) {
+ *                     barElement = e;
+ *                 }
+ *             }
+ *             DocCommentTree docCommentTree =
+ *                     docTrees.getDocCommentTree(barElement, "overview.html");
+ *             if (docCommentTree != null) {
+ *                 System.out.println("Overview html: " +
+ *                         docCommentTree.getFullBody());
+ *             }
+ *         } catch (IOException missing) {
+ *             System.err.println("No overview.html found.");
+ *         }
+ *
+ *         for (TypeElement t : root.getIncludedClasses()) {
+ *             System.out.println(t.getKind() + ":" + t);
+ *             for (Element e : t.getEnclosedElements()) {
+ *                 DocCommentTree docCommentTree = docTrees.getDocCommentTree(e);
+ *                 if (docCommentTree != null) {
+ *                     System.out.println("Element (" + e.getKind() + ": " +
+ *                             e + ") has the following comments:");
+ *                     System.out.println("Entire body: " + docCommentTree.getFullBody());
+ *                     System.out.println("Block tags: " + docCommentTree.getBlockTags());
+ *                 } else {
+ *                     System.out.println("no comment.");
+ *                 }
+ *             }
+ *         }
+ *         return true;
+ *     }
+ *
+ *     &#64;Override
+ *     public String getName() {
+ *         return "Example";
+ *     }
+ *
+ *   private String someOption;
+ *
+ *   &#64;Override
+ *   public Set&lt;Option&gt; getSupportedOptions() {
+ *       Option[] options = {
+ *           new Option() {
+ *               public int getArgumentCount() {
+ *                   return 1;
+ *               }
+ *               public String getDescription() {
+ *                   return "someoption";
+ *               }
+ *               public Option.Kind getKind() {
+ *                   return Option.Kind.STANDARD;
+ *               }
+ *               public String getName() {
+ *                   return "someoption";
+ *               }
+ *               public String getParameters() {
+ *                   return "url";
+ *               }
+ *               public boolean matches(String option) {
+ *                  String opt = option.startsWith("-") ? option.substring(1) : option;
+ *                  return getName().equals(opt);
+ *               }
+ *               public boolean process(String option, ListIterator&lt;String&gt; arguments) {
+ *                  overviewpath = arguments.next();
+ *                  return true;
+ *               }
+ *          }
+ *      };
+ *      return new HashSet&lt;Option&gt;(Arrays.asList(options));
+ *     }
+ *
+ *     &#64;Override
+ *     public SourceVersion getSupportedSourceVersion() {
+ *         // support the latest release
+ *         return SourceVersion.latest();
+ *     }
+ * }
+ * </pre>
+ * <p>
+ * This doclet when invoked with a command line, such as:
+ * <pre>
+ *     javadoc -doclet Example -sourcepath &lt;source-location&gt;
+ * </pre>
+ * will produce an output, such as:
+ * <pre>
+ *  Overview.html: overview comments
+ *  ...
+ *  ...
+ *  CLASS: SomeKlass
+ *  .....
+ *  Element (METHOD: main(java.lang.String...)) has the following comments:
+ *  Entire body: The main entry point.
+ *  Block tags: @param an array of Strings
+ *  ...
+ * </pre>
+ *
+ * <h3><a name="migration">Migration Guide</a></h3>
+ *
+ * <p>Many of the types in the old {@code com.sun.javadoc} API do not have equivalents in this
+ * package. Instead, types in the {@code javax.lang.model} and {@code com.sun.source} APIs
+ * are used instead.
+ *
+ * <p>The following table gives a guide to the mapping from old types to their replacements.
+ * In some cases, there is no direct equivalent.
+ *
+ * <table style="font-family: monospace" border=1>
+    <caption>Guide for mapping old types to new types</caption>
+    <tr><th>Old Type<th>New Type
+    <tr><td>AnnotatedType<td>javax.lang.model.type.Type
+    <tr><td>AnnotationDesc<td>javax.lang.model.element.AnnotationMirror
+    <tr><td>AnnotationDesc.ElementValuePair<td>javax.lang.model.element.AnnotationValue
+    <tr><td>AnnotationTypeDoc<td>javax.lang.model.element.TypeElement
+    <tr><td>AnnotationTypeElementDoc<td>javax.lang.model.element.ExecutableElement
+    <tr><td>AnnotationValue<td>javax.lang.model.element.AnnotationValue
+    <tr><td>ClassDoc<td>javax.lang.model.element.TypeElement
+    <tr><td>ConstructorDoc<td>javax.lang.model.element.ExecutableElement
+    <tr><td>Doc<td>javax.lang.model.element.Element
+    <tr><td>DocErrorReporter<td>jdk.javadoc.doclet.Reporter
+    <tr><td>Doclet<td>jdk.javadoc.doclet.Doclet
+    <tr><td>ExecutableMemberDoc<td>javax.lang.model.element.ExecutableElement
+    <tr><td>FieldDoc<td>javax.lang.model.element.VariableElement
+    <tr><td>LanguageVersion<td>javax.lang.model.SourceVersion
+    <tr><td>MemberDoc<td>javax.lang.model.element.Element
+    <tr><td>MethodDoc<td>javax.lang.model.element.ExecutableElement
+    <tr><td>PackageDoc<td>javax.lang.model.element.PackageElement
+    <tr><td>Parameter<td>javax.lang.model.element.VariableElement
+    <tr><td>ParameterizedType<td>javax.lang.model.type.DeclaredType
+    <tr><td>ParamTag<td>com.sun.source.doctree.ParamTree
+    <tr><td>ProgramElementDoc<td>javax.lang.model.element.Element
+    <tr><td>RootDoc<td>jdk.javadoc.doclet.DocletEnvironment
+    <tr><td>SeeTag<td>com.sun.source.doctree.LinkTree<br>com.sun.source.doctree.SeeTree
+    <tr><td>SerialFieldTag<td>com.sun.source.doctree.SerialFieldTree
+    <tr><td>SourcePosition<td>com.sun.source.util.SourcePositions
+    <tr><td>Tag<td>com.sun.source.doctree.DocTree
+    <tr><td>ThrowsTag<td>com.sun.source.doctree.ThrowsTree
+    <tr><td>Type<td>javax.lang.model.type.Type
+    <tr><td>TypeVariable<td>javax.lang.model.type.TypeVariable
+    <tr><td>WildcardType<td>javax.lang.model.type.WildcardType
+ * </table>
+ *
+ * @see jdk.javadoc.doclet.Doclet
+ * @see jdk.javadoc.doclet.DocletEnvironment
+ * @since 9
+*/
+
+package jdk.javadoc.doclet;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/Taglet.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.doclet.taglet;
+
+import java.util.List;
+import java.util.Set;
+
+import com.sun.source.doctree.DocTree;
+
+/**
+ * The interface for a custom tag used by Doclets. A custom
+ * tag must implement this interface, and must have a public
+ * default constructor (i.e. a public constructor with no
+ * parameters), by which, the doclet will instantiate and
+ * register the custom tag.
+ *
+ * @since 9
+ */
+
+public interface Taglet {
+
+    /**
+     * Returns the set of locations in which a taglet may be used.
+     * @return the set of locations in which a taglet may be used
+     * allowed in or an empty set.
+     */
+    Set<Location> getAllowedLocations();
+
+    /**
+     * Indicates the tag is an inline or a body tag.
+     * @return true if this <code>Taglet</code>
+     * is an inline tag, false otherwise.
+     */
+    public abstract boolean isInlineTag();
+
+    /**
+     * Returns the name of the tag.
+     * @return the name of this custom tag.
+     */
+    public abstract String getName();
+
+    /**
+     * Given the {@link DocTree DocTree} representation of this custom
+     * tag, return its string representation, which is output
+     * to the generated page.
+     * @param tag the <code>Tag</code> representation of this custom tag.
+     * @return the string representation of this <code>Tag</code>.
+     */
+    public abstract String toString(DocTree tag);
+
+    /**
+     * Given a List of {@link DocTree DocTrees} representing this custom
+     * tag, return its string representation, which is output
+     * to the generated page.  This method should
+     * return null if this taglet represents an inline or body tag.
+     * @param tags the list of <code>DocTree</code>s representing this custom tag.
+     * @return the string representation of this <code>Tag</code>.
+     */
+    public abstract String toString(List<? extends DocTree> tags);
+
+    /**
+     * The kind of location.
+     */
+    public static enum Location {
+        /** In an Overview document. */
+        OVERVIEW,
+        /** In the documentation for a package. */
+        PACKAGE,
+        /** In the documentation for a class, interface or enum. */
+        TYPE,
+        /** In the documentation for a constructor. */
+        CONSTRUCTOR,
+        /** In the documentation for a method. */
+        METHOD,
+        /** In the documentation for a field. */
+        FIELD
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/package-info.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * The Taglet API provides a way to declare custom tags that can be
+ * used by the standard doclet.
+ *
+ * <p style="font-style: italic">
+ * <b>Note:</b> The declarations in this package supersede those
+ * in the older package {@code com.sun.tools.doclets}.
+ * </p>
+ *
+ * @since 9
+ */
+package jdk.javadoc.doclet.taglet;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTaskImpl.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.api;
+
+import java.util.Collections;
+import java.util.Locale;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.tools.DocumentationTool.DocumentationTask;
+import javax.tools.JavaFileObject;
+
+import com.sun.tools.javac.util.ClientCodeException;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+import jdk.javadoc.internal.tool.Start;
+
+/**
+ * Provides access to functionality specific to the JDK documentation tool,
+ * javadoc.
+ *
+ * <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>
+ */
+public class JavadocTaskImpl implements DocumentationTask {
+    private final AtomicBoolean used = new AtomicBoolean();
+
+    private final Context context;
+    private Class<?> docletClass;
+    private Iterable<String> options;
+    private Iterable<? extends JavaFileObject> fileObjects;
+    private Locale locale;
+
+    public JavadocTaskImpl(Context context, Class<?> docletClass,
+            Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) {
+        this.context = context;
+        this.docletClass = docletClass;
+
+        this.options = (options == null) ? Collections.<String>emptySet()
+                : nullCheck(options);
+        this.fileObjects = (fileObjects == null) ? Collections.<JavaFileObject>emptySet()
+                : nullCheck(fileObjects);
+        setLocale(Locale.getDefault());
+    }
+
+    @DefinedBy(Api.COMPILER)
+    public void setLocale(Locale locale) {
+        if (used.get())
+            throw new IllegalStateException();
+        this.locale = locale;
+    }
+
+    @DefinedBy(Api.COMPILER)
+    public Boolean call() {
+        if (!used.getAndSet(true)) {
+            initContext();
+            Start jdoc = new Start(context);
+            try {
+                return jdoc.begin(docletClass, options, fileObjects);
+            } catch (ClientCodeException e) {
+                throw new RuntimeException(e.getCause());
+            }
+        } else {
+            throw new IllegalStateException("multiple calls to method 'call'");
+        }
+    }
+
+    private void initContext() {
+        //initialize compiler's default locale
+        context.put(Locale.class, locale);
+    }
+
+    private static <T> Iterable<T> nullCheck(Iterable<T> items) {
+        for (T item: items) {
+            if (item == null)
+                throw new NullPointerException();
+        }
+        return items;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.api;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.Set;
+
+import javax.lang.model.SourceVersion;
+import javax.tools.DiagnosticListener;
+import javax.tools.DocumentationTool;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.tools.javac.api.ClientCodeWrapper;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.file.BaseFileManager;
+import com.sun.tools.javac.util.ClientCodeException;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+import com.sun.tools.javac.util.Log;
+import jdk.javadoc.internal.tool.ToolOption;
+
+/**
+ * Provides access to functionality specific to the JDK documentation tool,
+ * javadoc.
+ *
+ * <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>
+ */
+public class JavadocTool implements DocumentationTool {
+    @Override @DefinedBy(Api.COMPILER)
+    public DocumentationTask getTask(
+            Writer out,
+            JavaFileManager fileManager,
+            DiagnosticListener<? super JavaFileObject> diagnosticListener,
+            Class<?> docletClass,
+            Iterable<String> options,
+            Iterable<? extends JavaFileObject> compilationUnits) {
+        Context context = new Context();
+        return getTask(out, fileManager, diagnosticListener,
+                docletClass, options, compilationUnits, context);
+    }
+
+    public DocumentationTask getTask(
+            Writer out,
+            JavaFileManager fileManager,
+            DiagnosticListener<? super JavaFileObject> diagnosticListener,
+            Class<?> docletClass,
+            Iterable<String> options,
+            Iterable<? extends JavaFileObject> compilationUnits,
+            Context context) {
+        try {
+            ClientCodeWrapper ccw = ClientCodeWrapper.instance(context);
+
+            if (options != null) {
+                for (String option : options)
+                    Objects.requireNonNull(option);
+            }
+
+            if (compilationUnits != null) {
+                compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check
+                for (JavaFileObject cu : compilationUnits) {
+                    if (cu.getKind() != JavaFileObject.Kind.SOURCE) {
+                        final String kindMsg = "All compilation units must be of SOURCE kind";
+                        throw new IllegalArgumentException(kindMsg);
+                    }
+                }
+            }
+
+            if (diagnosticListener != null)
+                context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));
+
+            if (out == null)
+                context.put(Log.outKey, new PrintWriter(System.err, true));
+            else if (out instanceof PrintWriter)
+                context.put(Log.outKey, ((PrintWriter) out));
+            else
+                context.put(Log.outKey, new PrintWriter(out, true));
+
+            if (fileManager == null) {
+                fileManager = getStandardFileManager(diagnosticListener, null, null);
+                if (fileManager instanceof BaseFileManager) {
+                    ((BaseFileManager) fileManager).autoClose = true;
+                }
+            }
+            fileManager = ccw.wrap(fileManager);
+            context.put(JavaFileManager.class, fileManager);
+
+            return new JavadocTaskImpl(context, docletClass, options, compilationUnits);
+        } catch (ClientCodeException ex) {
+            throw new RuntimeException(ex.getCause());
+        }
+    }
+
+    // TODO: used shared static method in JavacFileManager
+    @Override @DefinedBy(Api.COMPILER)
+    public StandardJavaFileManager getStandardFileManager(
+            DiagnosticListener<? super JavaFileObject> diagnosticListener,
+            Locale locale,
+            Charset charset) {
+        Context context = new Context();
+        context.put(Locale.class, locale);
+        if (diagnosticListener != null)
+            context.put(DiagnosticListener.class, diagnosticListener);
+        PrintWriter pw = (charset == null)
+                ? new PrintWriter(System.err, true)
+                : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
+        context.put(Log.outKey, pw);
+        return new JavacFileManager(context, true, charset);
+    }
+
+    @Override @DefinedBy(Api.COMPILER)
+    public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
+        PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
+        PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
+        try {
+            return jdk.javadoc.internal.tool.Main.execute(arguments, err_pw);
+        } finally {
+            err_pw.flush();
+            out_pw.flush();
+        }
+    }
+
+    @Override @DefinedBy(Api.COMPILER)
+    public Set<SourceVersion> getSourceVersions() {
+        return Collections.unmodifiableSet(
+                EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest()));
+    }
+
+    @Override @DefinedBy(Api.COMPILER)
+    public int isSupportedOption(String option) {
+        if (option == null)
+            throw new NullPointerException();
+        for (ToolOption o: ToolOption.values()) {
+            if (o.opt.equals(option))
+                return o.hasArg ? 1 : 0;
+        }
+        return -1;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.util.List;
+
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+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.TypeMirror;
+import javax.lang.model.type.TypeVariable;
+import javax.lang.model.util.SimpleTypeVisitor9;
+
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
+
+import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.*;
+
+/**
+ * Print method and constructor info.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Robert Field
+ * @author Atul M Dambalkar
+ * @author Bhavesh Patel (Modified)
+ */
+public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
+
+    public AbstractExecutableMemberWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
+        super(writer, typeElement);
+    }
+
+    public AbstractExecutableMemberWriter(SubWriterHolderWriter writer) {
+        super(writer);
+    }
+
+    /**
+     * Add the type parameters for the executable member.
+     *
+     * @param member the member to write type parameters for.
+     * @param htmltree the content tree to which the parameters will be added.
+     */
+    protected void addTypeParameters(ExecutableElement member, Content htmltree) {
+        Content typeParameters = getTypeParameters(member);
+        if (!typeParameters.isEmpty()) {
+            htmltree.addContent(typeParameters);
+            htmltree.addContent(writer.getSpace());
+        }
+    }
+
+    /**
+     * Get the type parameters for the executable member.
+     *
+     * @param member the member for which to get the type parameters.
+     * @return the type parameters.
+     */
+    protected Content getTypeParameters(ExecutableElement member) {
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, MEMBER_TYPE_PARAMS, member);
+        return writer.getTypeParameterLinks(linkInfo);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Content getDeprecatedLink(Element member) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(utils.getFullyQualifiedName(member));
+        if (!utils.isConstructor(member)) {
+            sb.append(".");
+            sb.append(member.getSimpleName().toString());
+        }
+        sb.append(utils.flatSignature((ExecutableElement) member));
+
+        return writer.getDocLink(MEMBER, member, sb.toString());
+    }
+
+    /**
+     * Add the summary link for the member.
+     *
+     * @param context the id of the context where the link will be printed
+     * @param te the classDoc that we should link to
+     * @param member the member being linked to
+     * @param tdSummary the content tree to which the link will be added
+     */
+    @Override
+    protected void addSummaryLink(LinkInfoImpl.Kind context, TypeElement te, Element member,
+            Content tdSummary) {
+        ExecutableElement ee = (ExecutableElement)member;
+        Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
+                writer.getDocLink(context, te, ee,
+                name(ee), false));
+        Content code = HtmlTree.CODE(memberLink);
+        addParameters(ee, false, code, name(ee).length() - 1);
+        tdSummary.addContent(code);
+    }
+
+    /**
+     * Add the inherited summary link for the member.
+     *
+     * @param te the type element that we should link to
+     * @param member the member being linked to
+     * @param linksTree the content tree to which the link will be added
+     */
+    @Override
+    protected void addInheritedSummaryLink(TypeElement te, Element member, Content linksTree) {
+        linksTree.addContent(writer.getDocLink(MEMBER, te, member, name(member), false));
+    }
+
+    /**
+     * Add the parameter for the executable member.
+     *
+     * @param member the member to write parameter for.
+     * @param param the parameter that needs to be written.
+     * @param isVarArg true if this is a link to var arg.
+     * @param tree the content tree to which the parameter information will be added.
+     */
+    protected void addParam(ExecutableElement member, VariableElement param,
+            boolean isVarArg, Content tree) {
+        Content link = writer.getLink(new LinkInfoImpl(configuration, EXECUTABLE_MEMBER_PARAM,
+                param.asType()).varargs(isVarArg));
+        tree.addContent(link);
+        if(name(param).length() > 0) {
+            tree.addContent(writer.getSpace());
+            tree.addContent(name(param));
+        }
+    }
+
+    /**
+     * Add the receiver annotations information.
+     *
+     * @param member the member to write receiver annotations for.
+     * @param rcvrType the receiver type.
+     * @param descList list of annotation description.
+     * @param tree the content tree to which the information will be added.
+     */
+    protected void addReceiverAnnotations(ExecutableElement member, TypeMirror rcvrType,
+            List<? extends AnnotationMirror> annotationMirrors, Content tree) {
+        writer.addReceiverAnnotationInfo(member, rcvrType, annotationMirrors, tree);
+        tree.addContent(writer.getSpace());
+        tree.addContent(utils.getTypeName(rcvrType, false));
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, RECEIVER_TYPE, rcvrType);
+        tree.addContent(writer.getTypeParameterLinks(linkInfo));
+        tree.addContent(writer.getSpace());
+        tree.addContent("this");
+    }
+
+
+    /**
+     * Add all the parameters for the executable member.
+     *
+     * @param member the member to write parameters for.
+     * @param htmltree the content tree to which the parameters information will be added.
+     */
+    protected void addParameters(ExecutableElement member, Content htmltree, int indentSize) {
+        addParameters(member, true, htmltree, indentSize);
+    }
+
+    /**
+     * Add all the parameters for the executable member.
+     *
+     * @param member the member to write parameters for.
+     * @param includeAnnotations true if annotation information needs to be added.
+     * @param htmltree the content tree to which the parameters information will be added.
+     */
+    protected void addParameters(ExecutableElement member,
+            boolean includeAnnotations, Content htmltree, int indentSize) {
+        htmltree.addContent("(");
+        String sep = "";
+        List<? extends VariableElement> parameters = member.getParameters();
+        String indent = makeSpace(indentSize + 1);
+        TypeMirror rcvrType = member.getReceiverType();
+        if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
+            List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors();
+            addReceiverAnnotations(member, rcvrType, annotationMirrors, htmltree);
+            sep = "," + DocletConstants.NL + indent;
+        }
+        int paramstart;
+        for (paramstart = 0; paramstart < parameters.size(); paramstart++) {
+            htmltree.addContent(sep);
+            VariableElement param = parameters.get(paramstart);
+
+            if (param.getKind() != ElementKind.INSTANCE_INIT) {
+                if (includeAnnotations) {
+                    boolean foundAnnotations =
+                            writer.addAnnotationInfo(indent.length(),
+                            member, param, htmltree);
+                    if (foundAnnotations) {
+                        htmltree.addContent(DocletConstants.NL);
+                        htmltree.addContent(indent);
+                    }
+                }
+                addParam(member, param,
+                    (paramstart == parameters.size() - 1) && member.isVarArgs(), htmltree);
+                break;
+            }
+        }
+
+        for (int i = paramstart + 1; i < parameters.size(); i++) {
+            htmltree.addContent(",");
+            htmltree.addContent(DocletConstants.NL);
+            htmltree.addContent(indent);
+            if (includeAnnotations) {
+                boolean foundAnnotations =
+                        writer.addAnnotationInfo(indent.length(), member, parameters.get(i),
+                        htmltree);
+                if (foundAnnotations) {
+                    htmltree.addContent(DocletConstants.NL);
+                    htmltree.addContent(indent);
+                }
+            }
+            addParam(member, parameters.get(i), (i == parameters.size() - 1) && member.isVarArgs(),
+                    htmltree);
+        }
+        htmltree.addContent(")");
+    }
+
+    /**
+     * Add exceptions for the executable member.
+     *
+     * @param member the member to write exceptions for.
+     * @param htmltree the content tree to which the exceptions information will be added.
+     */
+    protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
+        List<? extends TypeMirror> exceptions = member.getThrownTypes();
+        if (!exceptions.isEmpty()) {
+            String indent = makeSpace(indentSize + 1 - 7);
+            htmltree.addContent(DocletConstants.NL);
+            htmltree.addContent(indent);
+            htmltree.addContent("throws ");
+            indent = makeSpace(indentSize + 1);
+            Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
+            htmltree.addContent(link);
+            for(int i = 1; i < exceptions.size(); i++) {
+                htmltree.addContent(",");
+                htmltree.addContent(DocletConstants.NL);
+                htmltree.addContent(indent);
+                Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
+                        exceptions.get(i)));
+                htmltree.addContent(exceptionLink);
+            }
+        }
+    }
+
+    protected TypeElement implementsMethodInIntfac(ExecutableElement method,
+                                                List<TypeElement> intfacs) {
+        for (TypeElement intf : intfacs) {
+            List<ExecutableElement> methods = utils.getMethods(intf);
+            if (!methods.isEmpty()) {
+                for (ExecutableElement md : methods) {
+                    if (name(md).equals(name(method)) &&
+                        md.toString().equals(method.toString())) {
+                        return intf;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * For backward compatibility, include an anchor using the erasures of the
+     * parameters.  NOTE:  We won't need this method anymore after we fix
+     * see tags so that they use the type instead of the erasure.
+     *
+     * @param executableElement the ExecutableElement to anchor to.
+     * @return the 1.4.x style anchor for the executable element.
+     */
+    protected String getErasureAnchor(ExecutableElement executableElement) {
+        final StringBuilder buf = new StringBuilder(name(executableElement) + "(");
+        List<? extends VariableElement> parameters = executableElement.getParameters();
+        boolean foundTypeVariable = false;
+        for (int i = 0; i < parameters.size(); i++) {
+            if (i > 0) {
+                buf.append(",");
+            }
+            TypeMirror t = parameters.get(i).asType();
+            SimpleTypeVisitor9<Boolean, Void> stv = new SimpleTypeVisitor9<Boolean, Void>() {
+                boolean foundTypeVariable = false;
+
+                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                public Boolean visitArray(ArrayType t, Void p) {
+                    visit(t.getComponentType());
+                    buf.append(utils.getDimension(t));
+                    return foundTypeVariable;
+                }
+
+                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                public Boolean visitTypeVariable(TypeVariable t, Void p) {
+                    buf.append(utils.asTypeElement(t).getQualifiedName());
+                    foundTypeVariable = true;
+                    return foundTypeVariable;
+                }
+
+                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                public Boolean visitDeclared(DeclaredType t, Void p) {
+                    buf.append(utils.getQualifiedTypeName(t));
+                    return foundTypeVariable;
+                }
+
+                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                protected Boolean defaultAction(TypeMirror e, Void p) {
+                    buf.append(e.toString());
+                    return foundTypeVariable;
+                }
+            };
+
+            boolean isTypeVariable = stv.visit(t);
+            if (!foundTypeVariable) {
+                foundTypeVariable = isTypeVariable;
+            }
+        }
+        buf.append(")");
+        return foundTypeVariable ? writer.getName(buf.toString()) : null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,461 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+import java.nio.file.*;
+import java.util.*;
+import java.util.zip.*;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.SimpleElementVisitor9;
+
+import com.sun.source.doctree.DocTree;
+import com.sun.tools.javac.util.DefinedBy;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
+
+/**
+ * Generate Index for all the Member Names with Indexing in
+ * Unicode Order. This class is a base class for {@link SingleIndexWriter} and
+ * {@link SplitIndexWriter}. It uses the functionality from
+ * {@link HtmlDocletWriter} to generate the Index Contents.
+ *
+ *  <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>
+ *
+ * @see    IndexBuilder
+ * @author Atul M Dambalkar
+ * @author Bhavesh Patel (Modified)
+ */
+public class AbstractIndexWriter extends HtmlDocletWriter {
+
+    /**
+     * The index of all the members with unicode character.
+     */
+    protected IndexBuilder indexbuilder;
+
+    /**
+     * This constructor will be used by {@link SplitIndexWriter}. Initializes
+     * path to this file and relative path from this file.
+     *
+     * @param configuration  The current configuration
+     * @param path       Path to the file which is getting generated.
+     * @param indexbuilder Unicode based Index from {@link IndexBuilder}
+     */
+    protected AbstractIndexWriter(ConfigurationImpl configuration,
+                                  DocPath path,
+                                  IndexBuilder indexbuilder)
+                                  throws IOException {
+        super(configuration, path);
+        this.indexbuilder = indexbuilder;
+    }
+
+    /**
+     * Get the index label for navigation bar.
+     *
+     * @return a content tree for the tree label
+     */
+    protected Content getNavLinkIndex() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, indexLabel);
+        return li;
+    }
+
+    /**
+     * Add the member information for the unicode character along with the
+     * list of the members.
+     *
+     * @param uc Unicode for which member list information to be generated
+     * @param memberlist List of members for the unicode character
+     * @param contentTree the content tree to which the information will be added
+     */
+    protected void addContents(Character uc, Collection<? extends Element> memberlist,
+            Content contentTree) {
+        addHeading(uc, contentTree);
+        // Display the list only if there are elements to be displayed.
+        if (!memberlist.isEmpty()) {
+            Content dl = new HtmlTree(HtmlTag.DL);
+            for (Element element : memberlist) {
+                addDescription(dl, element);
+            }
+            contentTree.addContent(dl);
+        }
+    }
+
+    protected void addSearchContents(Character uc, List<SearchIndexItem> searchList,
+            Content contentTree) {
+        addHeading(uc, contentTree);
+        // Display the list only if there are elements to be displayed.
+        if (!searchList.isEmpty()) {
+            Content dl = new HtmlTree(HtmlTag.DL);
+            for (SearchIndexItem sii : searchList) {
+                addDescription(sii, dl);
+            }
+            contentTree.addContent(dl);
+        }
+    }
+
+    protected void addContents(Character uc, List<? extends Element> memberlist,
+            List<SearchIndexItem> searchList, Content contentTree) {
+        addHeading(uc, contentTree);
+        int memberListSize = memberlist.size();
+        int searchListSize = searchList.size();
+        int i = 0;
+        int j = 0;
+        Content dl = new HtmlTree(HtmlTag.DL);
+        while (i < memberListSize && j < searchListSize) {
+            String name = utils.getSimpleName(memberlist.get(i));
+            if (name.compareTo(searchList.get(j).getLabel()) < 0) {
+                addDescription(dl, memberlist.get(i));
+                i++;
+            } else if (name.compareTo(searchList.get(j).getLabel()) > 0) {
+                addDescription(searchList.get(j), dl);
+                j++;
+            } else {
+                addDescription(dl, memberlist.get(i));
+                addDescription(searchList.get(j), dl);
+                j++;
+                i++;
+            }
+        }
+        if (i >= memberListSize) {
+            while (j < searchListSize) {
+                addDescription(searchList.get(j), dl);
+                j++;
+            }
+        }
+        if (j >= searchListSize) {
+            while (i < memberListSize) {
+                addDescription(dl, memberlist.get(i));
+                i++;
+            }
+        }
+        contentTree.addContent(dl);
+    }
+
+    protected void addHeading(Character uc, Content contentTree) {
+        String unicode = uc.toString();
+        contentTree.addContent(getMarkerAnchorForIndex(unicode));
+        Content headContent = new StringContent(unicode);
+        Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
+                HtmlStyle.title, headContent);
+        contentTree.addContent(heading);
+    }
+
+    protected void addDescription(Content dl, Element element) {
+        SearchIndexItem si = new SearchIndexItem();
+        new SimpleElementVisitor9<Void, Void>() {
+
+            @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+            public Void visitPackage(PackageElement e, Void p) {
+                addDescription(e, dl, si);
+                configuration.packageSearchIndex.add(si);
+                return null;
+            }
+
+            @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+            public Void visitType(TypeElement e, Void p) {
+                addDescription(e, dl, si);
+                configuration.typeSearchIndex.add(si);
+                return null;
+            }
+
+            @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+            protected Void defaultAction(Element e, Void p) {
+                addDescription(e, dl, si);
+                configuration.memberSearchIndex.add(si);
+                return null;
+            }
+
+        }.visit(element);
+    }
+
+    /**
+     * Add one line summary comment for the package.
+     *
+     * @param pkg the package to be documented
+     * @param dlTree the content tree to which the description will be added
+     */
+    protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
+        Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+        si.setLabel(utils.getPackageName(pkg));
+        si.setCategory(getResource("doclet.Packages").toString());
+        Content dt = HtmlTree.DT(link);
+        dt.addContent(" - ");
+        dt.addContent(getResource("doclet.package"));
+        dt.addContent(" " + utils.getPackageName(pkg));
+        dlTree.addContent(dt);
+        Content dd = new HtmlTree(HtmlTag.DD);
+        addSummaryComment(pkg, dd);
+        dlTree.addContent(dd);
+    }
+
+    /**
+     * Add one line summary comment for the class.
+     *
+     * @param typeElement the class being documented
+     * @param dlTree the content tree to which the description will be added
+     */
+    protected void addDescription(TypeElement typeElement, Content dlTree, SearchIndexItem si) {
+        Content link = getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.Kind.INDEX, typeElement).strong(true));
+        si.setContainingPackage(utils.getPackageName(utils.containingPackage(typeElement)));
+        si.setLabel(utils.getSimpleName(typeElement));
+        si.setCategory(getResource("doclet.Types").toString());
+        Content dt = HtmlTree.DT(link);
+        dt.addContent(" - ");
+        addClassInfo(typeElement, dt);
+        dlTree.addContent(dt);
+        Content dd = new HtmlTree(HtmlTag.DD);
+        addComment(typeElement, dd);
+        dlTree.addContent(dd);
+    }
+
+    /**
+     * Add the classkind (class, interface, exception), error of the class
+     * passed.
+     *
+     * @param te the class being documented
+     * @param contentTree the content tree to which the class info will be added
+     */
+    protected void addClassInfo(TypeElement te, Content contentTree) {
+        contentTree.addContent(getResource("doclet.in",
+                utils.getTypeElementName(te, false),
+                getPackageLink(utils.containingPackage(te),
+                    utils.getPackageName(utils.containingPackage(te)))
+                ));
+    }
+
+    /**
+     * Add description for Class, Field, Method or Constructor.
+     *
+     * @param member the member of the Class Kind
+     * @param dlTree the content tree to which the description will be added
+     * @param si search index item
+     */
+    protected void addDescription(Element member, Content dlTree, SearchIndexItem si) {
+
+        si.setContainingPackage(utils.getPackageName(utils.containingPackage(member)));
+        si.setContainingClass(utils.getSimpleName(utils.getEnclosingTypeElement(member)));
+        String name = utils.getSimpleName(member);
+        if (utils.isExecutableElement(member)) {
+            ExecutableElement ee = (ExecutableElement)member;
+            name = name + utils.flatSignature(ee);
+            si.setLabel(name);
+            if (!((utils.signature(ee)).equals(utils.flatSignature(ee)))) {
+                si.setUrl(getName(getAnchor(ee)));
+            }
+
+        }  else {
+            si.setLabel(name);
+        }
+        si.setCategory(getResource("doclet.Members").toString());
+        Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
+                getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
+        Content dt = HtmlTree.DT(span);
+        dt.addContent(" - ");
+        addMemberDesc(member, dt);
+        dlTree.addContent(dt);
+        Content dd = new HtmlTree(HtmlTag.DD);
+        addComment(member, dd);
+        dlTree.addContent(dd);
+    }
+
+    protected void addDescription(SearchIndexItem sii, Content dlTree) {
+        String path = pathToRoot.isEmpty() ? "" : pathToRoot.getPath() + "/";
+        path += sii.getUrl();
+        HtmlTree labelLink = HtmlTree.A(path, new StringContent(sii.getLabel()));
+        Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.searchTagLink, labelLink));
+        dt.addContent(" - ");
+        dt.addContent(getResource("doclet.Search_tag_in", sii.getHolder()));
+        dlTree.addContent(dt);
+        Content dd = new HtmlTree(HtmlTag.DD);
+        if (sii.getDescription().isEmpty()) {
+            dd.addContent(getSpace());
+        } else {
+            dd.addContent(sii.getDescription());
+        }
+        dlTree.addContent(dd);
+    }
+
+    /**
+     * Add comment for each element in the index. If the element is deprecated
+     * and it has a @deprecated tag, use that comment. Else if the containing
+     * class for this element is deprecated, then add the word "Deprecated." at
+     * the start and then print the normal comment.
+     *
+     * @param element Index element
+     * @param contentTree the content tree to which the comment will be added
+     */
+    protected void addComment(Element element, Content contentTree) {
+        List<? extends DocTree> tags;
+        Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.block);
+        if (utils.isDeprecated(element)) {
+            div.addContent(span);
+            tags = utils.getBlockTags(element, DocTree.Kind.DEPRECATED);
+            if (!tags.isEmpty())
+                addInlineDeprecatedComment(element, tags.get(0), div);
+            contentTree.addContent(div);
+        } else {
+            TypeElement encl = utils.getEnclosingTypeElement(element);
+            while (encl != null) {
+                if (utils.isDeprecated(encl)) {
+                    div.addContent(span);
+                    contentTree.addContent(div);
+                    break;
+                }
+                encl = utils.getEnclosingTypeElement(encl);
+            }
+            addSummaryComment(element, contentTree);
+        }
+    }
+
+    /**
+     * Add description about the Static Variable/Method/Constructor for a
+     * member.
+     *
+     * @param member MemberDoc for the member within the Class Kind
+     * @param contentTree the content tree to which the member description will be added
+     */
+    protected void addMemberDesc(Element member, Content contentTree) {
+        TypeElement containing = utils.getEnclosingTypeElement(member);
+        String classdesc = utils.getTypeElementName(containing, true) + " ";
+        if (utils.isField(member)) {
+            Content resource = getResource(utils.isStatic(member)
+                    ? "doclet.Static_variable_in"
+                    : "doclet.Variable_in", classdesc);
+            contentTree.addContent(resource);
+        } else if (utils.isConstructor(member)) {
+            contentTree.addContent(
+                    getResource("doclet.Constructor_for", classdesc));
+        } else if (utils.isMethod(member)) {
+            Content resource = getResource(utils.isStatic(member)
+                    ? "doclet.Static_method_in"
+                    : "doclet.Method_in", classdesc);
+            contentTree.addContent(resource);
+        }
+        addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
+                false, contentTree);
+    }
+
+    /**
+     * Get the marker anchor which will be added to the index documentation tree.
+     *
+     * @param anchorNameForIndex the anchor name attribute for index page
+     * @return a content tree for the marker anchor
+     */
+    public Content getMarkerAnchorForIndex(String anchorNameForIndex) {
+        return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null);
+    }
+
+    /**
+     * Generate a valid HTML name for member index page.
+     *
+     * @param unicode the string that needs to be converted to valid HTML name.
+     * @return a valid HTML name string.
+     */
+    public String getNameForIndex(String unicode) {
+        return "I:" + getName(unicode);
+    }
+
+    protected void createSearchIndexFiles() {
+        createSearchIndexFile(DocPaths.PACKAGE_SEARCH_INDEX_JSON, DocPaths.PACKAGE_SEARCH_INDEX_ZIP,
+                configuration.packageSearchIndex);
+        createSearchIndexFile(DocPaths.TYPE_SEARCH_INDEX_JSON, DocPaths.TYPE_SEARCH_INDEX_ZIP,
+                configuration.typeSearchIndex);
+        createSearchIndexFile(DocPaths.MEMBER_SEARCH_INDEX_JSON, DocPaths.MEMBER_SEARCH_INDEX_ZIP,
+                configuration.memberSearchIndex);
+        createSearchIndexFile(DocPaths.TAG_SEARCH_INDEX_JSON, DocPaths.TAG_SEARCH_INDEX_ZIP,
+                configuration.tagSearchIndex);
+    }
+
+    protected void createSearchIndexFile(DocPath searchIndexFile, DocPath searchIndexZip,
+            List<SearchIndexItem> searchIndex) {
+        if (!searchIndex.isEmpty()) {
+            try {
+                StringBuilder searchVar = new StringBuilder("[");
+                boolean first = true;
+                DocFile searchFile = DocFile.createFileForOutput(configuration, searchIndexFile);
+                Path p = Paths.get(searchFile.getPath());
+                for (SearchIndexItem item : searchIndex) {
+                    if (first) {
+                        searchVar.append(item.toString());
+                        first = false;
+                    } else {
+                        searchVar.append(",").append(item.toString());
+                    }
+                }
+                searchVar.append("]");
+                Files.write(p, searchVar.toString().getBytes());
+                DocFile zipFile = DocFile.createFileForOutput(configuration, searchIndexZip);
+                try (FileOutputStream fos = new FileOutputStream(zipFile.getPath());
+                        ZipOutputStream zos = new ZipOutputStream(fos)) {
+                    zipFile(searchFile.getPath(), searchIndexFile, zos);
+                }
+                Files.delete(p);
+            } catch (IOException ie) {
+                throw new DocletAbortException(ie);
+            }
+        }
+    }
+
+    protected void zipFile(String inputFile, DocPath file, ZipOutputStream zos) {
+        try {
+            try {
+                ZipEntry ze = new ZipEntry(file.getPath());
+                zos.putNextEntry(ze);
+                try (FileInputStream fis = new FileInputStream(new File(inputFile))) {
+                    byte[] buf = new byte[2048];
+                    int len = fis.read(buf);
+                    while (len > 0) {
+                        zos.write(buf, 0, len);
+                        len = fis.read(buf);
+                    }
+                }
+            } finally {
+                zos.closeEntry();
+            }
+        } catch (IOException e) {
+            throw new DocletAbortException(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,708 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.TypeParameterElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.SimpleElementVisitor9;
+
+import com.sun.source.doctree.DocTree;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.taglets.DeprecatedTaglet;
+import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
+import jdk.javadoc.internal.doclets.toolkit.util.Utils;
+import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
+
+import static javax.lang.model.element.Modifier.*;
+
+/**
+ * The base class for member writers.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Robert Field
+ * @author Atul M Dambalkar
+ * @author Jamie Ho (Re-write)
+ * @author Bhavesh Patel (Modified)
+ */
+public abstract class AbstractMemberWriter {
+
+    protected final ConfigurationImpl configuration;
+    protected final Utils utils;
+    protected final SubWriterHolderWriter writer;
+    protected final TypeElement typeElement;
+    protected Map<String, Integer> typeMap = new LinkedHashMap<>();
+    protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
+    private int methodTypesOr = 0;
+    public final boolean nodepr;
+
+    protected boolean printedSummaryHeader = false;
+
+    public AbstractMemberWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
+        this.configuration = writer.configuration;
+        this.writer = writer;
+        this.nodepr = configuration.nodeprecated;
+        this.typeElement = typeElement;
+        this.utils = writer.configuration.utils;
+    }
+
+    public AbstractMemberWriter(SubWriterHolderWriter writer) {
+        this(writer, null);
+    }
+
+    /*** abstracts ***/
+
+    /**
+     * Add the summary label for the member.
+     *
+     * @param memberTree the content tree to which the label will be added
+     */
+    public abstract void addSummaryLabel(Content memberTree);
+
+    /**
+     * Get the summary for the member summary table.
+     *
+     * @return a string for the table summary
+     */
+    public abstract String getTableSummary();
+
+    /**
+     * Get the caption for the member summary table.
+     *
+     * @return a string for the table caption
+     */
+    public abstract Content getCaption();
+
+    /**
+     * Get the summary table header for the member.
+     *
+     * @param member the member to be documented
+     * @return the summary table header
+     */
+    public abstract List<String> getSummaryTableHeader(Element member);
+
+    /**
+     * Add inherited summary label for the member.
+     *
+     * @param typeElement the TypeElement to which to link to
+     * @param inheritedTree the content tree to which the inherited summary label will be added
+     */
+    public abstract void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree);
+
+    /**
+     * Add the anchor for the summary section of the member.
+     *
+     * @param typeElement the TypeElement to be documented
+     * @param memberTree the content tree to which the summary anchor will be added
+     */
+    public abstract void addSummaryAnchor(TypeElement typeElement, Content memberTree);
+
+    /**
+     * Add the anchor for the inherited summary section of the member.
+     *
+     * @param typeElement the TypeElement to be documented
+     * @param inheritedTree the content tree to which the inherited summary anchor will be added
+     */
+    public abstract void addInheritedSummaryAnchor(TypeElement typeElement, Content inheritedTree);
+
+    /**
+     * Add the summary type for the member.
+     *
+     * @param member the member to be documented
+     * @param tdSummaryType the content tree to which the type will be added
+     */
+    protected abstract void addSummaryType(Element member, Content tdSummaryType);
+
+    /**
+     * Add the summary link for the member.
+     *
+     * @param typeElement the TypeElement to be documented
+     * @param member the member to be documented
+     * @param tdSummary the content tree to which the link will be added
+     */
+    protected void addSummaryLink(TypeElement typeElement, Element member, Content tdSummary) {
+        addSummaryLink(LinkInfoImpl.Kind.MEMBER, typeElement, member, tdSummary);
+    }
+
+    /**
+     * Add the summary link for the member.
+     *
+     * @param context the id of the context where the link will be printed
+     * @param typeElement the TypeElement to be documented
+     * @param member the member to be documented
+     * @param tdSummary the content tree to which the summary link will be added
+     */
+    protected abstract void addSummaryLink(LinkInfoImpl.Kind context,
+            TypeElement typeElement, Element member, Content tdSummary);
+
+    /**
+     * Add the inherited summary link for the member.
+     *
+     * @param typeElement the TypeElement to be documented
+     * @param member the member to be documented
+     * @param linksTree the content tree to which the inherited summary link will be added
+     */
+    protected abstract void addInheritedSummaryLink(TypeElement typeElement,
+            Element member, Content linksTree);
+
+    /**
+     * Get the deprecated link.
+     *
+     * @param member the member being linked to
+     * @return a content tree representing the link
+     */
+    protected abstract Content getDeprecatedLink(Element member);
+
+    /**
+     * Get the navigation summary link.
+     *
+     * @param typeElement the TypeElement to be documented
+     * @param link true if its a link else the label to be printed
+     * @return a content tree for the navigation summary link.
+     */
+    protected abstract Content getNavSummaryLink(TypeElement typeElement, boolean link);
+
+    /**
+     * Add the navigation detail link.
+     *
+     * @param link true if its a link else the label to be printed
+     * @param liNav the content tree to which the navigation detail link will be added
+     */
+    protected abstract void addNavDetailLink(boolean link, Content liNav);
+
+    /**
+     * Add the member name to the content tree.
+     *
+     * @param name the member name to be added to the content tree.
+     * @param htmltree the content tree to which the name will be added.
+     */
+    protected void addName(String name, Content htmltree) {
+        htmltree.addContent(name);
+    }
+
+    protected String typeString(Element member) {
+        return new SimpleElementVisitor9<String, Void>() {
+
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            public String visitExecutable(ExecutableElement e, Void p) {
+               return utils.isMethod(e) ? e.getReturnType().toString() : "";
+            }
+
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            public String visitVariable(VariableElement e, Void p) {
+                return e.toString();
+            }
+
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            protected String defaultAction(Element e, Void p) {
+                return "";
+            }
+        }.visit(member);
+    }
+
+    /**
+     * Add the modifier for the member. The modifiers are ordered as specified
+     * by <em>The Java Language Specification</em>.
+     *
+     * @param member the member for which teh modifier will be added.
+     * @param htmltree the content tree to which the modifier information will be added.
+     */
+    protected void addModifiers(Element member, Content htmltree) {
+        Set<Modifier> set = new TreeSet<>(member.getModifiers());
+
+        // remove the ones we really don't need
+        set.remove(NATIVE);
+        set.remove(SYNCHRONIZED);
+        set.remove(STRICTFP);
+
+        // According to JLS, we should not be showing public modifier for
+        // interface methods.
+        if ((utils.isField(member) || utils.isMethod(member))
+                && writer instanceof ClassWriterImpl
+                && utils.isInterface(((ClassWriterImpl) writer).getTypeElement())) {
+            // Remove the implicit abstract and public modifiers
+            if (utils.isMethod(member) && utils.isInterface(member.getEnclosingElement())) {
+                set.remove(ABSTRACT);
+                set.remove(PUBLIC);
+            }
+            if (!utils.isMethod(member)) {
+                set.remove(PUBLIC);
+            }
+        }
+        if (!set.isEmpty()) {
+            String mods = set.stream().map(m -> m.toString()).collect(Collectors.joining(" "));
+            htmltree.addContent(mods);
+            htmltree.addContent(writer.getSpace());
+        }
+    }
+
+    protected String makeSpace(int len) {
+        if (len <= 0) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder(len);
+        for (int i = 0; i < len; i++) {
+            sb.append(' ');
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Add the modifier and type for the member in the member summary.
+     *
+     * @param member the member to add the type for
+     * @param type the type to add
+     * @param tdSummaryType the content tree to which the modified and type will be added
+     */
+    protected void addModifierAndType(Element member, TypeMirror type,
+            Content tdSummaryType) {
+        HtmlTree code = new HtmlTree(HtmlTag.CODE);
+        addModifier(member, code);
+        if (type == null) {
+            code.addContent(utils.isClass(member) ? "class" : "interface");
+            code.addContent(writer.getSpace());
+        } else {
+            List<? extends TypeParameterElement> list = utils.isExecutableElement(member)
+                    ? ((ExecutableElement)member).getTypeParameters()
+                    : null;
+            if (list != null && !list.isEmpty()) {
+                Content typeParameters = ((AbstractExecutableMemberWriter) this)
+                        .getTypeParameters((ExecutableElement)member);
+                    code.addContent(typeParameters);
+                //Code to avoid ugly wrapping in member summary table.
+                if (typeParameters.charCount() > 10) {
+                    code.addContent(new HtmlTree(HtmlTag.BR));
+                } else {
+                    code.addContent(writer.getSpace());
+                }
+                code.addContent(
+                        writer.getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
+            } else {
+                code.addContent(
+                        writer.getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
+            }
+
+        }
+        tdSummaryType.addContent(code);
+    }
+
+    /**
+     * Add the modifier for the member.
+     *
+     * @param member the member to add the type for
+     * @param code the content tree to which the modified will be added
+     */
+    private void addModifier(Element member, Content code) {
+        if (utils.isProtected(member)) {
+            code.addContent("protected ");
+        } else if (utils.isPrivate(member)) {
+            code.addContent("private ");
+        } else if (!utils.isPublic(member)) { // Package private
+            code.addContent(configuration.getText("doclet.Package_private"));
+            code.addContent(" ");
+        }
+        boolean isAnnotatedTypeElement = utils.isAnnotationType(member.getEnclosingElement());
+        if (!isAnnotatedTypeElement && utils.isMethod(member)) {
+            if (!utils.isInterface(member.getEnclosingElement()) && utils.isAbstract(member)) {
+                code.addContent("abstract ");
+            }
+            if (utils.isDefault(member)) {
+                code.addContent("default ");
+            }
+        }
+        if (utils.isStatic(member)) {
+            code.addContent("static ");
+        }
+    }
+
+    /**
+     * Add the deprecated information for the given member.
+     *
+     * @param member the member being documented.
+     * @param contentTree the content tree to which the deprecated information will be added.
+     */
+    protected void addDeprecatedInfo(Element member, Content contentTree) {
+        Content output = (new DeprecatedTaglet()).getTagletOutput(member,
+            writer.getTagletWriterInstance(false));
+        if (!output.isEmpty()) {
+            Content deprecatedContent = output;
+            Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
+            contentTree.addContent(div);
+        }
+    }
+
+    /**
+     * Add the comment for the given member.
+     *
+     * @param member the member being documented.
+     * @param htmltree the content tree to which the comment will be added.
+     */
+    protected void addComment(Element member, Content htmltree) {
+        if (!utils.getBody(member).isEmpty()) {
+            writer.addInlineComment(member, htmltree);
+        }
+    }
+
+    protected String name(Element member) {
+        return utils.getSimpleName(member);
+    }
+
+    /**
+     * Get the header for the section.
+     *
+     * @param member the member being documented.
+     * @return a header content for the section.
+     */
+    protected Content getHead(Element member) {
+        Content memberContent = new StringContent(name(member));
+        Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
+        return heading;
+    }
+
+    /**
+    * Return true if the given <code>ProgramElement</code> is inherited
+    * by the class that is being documented.
+    *
+    * @param ped The <code>ProgramElement</code> being checked.
+    * return true if the <code>ProgramElement</code> is being inherited and
+    * false otherwise.
+    */
+    protected boolean isInherited(Element ped){
+        return (!utils.isPrivate(ped) &&
+                (!utils.isPackagePrivate(ped) ||
+                    ped.getEnclosingElement().equals(ped.getEnclosingElement())));
+    }
+
+    /**
+     * Add deprecated information to the documentation tree
+     *
+     * @param deprmembers list of deprecated members
+     * @param headingKey the caption for the deprecated members table
+     * @param tableSummary the summary for the deprecated members table
+     * @param tableHeader table headers for the deprecated members table
+     * @param contentTree the content tree to which the deprecated members table will be added
+     */
+    protected void addDeprecatedAPI(Collection<Element> deprmembers, String headingKey,
+            String tableSummary, List<String> tableHeader, Content contentTree) {
+        if (deprmembers.size() > 0) {
+            Content caption = writer.getTableCaption(configuration.getResource(headingKey));
+            Content table = (configuration.isOutputHtml5())
+                    ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
+                    : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
+            table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
+            Content tbody = new HtmlTree(HtmlTag.TBODY);
+            boolean altColor = true;
+            for (Element member : deprmembers) {
+                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
+                List<? extends DocTree> deprTrees = utils.getBlockTags(member, DocTree.Kind.DEPRECATED);
+                if (!deprTrees.isEmpty()) {
+                    writer.addInlineDeprecatedComment(member, deprTrees.get(0), td);
+                }
+                HtmlTree tr = HtmlTree.TR(td);
+                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+                altColor = !altColor;
+                tbody.addContent(tr);
+            }
+            table.addContent(tbody);
+            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
+            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            contentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add use information to the documentation tree.
+     *
+     * @param mems list of program elements for which the use information will be added
+     * @param heading the section heading
+     * @param tableSummary the summary for the use table
+     * @param contentTree the content tree to which the use information will be added
+     */
+    protected void addUseInfo(List<? extends Element> mems,
+            Content heading, String tableSummary, Content contentTree) {
+        if (mems == null || mems.isEmpty()) {
+            return;
+        }
+        List<? extends Element> members = mems;
+        boolean printedUseTableHeader = false;
+        if (members.size() > 0) {
+            Content caption = writer.getTableCaption(heading);
+            Content table = (configuration.isOutputHtml5())
+                    ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
+                    : HtmlTree.TABLE(HtmlStyle.useSummary, tableSummary, caption);
+            Content tbody = new HtmlTree(HtmlTag.TBODY);
+            boolean altColor = true;
+            for (Element element : members) {
+                TypeElement te = utils.getEnclosingTypeElement(element);
+                if (!printedUseTableHeader) {
+                    table.addContent(writer.getSummaryTableHeader(
+                            this.getSummaryTableHeader(element), "col"));
+                    printedUseTableHeader = true;
+                }
+                HtmlTree tr = new HtmlTree(HtmlTag.TR);
+                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+                altColor = !altColor;
+                HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
+                tdFirst.addStyle(HtmlStyle.colFirst);
+                writer.addSummaryType(this, element, tdFirst);
+                tr.addContent(tdFirst);
+                HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
+                tdLast.addStyle(HtmlStyle.colLast);
+                if (te != null
+                        && !utils.isConstructor(element)
+                        && !utils.isClass(element)
+                        && !utils.isInterface(element)
+                        && !utils.isAnnotationType(element)) {
+                    HtmlTree name = new HtmlTree(HtmlTag.SPAN);
+                    name.addStyle(HtmlStyle.typeNameLabel);
+                    name.addContent(name(te) + ".");
+                    tdLast.addContent(name);
+                }
+                addSummaryLink(utils.isClass(element) || utils.isInterface(element)
+                        ? LinkInfoImpl.Kind.CLASS_USE
+                        : LinkInfoImpl.Kind.MEMBER,
+                    te, element, tdLast);
+                writer.addSummaryLinkComment(this, element, tdLast);
+                tr.addContent(tdLast);
+                tbody.addContent(tr);
+            }
+            table.addContent(tbody);
+            contentTree.addContent(table);
+        }
+    }
+
+    /**
+     * Add the navigation detail link.
+     *
+     * @param members the members to be linked
+     * @param liNav the content tree to which the navigation detail link will be added
+     */
+    protected void addNavDetailLink(SortedSet<Element> members, Content liNav) {
+        addNavDetailLink(!members.isEmpty(), liNav);
+    }
+
+    /**
+     * Add the navigation summary link.
+     *
+     * @param members members to be linked
+     * @param visibleMemberMap the visible inherited members map
+     * @param liNav the content tree to which the navigation summary link will be added
+     */
+    protected void addNavSummaryLink(SortedSet<? extends Element> members,
+            VisibleMemberMap visibleMemberMap, Content liNav) {
+        if (!members.isEmpty()) {
+            liNav.addContent(getNavSummaryLink(null, true));
+            return;
+        }
+
+        TypeElement superClass = utils.getSuperClass(typeElement);
+        while (superClass != null) {
+            if (visibleMemberMap.hasMembersFor(superClass)) {
+                liNav.addContent(getNavSummaryLink(superClass, true));
+                return;
+            }
+            superClass = utils.getSuperClass(superClass);
+        }
+        liNav.addContent(getNavSummaryLink(null, false));
+    }
+
+    protected void serialWarning(Element e, String key, String a1, String a2) {
+        if (configuration.serialwarn) {
+            configuration.getDocletSpecificMsg().warning(e, key, a1, a2);
+        }
+    }
+
+    /**
+     * Add the member summary for the given class.
+     *
+     * @param tElement the class that is being documented
+     * @param member the member being documented
+     * @param firstSentenceTags the first sentence tags to be added to the summary
+     * @param tableContents the list of contents to which the documentation will be added
+     * @param counter the counter for determining id and style for the table row
+     */
+    public void addMemberSummary(TypeElement tElement, Element member,
+            List<? extends DocTree> firstSentenceTags, List<Content> tableContents, int counter) {
+        HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
+        tdSummaryType.addStyle(HtmlStyle.colFirst);
+        writer.addSummaryType(this, member, tdSummaryType);
+        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+        setSummaryColumnStyle(tdSummary);
+        addSummaryLink(tElement, member, tdSummary);
+        writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
+        HtmlTree tr = HtmlTree.TR(tdSummaryType);
+        tr.addContent(tdSummary);
+        if (utils.isMethod(member) && !utils.isAnnotationType(member)) {
+            int methodType = utils.isStatic(member) ? MethodTypes.STATIC.value() :
+                    MethodTypes.INSTANCE.value();
+            if (utils.isInterface(member.getEnclosingElement())) {
+                methodType = utils.isAbstract(member)
+                        ? methodType | MethodTypes.ABSTRACT.value()
+                        : methodType | MethodTypes.DEFAULT.value();
+            } else {
+                methodType = utils.isAbstract(member)
+                        ? methodType | MethodTypes.ABSTRACT.value()
+                        : methodType | MethodTypes.CONCRETE.value();
+            }
+            if (utils.isDeprecated(member) || utils.isDeprecated(typeElement)) {
+                methodType = methodType | MethodTypes.DEPRECATED.value();
+            }
+            methodTypesOr = methodTypesOr | methodType;
+            String tableId = "i" + counter;
+            typeMap.put(tableId, methodType);
+            tr.addAttr(HtmlAttr.ID, tableId);
+        }
+        if (counter%2 == 0)
+            tr.addStyle(HtmlStyle.altColor);
+        else
+            tr.addStyle(HtmlStyle.rowColor);
+        tableContents.add(tr);
+    }
+
+    /**
+     * Generate the method types set and return true if the method summary table
+     * needs to show tabs.
+     *
+     * @return true if the table should show tabs
+     */
+    public boolean showTabs() {
+        int value;
+        for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
+            value = type.value();
+            if ((value & methodTypesOr) == value) {
+                methodTypes.add(type);
+            }
+        }
+        boolean showTabs = methodTypes.size() > 1;
+        if (showTabs) {
+            methodTypes.add(MethodTypes.ALL);
+        }
+        return showTabs;
+    }
+
+    /**
+     * Set the style for the summary column.
+     *
+     * @param tdTree the column for which the style will be set
+     */
+    public void setSummaryColumnStyle(HtmlTree tdTree) {
+        tdTree.addStyle(HtmlStyle.colLast);
+    }
+
+    /**
+     * Add inherited member summary for the given class and member.
+     *
+     * @param tElement the class the inherited member belongs to
+     * @param nestedClass the inherited member that is summarized
+     * @param isFirst true if this is the first member in the list
+     * @param isLast true if this is the last member in the list
+     * @param linksTree the content tree to which the summary will be added
+     */
+    public void addInheritedMemberSummary(TypeElement tElement,
+            Element nestedClass, boolean isFirst, boolean isLast,
+            Content linksTree) {
+        writer.addInheritedMemberSummary(this, tElement, nestedClass, isFirst,
+                linksTree);
+    }
+
+    /**
+     * Get the inherited summary header for the given class.
+     *
+     * @param tElement the class the inherited member belongs to
+     * @return a content tree for the inherited summary header
+     */
+    public Content getInheritedSummaryHeader(TypeElement tElement) {
+        Content inheritedTree = writer.getMemberTreeHeader();
+        writer.addInheritedSummaryHeader(this, tElement, inheritedTree);
+        return inheritedTree;
+    }
+
+    /**
+     * Get the inherited summary links tree.
+     *
+     * @return a content tree for the inherited summary links
+     */
+    public Content getInheritedSummaryLinksTree() {
+        return new HtmlTree(HtmlTag.CODE);
+    }
+
+    /**
+     * Get the summary table tree for the given class.
+     *
+     * @param tElement the class for which the summary table is generated
+     * @param tableContents list of contents to be displayed in the summary table
+     * @return a content tree for the summary table
+     */
+    public Content getSummaryTableTree(TypeElement tElement, List<Content> tableContents) {
+        return writer.getSummaryTableTree(this, tElement, tableContents, showTabs());
+    }
+
+    /**
+     * Get the member tree to be documented.
+     *
+     * @param memberTree the content tree of member to be documented
+     * @return a content tree that will be added to the class documentation
+     */
+    public Content getMemberTree(Content memberTree) {
+        return writer.getMemberTree(memberTree);
+    }
+
+    /**
+     * Get the member tree to be documented.
+     *
+     * @param memberTree the content tree of member to be documented
+     * @param isLastContent true if the content to be added is the last content
+     * @return a content tree that will be added to the class documentation
+     */
+    public Content getMemberTree(Content memberTree, boolean isLastContent) {
+        if (isLastContent)
+            return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
+        else
+            return HtmlTree.UL(HtmlStyle.blockList, memberTree);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import javax.lang.model.element.PackageElement;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+
+/**
+ * Abstract class to generate the overview files in
+ * Frame and Non-Frame format. This will be sub-classed by to
+ * generate overview-frame.html as well as overview-summary.html.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Atul M Dambalkar
+ * @author Bhavesh Patel (Modified)
+ */
+public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
+
+    /**
+     * A Set of Packages to be documented.
+     */
+    protected SortedSet<PackageElement> packages;
+
+    /**
+     * Constructor. Also initializes the packages variable.
+     *
+     * @param configuration  The current configuration
+     * @param filename Name of the package index file to be generated.
+     */
+    public AbstractPackageIndexWriter(ConfigurationImpl configuration,
+                                      DocPath filename) throws IOException {
+        super(configuration, filename);
+        packages = configuration.packages;
+    }
+
+    /**
+     * Adds the navigation bar header to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar header will be added
+     */
+    protected abstract void addNavigationBarHeader(Content body);
+
+    /**
+     * Adds the navigation bar footer to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar footer will be added
+     */
+    protected abstract void addNavigationBarFooter(Content body);
+
+    /**
+     * Adds the overview header to the documentation tree.
+     *
+     * @param body the document tree to which the overview header will be added
+     */
+    protected abstract void addOverviewHeader(Content body);
+
+    /**
+     * Adds the packages list to the documentation tree.
+     *
+     * @param packages a collection of packagedoc objects
+     * @param text caption for the table
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the packages list will be added
+     */
+    protected abstract void addPackagesList(Collection<PackageElement> packages, String text,
+            String tableSummary, Content body);
+
+    /**
+     * Generate and prints the contents in the package index file. Call appropriate
+     * methods from the sub-class in order to generate Frame or Non
+     * Frame format.
+     *
+     * @param title the title of the window.
+     * @param includeScript boolean set true if windowtitle script is to be included
+     */
+    protected void buildPackageIndexFile(String title, boolean includeScript) throws IOException {
+        String windowOverview = configuration.getText(title);
+        Content body = getBody(includeScript, getWindowTitle(windowOverview));
+        addNavigationBarHeader(body);
+        addOverviewHeader(body);
+        addIndex(body);
+        addOverview(body);
+        addNavigationBarFooter(body);
+        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
+                configuration.doctitle), includeScript, body);
+    }
+
+    /**
+     * Default to no overview, override to add overview.
+     *
+     * @param body the document tree to which the overview will be added
+     */
+    protected void addOverview(Content body) throws IOException {
+    }
+
+    /**
+     * Adds the frame or non-frame package index to the documentation tree.
+     *
+     * @param body the document tree to which the index will be added
+     */
+    protected void addIndex(Content body) {
+        addIndexContents(packages, "doclet.Package_Summary",
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Package_Summary"),
+                configuration.getText("doclet.packages")), body);
+    }
+
+    /**
+     * Adds package index contents. Call appropriate methods from
+     * the sub-classes. Adds it to the body HtmlTree
+     *
+     * @param packages a collection of packages to be documented
+     * @param text string which will be used as the heading
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the index contents will be added
+     */
+    protected void addIndexContents(Collection<PackageElement> packages, String text,
+            String tableSummary, Content body) {
+        if (!packages.isEmpty()) {
+            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
+                    ? HtmlTree.NAV()
+                    : new HtmlTree(HtmlTag.DIV);
+            htmlTree.addStyle(HtmlStyle.indexNav);
+            HtmlTree ul = new HtmlTree(HtmlTag.UL);
+            addAllClassesLink(ul);
+            htmlTree.addContent(ul);
+            body.addContent(htmlTree);
+            addPackagesList(packages, text, tableSummary, body);
+        }
+    }
+
+    /**
+     * Adds the doctitle to the documentation tree, if it is specified on the command line.
+     *
+     * @param body the document tree to which the title will be added
+     */
+    protected void addConfigurationTitle(Content body) {
+        if (configuration.doctitle.length() > 0) {
+            Content title = new RawHtml(configuration.doctitle);
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
+                    HtmlStyle.title, title);
+            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
+            body.addContent(div);
+        }
+    }
+
+    /**
+     * Returns highlighted "Overview", in the navigation bar as this is the
+     * overview page.
+     *
+     * @return a Content object to be added to the documentation tree
+     */
+    protected Content getNavLinkContents() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
+        return li;
+    }
+
+    /**
+     * Do nothing. This will be overridden.
+     *
+     * @param div the document tree to which the all classes link will be added
+     */
+    protected void addAllClassesLink(Content div) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import javax.lang.model.element.TypeElement;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+
+
+/**
+ * Abstract class to print the class hierarchy page for all the Classes. This
+ * is sub-classed by {@link PackageTreeWriter} and {@link TreeWriter} to
+ * generate the Package Tree and global Tree(for all the classes and packages)
+ * pages.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Atul M Dambalkar
+ */
+public abstract class AbstractTreeWriter extends HtmlDocletWriter {
+
+    /**
+     * The class and interface tree built by using {@link ClassTree}
+     */
+    protected final ClassTree classtree;
+
+    /**
+     * Constructor initializes classtree variable. This constructor will be used
+     * while generating global tree file "overview-tree.html".
+     *
+     * @param configuration  The current configuration
+     * @param filename   File to be generated.
+     * @param classtree  Tree built by {@link ClassTree}.
+     * @throws IOException
+     * @throws DocletAbortException
+     */
+    protected AbstractTreeWriter(ConfigurationImpl configuration,
+                                 DocPath filename, ClassTree classtree)
+                                 throws IOException {
+        super(configuration, filename);
+        this.classtree = classtree;
+    }
+
+    /**
+     * Add each level of the class tree. For each sub-class or
+     * sub-interface indents the next level information.
+     * Recurses itself to add sub-classes info.
+     *
+     * @param parent the superclass or superinterface of the sset
+     * @param collection  a collection of the sub-classes at this level
+     * @param isEnum true if we are generating a tree for enums
+     * @param contentTree the content tree to which the level information will be added
+     */
+    protected void addLevelInfo(TypeElement parent, Collection<TypeElement> collection,
+            boolean isEnum, Content contentTree) {
+        if (!collection.isEmpty()) {
+            Content ul = new HtmlTree(HtmlTag.UL);
+            for (TypeElement local : collection) {
+                HtmlTree li = new HtmlTree(HtmlTag.LI);
+                li.addStyle(HtmlStyle.circle);
+                addPartialInfo(local, li);
+                addExtendsImplements(parent, local, li);
+                addLevelInfo(local, classtree.directSubClasses(local, isEnum),
+                             isEnum, li);   // Recurse
+                ul.addContent(li);
+            }
+            contentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the heading for the tree depending upon tree type if it's a
+     * Class Tree or Interface tree.
+     *
+     * @param sset classes which are at the most base level, all the
+     * other classes in this run will derive from these classes
+     * @param heading heading for the tree
+     * @param div the content tree to which the tree will be added
+     */
+    protected void addTree(SortedSet<TypeElement> sset, String heading, HtmlTree div) {
+        addTree(sset, heading, div, false);
+    }
+
+    protected void addTree(SortedSet<TypeElement> sset, String heading,
+                           HtmlTree div, boolean isEnums) {
+        if (!sset.isEmpty()) {
+            TypeElement firstTypeElement = sset.first();
+            Content headingContent = getResource(heading);
+            Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
+                    headingContent);
+            HtmlTree htmlTree;
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                htmlTree = HtmlTree.SECTION(sectionHeading);
+            } else {
+                div.addContent(sectionHeading);
+                htmlTree = div;
+            }
+            addLevelInfo(!utils.isInterface(firstTypeElement) ? firstTypeElement : null,
+                    sset, isEnums, htmlTree);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                div.addContent(htmlTree);
+            }
+        }
+    }
+
+    /**
+     * Add information regarding the classes which this class extends or
+     * implements.
+     *
+     * @param parent the parent class of the class being documented
+     * @param typeElement the TypeElement under consideration
+     * @param contentTree the content tree to which the information will be added
+     */
+    protected void addExtendsImplements(TypeElement parent, TypeElement typeElement,
+            Content contentTree) {
+        SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator());
+        typeElement.getInterfaces().stream().forEach((t) -> {
+            interfaces.add(utils.asTypeElement(t));
+        });
+        if (interfaces.size() > (utils.isInterface(typeElement) ? 1 : 0)) {
+            boolean isFirst = true;
+            for (TypeElement intf : interfaces) {
+                if (parent != intf) {
+                    if (utils.isPublic(intf) || utils.isLinkable(intf)) {
+                        if (isFirst) {
+                            isFirst = false;
+                            if (utils.isInterface(typeElement)) {
+                                contentTree.addContent(" (");
+                                contentTree.addContent(getResource("doclet.also"));
+                                contentTree.addContent(" extends ");
+                            } else {
+                                contentTree.addContent(" (implements ");
+                            }
+                        } else {
+                            contentTree.addContent(", ");
+                        }
+                        addPreQualifiedClassLink(LinkInfoImpl.Kind.TREE, intf, contentTree);
+                    }
+                }
+            }
+            if (!isFirst) {
+                contentTree.addContent(")");
+            }
+        }
+    }
+
+    /**
+     * Add information about the class kind, if it's a "class" or "interface".
+     *
+     * @param typeElement the class being documented
+     * @param contentTree the content tree to which the information will be added
+     */
+    protected void addPartialInfo(TypeElement typeElement, Content contentTree) {
+        addPreQualifiedStrongClassLink(LinkInfoImpl.Kind.TREE, typeElement, contentTree);
+    }
+
+    /**
+     * Get the tree label for the navigation bar.
+     *
+     * @return a content tree for the tree label
+     */
+    protected Content getNavLinkTree() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel);
+        return li;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
+
+
+/**
+ * Generate the file with list of all the classes in this run. This page will be
+ * used in the left-hand bottom frame, when "All Classes" link is clicked in
+ * the left-hand top frame. The name of the generated file is
+ * "allclasses-frame.html".
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Atul M Dambalkar
+ * @author Doug Kramer
+ * @author Bhavesh Patel (Modified)
+ */
+public class AllClassesFrameWriter extends HtmlDocletWriter {
+
+    /**
+     * Index of all the classes.
+     */
+    protected IndexBuilder indexbuilder;
+
+    /**
+     * BR tag to be used within a document tree.
+     */
+    final HtmlTree BR = new HtmlTree(HtmlTag.BR);
+
+    /**
+     * Construct AllClassesFrameWriter object. Also initializes the indexbuilder
+     * variable in this class.
+     * @param configuration  The current configuration
+     * @param filename       Path to the file which is getting generated.
+     * @param indexbuilder   Unicode based Index from {@link IndexBuilder}
+     * @throws IOException
+     * @throws DocletAbortException
+     */
+    public AllClassesFrameWriter(ConfigurationImpl configuration,
+                                 DocPath filename, IndexBuilder indexbuilder)
+                              throws IOException {
+        super(configuration, filename);
+        this.indexbuilder = indexbuilder;
+    }
+
+    /**
+     * Create AllClassesFrameWriter object. Then use it to generate the
+     * "allclasses-frame.html" file. Generate the file in the current or the
+     * destination directory.
+     *
+     * @param indexbuilder IndexBuilder object for all classes index.
+     * @throws DocletAbortException
+     */
+    public static void generate(ConfigurationImpl configuration,
+                                IndexBuilder indexbuilder) {
+        AllClassesFrameWriter allclassgen;
+        DocPath filename = DocPaths.ALLCLASSES_FRAME;
+        try {
+            allclassgen = new AllClassesFrameWriter(configuration,
+                                                    filename, indexbuilder);
+            allclassgen.buildAllClassesFile(true);
+            allclassgen.close();
+            filename = DocPaths.ALLCLASSES_NOFRAME;
+            allclassgen = new AllClassesFrameWriter(configuration,
+                                                    filename, indexbuilder);
+            allclassgen.buildAllClassesFile(false);
+            allclassgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.
+                     error("doclet.exception_encountered",
+                           exc.toString(), filename);
+            throw new DocletAbortException(exc);
+        }
+    }
+
+    /**
+     * Print all the classes in the file.
+     * @param wantFrames True if we want frames.
+     */
+    protected void buildAllClassesFile(boolean wantFrames) throws IOException {
+        String label = configuration.getText("doclet.All_Classes");
+        Content body = getBody(false, getWindowTitle(label));
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
+                HtmlStyle.bar, allclassesLabel);
+        body.addContent(heading);
+        Content ul = new HtmlTree(HtmlTag.UL);
+        // Generate the class links and add it to the tdFont tree.
+        addAllClasses(ul, wantFrames);
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
+                ? HtmlTree.MAIN(HtmlStyle.indexContainer, ul)
+                : HtmlTree.DIV(HtmlStyle.indexContainer, ul);
+        body.addContent(htmlTree);
+        printHtmlDocument(null, false, body);
+    }
+
+    /**
+     * Use the sorted index of all the classes and add all the classes to the
+     * content list.
+     *
+     * @param content HtmlTree content to which all classes information will be added
+     * @param wantFrames True if we want frames.
+     */
+    protected void addAllClasses(Content content, boolean wantFrames) {
+        for (Character unicode : indexbuilder.index()) {
+            addContents(indexbuilder.getMemberList(unicode), wantFrames, content);
+        }
+    }
+
+    /**
+     * Given a list of classes, generate links for each class or interface.
+     * If the class kind is interface, print it in the italics font. Also all
+     * links should target the right-hand frame. If clicked on any class name
+     * in this page, appropriate class page should get opened in the right-hand
+     * frame.
+     *
+     * @param classlist Sorted list of classes.
+     * @param wantFrames True if we want frames.
+     * @param content HtmlTree content to which the links will be added
+     */
+    protected void addContents(Iterable<? extends Element> classlist, boolean wantFrames,
+                               Content content) {
+        for (Element element : classlist) {
+            TypeElement typeElement = (TypeElement)element;
+            if (!utils.isCoreClass(typeElement)) {
+                continue;
+            }
+            Content label = interfaceName(typeElement, false);
+            Content linkContent;
+            if (wantFrames) {
+                linkContent = getLink(new LinkInfoImpl(configuration,
+                                                       LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(label).target("classFrame"));
+            } else {
+                linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, typeElement).label(label));
+            }
+            Content li = HtmlTree.LI(linkContent);
+            content.addContent(li);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeMirror;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
+
+
+/**
+ * Writes annotation type field documentation in HTML format.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
+    implements AnnotationTypeFieldWriter, MemberSummaryWriter {
+
+    /**
+     * Construct a new AnnotationTypeFieldWriterImpl.
+     *
+     * @param writer         the writer that will write the output.
+     * @param annotationType the AnnotationType that holds this member.
+     */
+    public AnnotationTypeFieldWriterImpl(SubWriterHolderWriter writer,
+            TypeElement annotationType) {
+        super(writer, annotationType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberSummaryHeader(TypeElement typeElement,
+            Content memberSummaryTree) {
+        memberSummaryTree.addContent(
+                HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY);
+        Content memberTree = writer.getMemberTreeHeader();
+        writer.addSummaryHeader(this, typeElement, memberTree);
+        return memberTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberTreeHeader() {
+        return writer.getMemberTreeHeader();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotationFieldDetailsMarker(Content memberDetails) {
+        memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_DETAILS);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotationDetailsTreeHeader(TypeElement typeElement,
+            Content memberDetailsTree) {
+        if (!writer.printedAnnotationFieldHeading) {
+            memberDetailsTree.addContent(writer.getMarkerAnchor(
+                    SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
+            Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
+                    writer.fieldDetailsLabel);
+            memberDetailsTree.addContent(heading);
+            writer.printedAnnotationFieldHeading = true;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDocTreeHeader(Element member,
+            Content annotationDetailsTree) {
+        annotationDetailsTree.addContent(
+                writer.getMarkerAnchor(name(member)));
+        Content annotationDocTree = writer.getMemberTreeHeader();
+        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
+        heading.addContent(name(member));
+        annotationDocTree.addContent(heading);
+        return annotationDocTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSignature(Element member) {
+        Content pre = new HtmlTree(HtmlTag.PRE);
+        writer.addAnnotationInfo(member, pre);
+        addModifiers(member, pre);
+        Content link =
+                writer.getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.Kind.MEMBER, getType(member)));
+        pre.addContent(link);
+        pre.addContent(writer.getSpace());
+        if (configuration.linksource) {
+            Content memberName = new StringContent(name(member));
+            writer.addSrcLink(member, memberName, pre);
+        } else {
+            addName(name(member), pre);
+        }
+        return pre;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addDeprecated(Element member, Content annotationDocTree) {
+        addDeprecatedInfo(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addComments(Element member, Content annotationDocTree) {
+        addComment(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addTags(Element member, Content annotationDocTree) {
+        writer.addTagsInfo(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDetails(Content annotationDetailsTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
+            return htmlTree;
+        }
+        return getMemberTree(annotationDetailsTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDoc(Content annotationDocTree,
+            boolean isLastContent) {
+        return getMemberTree(annotationDocTree, isLastContent);
+    }
+
+    /**
+     * Close the writer.
+     */
+    public void close() throws IOException {
+        writer.close();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryLabel(Content memberTree) {
+        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
+                writer.getResource("doclet.Field_Summary"));
+        memberTree.addContent(label);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getTableSummary() {
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Field_Summary"),
+                configuration.getText("doclet.fields"));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getCaption() {
+        return configuration.getResource("doclet.Fields");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getSummaryTableHeader(Element member) {
+        List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
+                configuration.getText("doclet.0_and_1",
+                        configuration.getText("doclet.Fields"),
+                        configuration.getText("doclet.Description")));
+        return header;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryAnchor(TypeElement typeElement, Content memberTree) {
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.ANNOTATION_TYPE_FIELD_SUMMARY));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryAnchor(TypeElement typeElement, Content inheritedTree) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element member,
+            Content tdSummary) {
+        Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
+                writer.getDocLink(context, member, name(member), false));
+        Content code = HtmlTree.CODE(memberLink);
+        tdSummary.addContent(code);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addInheritedSummaryLink(TypeElement typeElement,
+            Element member, Content linksTree) {
+        //Not applicable.
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryType(Element member, Content tdSummaryType) {
+        addModifierAndType(member, getType(member), tdSummaryType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getDeprecatedLink(Element member) {
+        return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
+                member, utils.getFullyQualifiedName(member));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getNavSummaryLink(TypeElement typeElement, boolean link) {
+        if (link) {
+            return writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_FIELD_SUMMARY,
+                    writer.getResource("doclet.navField"));
+        } else {
+            return writer.getResource("doclet.navField");
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavDetailLink(boolean link, Content liNav) {
+        if (link) {
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_FIELD_DETAIL,
+                    writer.getResource("doclet.navField")));
+        } else {
+            liNav.addContent(writer.getResource("doclet.navField"));
+        }
+    }
+    private TypeMirror getType(Element member) {
+        if (utils.isConstructor(member))
+            return null;
+        if (utils.isExecutableElement(member))
+            return utils.getReturnType((ExecutableElement)member);
+        return member.asType();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeOptionalMemberWriter;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
+
+
+/**
+ * Writes annotation type optional member documentation in HTML format.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
+ */
+public class AnnotationTypeOptionalMemberWriterImpl extends
+        AnnotationTypeRequiredMemberWriterImpl
+    implements AnnotationTypeOptionalMemberWriter, MemberSummaryWriter {
+
+    /**
+     * Construct a new AnnotationTypeOptionalMemberWriterImpl.
+     *
+     * @param writer         the writer that will write the output.
+     * @param annotationType the AnnotationType that holds this member.
+     */
+    public AnnotationTypeOptionalMemberWriterImpl(SubWriterHolderWriter writer,
+        TypeElement annotationType) {
+        super(writer, annotationType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberSummaryHeader(TypeElement typeElement,
+            Content memberSummaryTree) {
+        memberSummaryTree.addContent(
+                HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
+        Content memberTree = writer.getMemberTreeHeader();
+        writer.addSummaryHeader(this, typeElement, memberTree);
+        return memberTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addDefaultValueInfo(Element member, Content annotationDocTree) {
+        if (utils.isAnnotationType(member)) {
+            ExecutableElement ee = (ExecutableElement)member;
+            AnnotationValue value = ee.getDefaultValue();
+            if (value != null) {
+                Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
+                Content dl = HtmlTree.DL(dt);
+                Content dd = HtmlTree.DD(new StringContent(value.toString()));
+                dl.addContent(dd);
+                annotationDocTree.addContent(dl);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        writer.close();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryLabel(Content memberTree) {
+        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
+                writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
+        memberTree.addContent(label);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getTableSummary() {
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Type_Optional_Member_Summary"),
+                configuration.getText("doclet.annotation_type_optional_members"));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getCaption() {
+        return configuration.getResource("doclet.Annotation_Type_Optional_Members");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getSummaryTableHeader(Element member) {
+        List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
+                configuration.getText("doclet.0_and_1",
+                        configuration.getText("doclet.Annotation_Type_Optional_Member"),
+                        configuration.getText("doclet.Description")));
+        return header;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryAnchor(TypeElement typeElement, Content memberTree) {
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getNavSummaryLink(TypeElement typeElement, boolean link) {
+        if (link) {
+            return writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY,
+                    writer.getResource("doclet.navAnnotationTypeOptionalMember"));
+        } else {
+            return writer.getResource("doclet.navAnnotationTypeOptionalMember");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeMirror;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
+
+
+/**
+ * Writes annotation type required member documentation in HTML format.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
+ */
+public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
+    implements AnnotationTypeRequiredMemberWriter, MemberSummaryWriter {
+
+    /**
+     * Construct a new AnnotationTypeRequiredMemberWriterImpl.
+     *
+     * @param writer         the writer that will write the output.
+     * @param annotationType the AnnotationType that holds this member.
+     */
+    public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer,
+            TypeElement annotationType) {
+        super(writer, annotationType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberSummaryHeader(TypeElement typeElement,
+            Content memberSummaryTree) {
+        memberSummaryTree.addContent(
+                HtmlConstants.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY);
+        Content memberTree = writer.getMemberTreeHeader();
+        writer.addSummaryHeader(this, typeElement, memberTree);
+        return memberTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberTreeHeader() {
+        return writer.getMemberTreeHeader();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotationDetailsMarker(Content memberDetails) {
+        memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotationDetailsTreeHeader(TypeElement classDoc,
+            Content memberDetailsTree) {
+        if (!writer.printedAnnotationHeading) {
+            memberDetailsTree.addContent(writer.getMarkerAnchor(
+                    SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
+            Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
+                    writer.annotationTypeDetailsLabel);
+            memberDetailsTree.addContent(heading);
+            writer.printedAnnotationHeading = true;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDocTreeHeader(Element member,
+            Content annotationDetailsTree) {
+        String simpleName = name(member);
+        annotationDetailsTree.addContent(writer.getMarkerAnchor(simpleName +
+                utils.signature((ExecutableElement) member)));
+        Content annotationDocTree = writer.getMemberTreeHeader();
+        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
+        heading.addContent(simpleName);
+        annotationDocTree.addContent(heading);
+        return annotationDocTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSignature(Element member) {
+        Content pre = new HtmlTree(HtmlTag.PRE);
+        writer.addAnnotationInfo(member, pre);
+        addModifiers(member, pre);
+        Content link =
+                writer.getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.Kind.MEMBER, getType(member)));
+        pre.addContent(link);
+        pre.addContent(writer.getSpace());
+        if (configuration.linksource) {
+            Content memberName = new StringContent(name(member));
+            writer.addSrcLink(member, memberName, pre);
+        } else {
+            addName(name(member), pre);
+        }
+        return pre;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addDeprecated(Element member, Content annotationDocTree) {
+        addDeprecatedInfo(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addComments(Element member, Content annotationDocTree) {
+        addComment(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addTags(Element member, Content annotationDocTree) {
+        writer.addTagsInfo(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDetails(Content annotationDetailsTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
+            return htmlTree;
+        }
+        return getMemberTree(annotationDetailsTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDoc(Content annotationDocTree,
+            boolean isLastContent) {
+        return getMemberTree(annotationDocTree, isLastContent);
+    }
+
+    /**
+     * Close the writer.
+     */
+    public void close() throws IOException {
+        writer.close();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryLabel(Content memberTree) {
+        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
+                writer.getResource("doclet.Annotation_Type_Required_Member_Summary"));
+        memberTree.addContent(label);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getTableSummary() {
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Type_Required_Member_Summary"),
+                configuration.getText("doclet.annotation_type_required_members"));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getCaption() {
+        return configuration.getResource("doclet.Annotation_Type_Required_Members");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getSummaryTableHeader(Element member) {
+        List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
+                configuration.getText("doclet.0_and_1",
+                        configuration.getText("doclet.Annotation_Type_Required_Member"),
+                        configuration.getText("doclet.Description")));
+        return header;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryAnchor(TypeElement typeElement, Content memberTree) {
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryAnchor(TypeElement typeElement, Content inheritedTree) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element member,
+            Content tdSummary) {
+        Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
+                writer.getDocLink(context, member, name(member), false));
+        Content code = HtmlTree.CODE(memberLink);
+        tdSummary.addContent(code);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addInheritedSummaryLink(TypeElement typeElement,
+            Element member, Content linksTree) {
+        //Not applicable.
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryType(Element member, Content tdSummaryType) {
+        addModifierAndType(member, getType(member), tdSummaryType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getDeprecatedLink(Element member) {
+        String name = utils.getFullyQualifiedName(member) + "." + member.getSimpleName();
+        return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, member, name);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getNavSummaryLink(TypeElement typeElement, boolean link) {
+        if (link) {
+            return writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY,
+                    writer.getResource("doclet.navAnnotationTypeRequiredMember"));
+        } else {
+            return writer.getResource("doclet.navAnnotationTypeRequiredMember");
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavDetailLink(boolean link, Content liNav) {
+        if (link) {
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL,
+                    writer.getResource("doclet.navAnnotationTypeMember")));
+        } else {
+            liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
+        }
+    }
+
+    private TypeMirror getType(Element member) {
+        return utils.isExecutableElement(member)
+                ? utils.getReturnType((ExecutableElement) member)
+                : member.asType();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeMirror;
+
+import com.sun.source.doctree.DocTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder;
+import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
+
+/**
+ * Generate the Class Information Page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @see java.util.Collections
+ * @see java.util.List
+ * @see java.util.ArrayList
+ * @see java.util.HashMap
+ *
+ * @author Atul M Dambalkar
+ * @author Robert Field
+ * @author Bhavesh Patel (Modified)
+ */
+public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
+        implements AnnotationTypeWriter {
+
+    protected TypeElement annotationType;
+
+    protected TypeMirror prev;
+
+    protected TypeMirror next;
+
+    /**
+     * @param configuration the configuration
+     * @param annotationType the annotation type being documented.
+     * @param prevType the previous class that was documented.
+     * @param nextType the next class being documented.
+     * @throws java.lang.Exception
+     */
+    public AnnotationTypeWriterImpl(ConfigurationImpl configuration,
+            TypeElement annotationType, TypeMirror prevType, TypeMirror nextType)
+            throws Exception {
+        super(configuration, DocPath.forClass(configuration.utils, annotationType));
+        this.annotationType = annotationType;
+        configuration.currentTypeElement = annotationType;
+        this.prev = prevType;
+        this.next = nextType;
+    }
+
+    /**
+     * Get this package link.
+     *
+     * @return a content tree for the package link
+     */
+    @Override
+    protected Content getNavLinkPackage() {
+        Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
+                packageLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
+     * Get the class link.
+     *
+     * @return a content tree for the class link
+     */
+    @Override
+    protected Content getNavLinkClass() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
+        return li;
+    }
+
+    /**
+     * Get the class use link.
+     *
+     * @return a content tree for the class use link
+     */
+    @Override
+    protected Content getNavLinkClassUse() {
+        Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
+     * Get link to previous class.
+     *
+     * @return a content tree for the previous class link
+     */
+    @Override
+    public Content getNavLinkPrevious() {
+        Content li;
+        if (prev != null) {
+            Content prevLink = getLink(new LinkInfoImpl(configuration,
+                    LinkInfoImpl.Kind.CLASS, utils.asTypeElement(prev))
+                    .label(prevclassLabel).strong(true));
+            li = HtmlTree.LI(prevLink);
+        }
+        else
+            li = HtmlTree.LI(prevclassLabel);
+        return li;
+    }
+
+    /**
+     * Get link to next class.
+     *
+     * @return a content tree for the next class link
+     */
+    @Override
+    public Content getNavLinkNext() {
+        Content li;
+        if (next != null) {
+            Content nextLink = getLink(new LinkInfoImpl(configuration,
+                    LinkInfoImpl.Kind.CLASS, utils.asTypeElement(next))
+                    .label(nextclassLabel).strong(true));
+            li = HtmlTree.LI(nextLink);
+        }
+        else
+            li = HtmlTree.LI(nextclassLabel);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Content getHeader(String header) {
+        HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getSimpleName(annotationType)));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
+                ? HtmlTree.HEADER()
+                : bodyTree;
+        addTop(htmlTree);
+        addNavLinks(true, htmlTree);
+        if (configuration.allowTag(HtmlTag.HEADER)) {
+            bodyTree.addContent(htmlTree);
+        }
+        bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.header);
+        PackageElement pkg = utils.containingPackage(annotationType);
+        if (!pkg.isUnnamed()) {
+            Content pkgNameContent = new StringContent(utils.getPackageName(pkg));
+            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
+            div.addContent(pkgNameDiv);
+        }
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
+                LinkInfoImpl.Kind.CLASS_HEADER, annotationType);
+        Content headerContent = new StringContent(header);
+        Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
+                HtmlStyle.title, headerContent);
+        heading.addContent(getTypeParameterLinks(linkInfo));
+        div.addContent(heading);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(div);
+        } else {
+            bodyTree.addContent(div);
+        }
+        return bodyTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Content getAnnotationContentHeader() {
+        return getContentHeader();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addFooter(Content contentTree) {
+        contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
+        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
+                ? HtmlTree.FOOTER()
+                : contentTree;
+        addNavLinks(false, htmlTree);
+        addBottom(htmlTree);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            contentTree.addContent(htmlTree);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void printDocument(Content contentTree) throws IOException {
+        printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
+                true, contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Content getAnnotationInfoTreeHeader() {
+        return getMemberTreeHeader();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Content getAnnotationInfo(Content annotationInfoTree) {
+        return getMemberTree(HtmlStyle.description, annotationInfoTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
+        annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR));
+        Content pre = new HtmlTree(HtmlTag.PRE);
+        addAnnotationInfo(annotationType, pre);
+        pre.addContent(modifiers);
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
+                LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
+        Content annotationName = new StringContent(utils.getSimpleName(annotationType));
+        Content parameterLinks = getTypeParameterLinks(linkInfo);
+        if (configuration.linksource) {
+            addSrcLink(annotationType, annotationName, pre);
+            pre.addContent(parameterLinks);
+        } else {
+            Content span = HtmlTree.SPAN(HtmlStyle.memberNameLabel, annotationName);
+            span.addContent(parameterLinks);
+            pre.addContent(span);
+        }
+        annotationInfoTree.addContent(pre);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addAnnotationTypeDescription(Content annotationInfoTree) {
+        if(!configuration.nocomment) {
+            if (!utils.getBody(annotationType).isEmpty()) {
+                addInlineComment(annotationType, annotationInfoTree);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addAnnotationTypeTagInfo(Content annotationInfoTree) {
+        if(!configuration.nocomment) {
+            addTagsInfo(annotationType, annotationInfoTree);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
+        Content hr = new HtmlTree(HtmlTag.HR);
+        annotationInfoTree.addContent(hr);
+        List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
+        if (utils.isDeprecated(annotationType)) {
+            CommentHelper ch = utils.getCommentHelper(annotationType);
+            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+            Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
+            if (!deprs.isEmpty()) {
+
+                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
+                if (!commentTags.isEmpty()) {
+                    div.addContent(getSpace());
+                    addInlineDeprecatedComment(annotationType, deprs.get(0), div);
+                }
+            }
+            annotationInfoTree.addContent(div);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Content getNavLinkTree() {
+        Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
+                treeLabel, "", "");
+        Content li = HtmlTree.LI(treeLinkContent);
+        return li;
+    }
+
+    /**
+     * Add summary details to the navigation bar.
+     *
+     * @param subDiv the content tree to which the summary detail links will be added
+     */
+    @Override
+    protected void addSummaryDetailLinks(Content subDiv) {
+        try {
+            Content div = HtmlTree.DIV(getNavSummaryLinks());
+            div.addContent(getNavDetailLinks());
+            subDiv.addContent(div);
+        } catch (Exception e) {
+            throw new DocletAbortException(e);
+        }
+    }
+
+    /**
+     * Get summary links for navigation bar.
+     *
+     * @return the content tree for the navigation summary links
+     * @throws java.lang.Exception
+     */
+    protected Content getNavSummaryLinks() throws Exception {
+        Content li = HtmlTree.LI(summaryLabel);
+        li.addContent(getSpace());
+        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
+        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+        Content liNavField = new HtmlTree(HtmlTag.LI);
+        addNavSummaryLink(memberSummaryBuilder,
+                "doclet.navField",
+                VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS, liNavField);
+        addNavGap(liNavField);
+        ulNav.addContent(liNavField);
+        Content liNavReq = new HtmlTree(HtmlTag.LI);
+        addNavSummaryLink(memberSummaryBuilder,
+                "doclet.navAnnotationTypeRequiredMember",
+                VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED, liNavReq);
+        addNavGap(liNavReq);
+        ulNav.addContent(liNavReq);
+        Content liNavOpt = new HtmlTree(HtmlTag.LI);
+        addNavSummaryLink(memberSummaryBuilder,
+                "doclet.navAnnotationTypeOptionalMember",
+                VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL, liNavOpt);
+        ulNav.addContent(liNavOpt);
+        return ulNav;
+    }
+
+    /**
+     * Add the navigation summary link.
+     *
+     * @param builder builder for the member to be documented
+     * @param label the label for the navigation
+     * @param type type to be documented
+     * @param liNav the content tree to which the navigation summary link will be added
+     */
+    protected void addNavSummaryLink(MemberSummaryBuilder builder,
+            String label, VisibleMemberMap.Kind type, Content liNav) {
+        AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
+                getMemberSummaryWriter(type));
+        if (writer == null) {
+            liNav.addContent(getResource(label));
+        } else {
+            liNav.addContent(writer.getNavSummaryLink(null,
+                    ! builder.getVisibleMemberMap(type).noVisibleMembers()));
+        }
+    }
+
+    /**
+     * Get detail links for the navigation bar.
+     *
+     * @return the content tree for the detail links
+     * @throws java.lang.Exception
+     */
+    protected Content getNavDetailLinks() throws Exception {
+        Content li = HtmlTree.LI(detailLabel);
+        li.addContent(getSpace());
+        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
+        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+        AbstractMemberWriter writerField =
+                ((AbstractMemberWriter) memberSummaryBuilder.
+                getMemberSummaryWriter(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS));
+        AbstractMemberWriter writerOptional =
+                ((AbstractMemberWriter) memberSummaryBuilder.
+                getMemberSummaryWriter(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL));
+        AbstractMemberWriter writerRequired =
+                ((AbstractMemberWriter) memberSummaryBuilder.
+                getMemberSummaryWriter(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED));
+        Content liNavField = new HtmlTree(HtmlTag.LI);
+        if (writerField != null) {
+            writerField.addNavDetailLink(!utils.getAnnotationFields(annotationType).isEmpty(), liNavField);
+        } else {
+            liNavField.addContent(getResource("doclet.navField"));
+        }
+        addNavGap(liNavField);
+        ulNav.addContent(liNavField);
+        if (writerOptional != null){
+            Content liNavOpt = new HtmlTree(HtmlTag.LI);
+            writerOptional.addNavDetailLink(!annotationType.getAnnotationMirrors().isEmpty(), liNavOpt);
+            ulNav.addContent(liNavOpt);
+        } else if (writerRequired != null){
+            Content liNavReq = new HtmlTree(HtmlTag.LI);
+            writerRequired.addNavDetailLink(!annotationType.getAnnotationMirrors().isEmpty(), liNavReq);
+            ulNav.addContent(liNavReq);
+        } else {
+            Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember"));
+            ulNav.addContent(liNav);
+        }
+        return ulNav;
+    }
+
+    /**
+     * Add gap between navigation bar elements.
+     *
+     * @param liNav the content tree to which the gap will be added
+     */
+    protected void addNavGap(Content liNav) {
+        liNav.addContent(getSpace());
+        liNav.addContent("|");
+        liNav.addContent(getSpace());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public TypeElement getAnnotationTypeElement() {
+        return annotationType;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Thu Jan 28 15:42:06 2016 -0800
@@ -0,0 +1,554 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
+import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+
+/**
+ * Generate class usage information.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Robert G. Field
+ * @author Bhavesh Patel (Modified)
+ */
+public class ClassUseWriter extends SubWriterHolderWriter {
+
+    final TypeElement typeElement;
+    Set<PackageElement> pkgToPackageAnnotations = null;
+    final Map<PackageElement, List<Element>> pkgToClassTypeParameter;
+    final Map<PackageElement, List<Element>> pkgToClassAnnotations;
+    final Map<PackageElement, List<Element>> pkgToMethodTypeParameter;
+    final Map<PackageElement, List<Element>> pkgToMethodArgTypeParameter;
+    final Map<PackageElement, List<Element>> pkgToMethodReturnTypeParameter;
+    final Map<PackageElement, List<Element>> pkgToMethodAnnotations;
+    final Map<PackageElement, List<Element>> pkgToMethodParameterAnnotations;
+    final Map<PackageElement, List<Element>> pkgToFieldTypeParameter;
+    final Map<PackageElement, List<Element>> pkgToFieldAnnotations;
+    final Map<PackageElement, List<Element>> pkgToSubclass;
+    final Map<PackageElement, List<Element>> pkgToSubinterface;
+    final Map<PackageElement, List<Element>> pkgToImplementingClass;
+    final Map<PackageElement, List<Element>> pkgToField;
+    final Map<PackageElement, List<Element>> pkgToMethodReturn;
+    final Map<PackageElement, List<Element>> pkgToMethodArgs;
+    final Map<PackageElement, List<Element>> pkgToMethodThrows;
+    final Map<PackageElement, List<Element>> pkgToConstructorAnnotations;
+    final Map<PackageElement, List<Element>> pkgToConstructorParameterAnnotations;
+    final Map<PackageElement, List<Element>> pkgToConstructorArgs;
+    final Map<PackageElement, List<Element>> pkgToConstructorArgTypeParameter;
+    final Map<PackageElement, List<Element>> pkgToConstructorThrows;
+    final SortedSet<PackageElement> pkgSet;
+    final MethodWriterImpl methodSubWriter;
+    final ConstructorWriterImpl constrSubWriter;
+    final FieldWriterImpl fieldSubWriter;
+    final NestedClassWriterImpl classSubWriter;
+    // Summary for various use tables.
+    final String classUseTableSummary;
+    final String subclassUseTableSummary;
+    final String subinterfaceUseTableSummary;
+    final String fieldUseTableSummary;
+    final String methodUseTableSummary;
+    final String constructorUseTableSummary;
+
+    /**
+     * The HTML tree for main tag.
+     */
+    protected HtmlTree mainTree = HtmlTree.MAIN();
+
+    /**
+     * Constructor.
+     *
+     * @param filename the file to be generated.
+     * @throws IOException
+     * @throws DocletAbortException
+     */
+    public ClassUseWriter(ConfigurationImpl configuration,
+                          ClassUseMapper mapper, DocPath filename,
+                          TypeElement typeElement) throws IOException {
+        super(configuration, filename);
+        this.typeElement = typeElement;
+        if (mapper.classToPackageAnnotations.containsKey(typeElement)) {
+            pkgToPackageAnnotations = new TreeSet<>(utils.makeClassUseComparator());
+            pkgToPackageAnnotations.addAll(mapper.classToPackageAnnotations.get(typeElement));
+        }
+        configuration.currentTypeElement = typeElement;
+        this.pkgSet = new TreeSet<>(utils.makePackageComparator());
+        this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam);
+        this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations);
+        this.pkgToMethodTypeParameter = pkgDivide(mapper.classToMethodTypeParam);
+        this.pkgToMethodArgTypeParameter = pkgDivide(mapper.classToMethodArgTypeParam);
+        this.pkgToFieldTypeParameter = pkgDivide(mapper.classToFieldTypeParam);
+        this.pkgToFieldAnnotations = pkgDivide(mapper.annotationToField);
+        this.pkgToMethodReturnTypeParameter = pkgDivide(mapper.classToMethodReturnTypeParam);
+        this.pkgToMethodAnnotations = pkgDivide(mapper.classToMethodAnnotations);
+        this.pkgToMethodParameterAnnotations = pkgDivide(mapper.classToMethodParamAnnotation);
+        this.pkgToSubclass = pkgDivide(mapper.classToSubclass);
+        this.pkgToSubinterface = pkgDivide(mapper.classToSubinterface);
+        this.pkgToImplementingClass = pkgDivide(mapper.classToImplementingClass);
+        this.pkgToField = pkgDivide(mapper.classToField);
+        this.pkgToMethodReturn = pkgDivide(mapper.classToMethodReturn);
+        this.pkgToMethodArgs = pkgDivide(mapper.classToMethodArgs);
+        this.pkgToMethodThrows = pkgDivide(mapper.classToMethodThrows);
+        this.pkgToConstructorAnnotations = pkgDivide(mapper.classToConstructorAnnotations);
+        this.pkgToConstructorParameterAnnotations = pkgDivide(mapper.classToConstructorParamAnnotation);
+        this.pkgToConstructorArgs = pkgDivide(mapper.classToConstructorArgs);
+        this.pkgToConstructorArgTypeParameter = pkgDivide(mapper.classToConstructorArgTypeParam);
+        this.pkgToConstructorThrows = pkgDivide(mapper.classToConstructorThrows);
+        //tmp test
+        if (pkgSet.size() > 0 &&
+            mapper.classToPackage.containsKey(this.typeElement) &&
+            !pkgSet.equals(mapper.classToPackage.get(this.typeElement))) {
+            configuration.reporter.print(Diagnostic.Kind.WARNING,
+                    "Internal error: package sets don't match: "
+                    + pkgSet + " with: " + mapper.classToPackage.get(this.typeElement));
+        }
+        methodSubWriter = new MethodWriterImpl(this);
+        constrSubWriter = new ConstructorWriterImpl(this);
+        fieldSubWriter = new FieldWriterImpl(this);
+        classSubWriter = new NestedClassWriterImpl(this);
+        classUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
+                configuration.getText("doclet.classes"));
+        subclassUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
+                configuration.getText("doclet.subclasses"));
+        subinterfaceUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
+                configuration.getText("doclet.subinterfaces"));
+        fieldUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
+                configuration.getText("doclet.fields"));
+        methodUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
+                configuration.getText("doclet.methods"));
+        constructorUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
+                configuration.getText("doclet.constructors"));
+    }
+
+    /**
+     * Write out class use pages.
+     * @throws DocletAbortException
+     */
+    public static void generate(ConfigurationImpl configuration, ClassTree classtree)  {
+        ClassUseMapper mapper = new ClassUseMapper(configuration, classtree);
+        for (TypeElement aClass : configuration.root.getIncludedClasses()) {
+            // If -nodeprecated option is set and the containing package is marked
+            // as deprecated, do not generate the class-use page. We will still generate
+            // the class-use page if the class is marked as deprecated but the containing
+            // package is not since it could still be linked from that package-use page.
+            if (!(configuration.nodeprecated &&
+                  configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass))))
+                ClassUseWriter.generate(configuration, mapper, aClass);
+        }
+        for (PackageElement pkg : configuration.packages) {
+            // If -nodeprecated option is set and the package is marked
+            // as deprecated, do not generate the package-use page.
+            if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg)))
+                PackageUseWriter.generate(configuration, mapper, pkg);
+        }
+    }
+
+    private Map<PackageElement, List<Element>> pkgDivide(Map<TypeElement, ? extends List<? extends Element>> classMap) {
+        Map<PackageElement, List<Element>> map = new HashMap<>();
+        List<? extends Element> elements = (List<? extends Element>) classMap.get(typeElement);
+        if (elements != null) {
+            Collections.sort(elements, utils.makeClassUseComparator());
+            for (Element e : elements) {
+                PackageElement pkg = utils.containingPackage(e);
+                pkgSet.add(pkg);
+                List<Element> inPkg = map.get(pkg);
+                if (inPkg == null) {
+                    inPkg = new ArrayList<>();
+                    map.put(pkg, inPkg);
+                }
+                inPkg.add(e);
+            }
+        }
+        return map;
+    }
+
+    /**
+     * Generate a class page.
+     */
+    public static void generate(ConfigurationImpl configuration, ClassUseMapper mapper,
+                                TypeElement typeElement) {
+        ClassUseWriter clsgen;
+        DocPath path = DocPath.forPackage(configuration.utils, typeElement)
+                              .resolve(DocPaths.CLASS_USE)
+                              .resolve(DocPath.forName(configuration.utils, typeElement));
+        try {
+            clsgen = new ClassUseWriter(configuration, mapper, path, typeElement);
+            clsgen.generateClassUseFile();
+            clsgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.
+                error("doclet.exception_encountered",
+                      exc.toString(), path.getPath());
+            thr