8039028: [javadoc] refactor the usage of Util.java
authorksrini
Sun, 15 Jun 2014 08:41:57 -0700
changeset 25454 376a52c9540c
parent 25453 be80cf0463b3
child 25455 acabdf6da9db
8039028: [javadoc] refactor the usage of Util.java Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/CommentedMethodFinder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/TaggedMethodFinder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -121,7 +121,7 @@
      * @param dlTree the content tree to which the description will be added
      */
     protected void addDescription(PackageDoc pkg, Content dlTree) {
-        Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg)));
+        Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
         Content dt = HtmlTree.DT(link);
         dt.addContent(" - ");
         dt.addContent(getResource("doclet.package"));
@@ -159,9 +159,9 @@
      */
     protected void addClassInfo(ClassDoc cd, Content contentTree) {
         contentTree.addContent(getResource("doclet.in",
-                Util.getTypeName(configuration, cd, false),
+                utils.getTypeName(configuration, cd, false),
                 getPackageLink(cd.containingPackage(),
-                    Util.getPackageName(cd.containingPackage()))
+                    utils.getPackageName(cd.containingPackage()))
                 ));
     }
 
@@ -200,7 +200,7 @@
         Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.block);
-        if (Util.isDeprecated(element)) {
+        if (utils.isDeprecated(element)) {
             div.addContent(span);
             if ((tags = element.tags("deprecated")).length > 0)
                 addInlineDeprecatedComment(element, tags[0], div);
@@ -208,7 +208,7 @@
         } else {
             ClassDoc cont = element.containingClass();
             while (cont != null) {
-                if (Util.isDeprecated(cont)) {
+                if (utils.isDeprecated(cont)) {
                     div.addContent(span);
                     contentTree.addContent(div);
                     break;
@@ -228,7 +228,7 @@
      */
     protected void addMemberDesc(MemberDoc member, Content contentTree) {
         ClassDoc containing = member.containingClass();
-        String classdesc = Util.getTypeName(
+        String classdesc = utils.getTypeName(
                 configuration, containing, true) + " ";
         if (member.isField()) {
             if (member.isStatic()) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,6 +50,7 @@
 public abstract class AbstractMemberWriter {
 
     protected final ConfigurationImpl configuration;
+    protected final Utils utils;
     protected final SubWriterHolderWriter writer;
     protected final ClassDoc classdoc;
     protected Map<String,Integer> typeMap = new LinkedHashMap<>();
@@ -64,6 +65,7 @@
         this.writer = writer;
         this.nodepr = configuration.nodeprecated;
         this.classdoc = classdoc;
+        this.utils = writer.configuration.utils;
     }
 
     public AbstractMemberWriter(SubWriterHolderWriter writer) {
@@ -244,8 +246,8 @@
             // it is updated to use the javax.lang.model.element.Modifier, we
             // will need to remove this.
             mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ?
-                    Util.replaceText(mod, "public", "default").trim() :
-                    Util.replaceText(mod, "public", "").trim();
+                    utils.replaceText(mod, "public", "default").trim() :
+                    utils.replaceText(mod, "public", "").trim();
         }
         if(mod.length() > 0) {
             htmltree.addContent(mod);
@@ -538,7 +540,7 @@
     }
 
     public ProgramElementDoc[] eligibleMembers(ProgramElementDoc[] members) {
-        return nodepr? Util.excludeDeprecatedMembers(members): members;
+        return nodepr? utils.excludeDeprecatedMembers(members): members;
     }
 
     /**
@@ -573,7 +575,7 @@
                         ? methodType | MethodTypes.ABSTRACT.value()
                         : methodType | MethodTypes.CONCRETE.value();
             }
-            if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
+            if (utils.isDeprecated(member) || utils.isDeprecated(classdoc)) {
                 methodType = methodType | MethodTypes.DEPRECATED.value();
             }
             methodTypesOr = methodTypesOr | methodType;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -137,7 +137,7 @@
             for (ClassDoc intf : interfaces) {
                 if (parent != intf) {
                     if (!(intf.isPublic() ||
-                          Util.isLinkable(intf, configuration))) {
+                          utils.isLinkable(intf, configuration))) {
                         continue;
                     }
                     if (counter == 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -153,7 +153,7 @@
                                Content content) {
         for (Doc doc : classlist) {
             ClassDoc cd = (ClassDoc) doc;
-            if (!Util.isCoreClass(cd)) {
+            if (!utils.isCoreClass(cd)) {
                 continue;
             }
             Content label = italicsClassName(cd, false);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -261,7 +261,7 @@
         Content hr = new HtmlTree(HtmlTag.HR);
         annotationInfoTree.addContent(hr);
         Tag[] deprs = annotationType.tags("deprecated");
-        if (Util.isDeprecated(annotationType)) {
+        if (utils.isDeprecated(annotationType)) {
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (deprs.length > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -165,13 +165,13 @@
             // 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 &&
-                  Util.isDeprecated(aClass.containingPackage())))
+                  configuration.utils.isDeprecated(aClass.containingPackage())))
                 ClassUseWriter.generate(configuration, mapper, aClass);
         }
         for (PackageDoc 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 && Util.isDeprecated(pkg)))
+            if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg)))
                 PackageUseWriter.generate(configuration, mapper, pkg);
         }
     }
@@ -180,7 +180,7 @@
         Map<String,List<ProgramElementDoc>> map = new HashMap<>();
         List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
         if (list != null) {
-            Collections.sort(list, Util.makeComparatorForClassUse());
+            Collections.sort(list, utils.makeComparatorForClassUse());
             for (ProgramElementDoc doc : list) {
                 PackageDoc pkg = doc.containingPackage();
                 pkgSet.add(pkg);
@@ -337,7 +337,7 @@
             Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
                                        getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
                                                                 classdoc)),
-                                       getPackageLink(pkg, Util.getPackageName(pkg)));
+                                       getPackageLink(pkg, utils.getPackageName(pkg)));
             Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
             li.addContent(heading);
             addClassUse(pkg, li);
@@ -355,7 +355,7 @@
      */
     protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
         Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
-                getHyperLink(pkg.name(), new StringContent(Util.getPackageName(pkg))));
+                getHyperLink(pkg.name(), new StringContent(utils.getPackageName(pkg))));
         contentTree.addContent(tdFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
@@ -372,7 +372,7 @@
     protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
         Content classLink = getLink(new LinkInfoImpl(configuration,
             LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc));
-        Content pkgLink = getPackageLink(pkg, Util.getPackageName(pkg));
+        Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg));
         classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
                 configuration.getResource("doclet.ClassUse_Annotation", classLink,
                 pkgLink), classUseTableSummary, contentTree);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -260,7 +260,7 @@
             pre.addContent(span);
         }
         if (!isInterface) {
-            Type superclass = Util.getFirstVisibleSuperClass(classDoc,
+            Type superclass = utils.getFirstVisibleSuperClass(classDoc,
                     configuration);
             if (superclass != null) {
                 pre.addContent(DocletConstants.NL);
@@ -276,7 +276,7 @@
             int counter = 0;
             for (Type implType : implIntfacs) {
                 ClassDoc classDoc = implType.asClassDoc();
-                if (!(classDoc.isPublic() || Util.isLinkable(classDoc, configuration))) {
+                if (!(classDoc.isPublic() || utils.isLinkable(classDoc, configuration))) {
                     continue;
                 }
                 if (counter == 0) {
@@ -329,7 +329,7 @@
         classTreeUl.addStyle(HtmlStyle.inheritance);
         Content liTree = null;
         do {
-            sup = Util.getFirstVisibleSuperClass(
+            sup = utils.getFirstVisibleSuperClass(
                     type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
                     configuration);
             if (sup != null) {
@@ -471,7 +471,7 @@
     public void addImplementedInterfacesInfo(Content classInfoTree) {
         //NOTE:  we really should be using ClassDoc.interfaceTypes() here, but
         //       it doesn't walk up the tree like we want it to.
-        List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
+        List<Type> interfaceArray = utils.getAllInterfaces(classDoc, configuration);
         if (classDoc.isClass() && interfaceArray.size() > 0) {
             Content label = getResource(
                     "doclet.All_Implemented_Interfaces");
@@ -489,7 +489,7 @@
     public void addSuperInterfacesInfo(Content classInfoTree) {
         //NOTE:  we really should be using ClassDoc.interfaceTypes() here, but
         //       it doesn't walk up the tree like we want it to.
-        List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
+        List<Type> interfaceArray = utils.getAllInterfaces(classDoc, configuration);
         if (classDoc.isInterface() && interfaceArray.size() > 0) {
             Content label = getResource(
                     "doclet.All_Superinterfaces");
@@ -559,7 +559,7 @@
         Content hr = new HtmlTree(HtmlTag.HR);
         classInfoTree.addContent(hr);
         Tag[] deprs = classDoc.tags("deprecated");
-        if (Util.isDeprecated(classDoc)) {
+        if (utils.isDeprecated(classDoc)) {
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (deprs.length > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -130,7 +130,7 @@
         ClassDoc holder = field.containingClass();
         if (field.inlineTags().length > 0) {
             if (holder.equals(classdoc) ||
-                    (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
+                    (! (holder.isPublic() || utils.isLinkable(holder, configuration)))) {
                 writer.addInlineComment(field, fieldDocTree);
             } else {
                 Content link =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Sun Jun 15 08:41:57 2014 -0700
@@ -28,7 +28,6 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
-import com.sun.tools.javac.sym.Profiles;
 import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
@@ -223,7 +222,7 @@
                     // deprecated, do not generate the profilename-package-summary.html
                     // and profilename-package-frame.html pages for that package.
                     PackageDoc pkg = packages.get(j);
-                    if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                    if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                         ProfilePackageFrameWriter.generate(configuration, pkg, i);
                         next = getNamedPackage(packages, j + 1);
                         AbstractBuilder profilePackageSummaryBuilder =
@@ -269,7 +268,7 @@
             // deprecated, do not generate the package-summary.html, package-frame.html
             // and package-tree.html pages for that package.
             PackageDoc pkg = pList.get(i);
-            if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+            if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                 PackageFrameWriter.generate(configuration, pkg);
                 next = getNamedPackage(pList, i + 1);
                 //If the next package is unnamed package, skip 2 ahead if possible
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -82,6 +82,8 @@
      */
     public final ConfigurationImpl configuration;
 
+    protected final Utils utils;
+
     /**
      * To check whether annotation heading is printed or not.
      */
@@ -111,6 +113,7 @@
             throws IOException {
         super(configuration, path);
         this.configuration = configuration;
+        this.utils = configuration.utils;
         this.path = path;
         this.pathToRoot = path.parent().invert();
         this.filename = path.basename();
@@ -347,7 +350,7 @@
                 if (!isTypeInProfile(classes[i], profileValue)) {
                     continue;
                 }
-                if (!Util.isCoreClass(classes[i]) ||
+                if (!utils.isCoreClass(classes[i]) ||
                     !configuration.isGeneratedDoc(classes[i])) {
                     continue;
                 }
@@ -361,7 +364,7 @@
                     tr.addStyle(HtmlStyle.rowColor);
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
-                if (Util.isDeprecated(classes[i])) {
+                if (utils.isDeprecated(classes[i])) {
                     tdClassDescription.addContent(deprecatedLabel);
                     if (classes[i].tags("deprecated").length > 0) {
                         addSummaryDeprecatedComment(classes[i],
@@ -1021,7 +1024,7 @@
             return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
                     label);
         } else {
-            DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
+            DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(pkg));
             if (crossPkgLink != null) {
                 return getHyperLink(crossPkgLink, label);
             } else {
@@ -1288,7 +1291,7 @@
     public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
             Content label, boolean strong, boolean isProperty) {
         if (! (doc.isIncluded() ||
-            Util.isLinkable(classDoc, configuration))) {
+            utils.isLinkable(classDoc, configuration))) {
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
@@ -1316,7 +1319,7 @@
     public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
             Content label) {
         if (! (doc.isIncluded() ||
-            Util.isLinkable(classDoc, configuration))) {
+            utils.isLinkable(classDoc, configuration))) {
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
@@ -1360,7 +1363,7 @@
             return new ContentBuilder();
         }
 
-        String seetext = replaceDocRootDir(Util.normalizeNewlines(see.text()));
+        String seetext = replaceDocRootDir(utils.normalizeNewlines(see.text()));
 
         //Check if @see is an href or "string"
         if (seetext.startsWith("<") || seetext.startsWith("\"")) {
@@ -1422,7 +1425,7 @@
             ClassDoc containing = refMem.containingClass();
             if (see.text().trim().startsWith("#") &&
                 ! (containing.isPublic() ||
-                Util.isLinkable(containing, configuration))) {
+                utils.isLinkable(containing, configuration))) {
                 // Since the link is relative and the holder is not even being
                 // documented, this must be an inherited link.  Redirect it.
                 // The current class either overrides the referenced member or
@@ -1628,8 +1631,8 @@
                 if (isFirstSentence) {
                     text = removeNonInlineHtmlTags(text);
                 }
-                text = Util.replaceTabs(configuration, text);
-                text = Util.normalizeNewlines(text);
+                text = utils.replaceTabs(configuration, text);
+                text = utils.normalizeNewlines(text);
                 result.addContent(new RawHtml(text));
             }
         }
@@ -1955,13 +1958,13 @@
             // and also if its container annotation is not documented, do not add it
             // to the list. If an annotation of a repeatable type is not documented
             // but its container is documented, it will be added to the list.
-            if (!Util.isDocumentedAnnotation(annotationDoc) &&
+            if (!utils.isDocumentedAnnotation(annotationDoc) &&
                 (!isAnnotationDocumented && !isContainerDocumented)) {
                 continue;
             }
             /* TODO: check logic here to correctly handle declaration
              * and type annotations.
-            if  (Util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) {
+            if  (util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) {
                 continue;
             }*/
             annotation = new ContentBuilder();
@@ -2096,7 +2099,7 @@
                         AnnotationTypeDoc annotationDoc =
                                 ((AnnotationDesc) annotationArray[0].value()).annotationType();
                         isContainerDocumented = true;
-                        if (Util.isDocumentedAnnotation(annotationDoc)) {
+                        if (utils.isDocumentedAnnotation(annotationDoc)) {
                             isAnnotationDocumented = true;
                         }
                         return true;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,8 +29,6 @@
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
-import com.sun.tools.doclets.formats.html.markup.RawHtml;
-import com.sun.tools.doclets.formats.html.markup.StringContent;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 import com.sun.tools.doclets.internal.toolkit.util.links.*;
@@ -174,21 +172,22 @@
      */
     private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) {
         Configuration configuration = m_writer.configuration;
+        Utils utils = configuration.utils;
         if (isTypeLink) {
             return configuration.getText("doclet.Href_Type_Param_Title",
                 classDoc.name());
         } else if (classDoc.isInterface()){
             return configuration.getText("doclet.Href_Interface_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         } else if (classDoc.isAnnotationType()) {
             return configuration.getText("doclet.Href_Annotation_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         } else if (classDoc.isEnum()) {
             return configuration.getText("doclet.Href_Enum_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         } else {
             return configuration.getText("doclet.Href_Class_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -30,7 +30,6 @@
 import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
 import com.sun.tools.doclets.formats.html.markup.StringContent;
 import com.sun.tools.doclets.internal.toolkit.Content;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 import com.sun.tools.doclets.internal.toolkit.util.links.*;
 
 /**
@@ -426,6 +425,6 @@
      * desired place.
      */
     public boolean isLinkable() {
-        return Util.isLinkable(classDoc, configuration);
+        return configuration.utils.isLinkable(classDoc, configuration);
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -151,7 +151,7 @@
         if (method.inlineTags().length > 0) {
             if (holder.asClassDoc().equals(classdoc) ||
                     (! (holderClassDoc.isPublic() ||
-                    Util.isLinkable(holderClassDoc, configuration)))) {
+                    utils.isLinkable(holderClassDoc, configuration)))) {
                 writer.addInlineComment(method, methodDocTree);
             } else {
                 Content link =
@@ -292,7 +292,7 @@
         }
         ClassDoc holderClassDoc = overriddenType.asClassDoc();
         if (! (holderClassDoc.isPublic() ||
-            Util.isLinkable(holderClassDoc, writer.configuration))) {
+            writer.configuration.utils.isLinkable(holderClassDoc, writer.configuration))) {
             //This is an implementation detail that should not be documented.
             return;
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -92,7 +92,7 @@
         PackageFrameWriter packgen;
         try {
             packgen = new PackageFrameWriter(configuration, packageDoc);
-            String pkgName = Util.getPackageName(packageDoc);
+            String pkgName = configuration.utils.getPackageName(packageDoc);
             Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
             Content pkgNameContent = new StringContent(pkgName);
             Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
@@ -136,7 +136,7 @@
             addClassKindListing(packageDoc.annotationTypes(),
                 getResource("doclet.AnnotationTypes"), contentTree);
         } else {
-            String name = Util.getPackageName(packageDoc);
+            String name = utils.getPackageName(packageDoc);
             addClassKindListing(config.classDocCatalog.interfaces(name),
                 getResource("doclet.Interfaces"), contentTree);
             addClassKindListing(config.classDocCatalog.ordinaryClasses(name),
@@ -161,7 +161,7 @@
      */
     protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
             Content contentTree) {
-        arr = Util.filterOutPrivateClasses(arr, configuration.javafx);
+        arr = utils.filterOutPrivateClasses(arr, configuration.javafx);
         if(arr.length > 0) {
             Arrays.sort(arr);
             boolean printedHeader = false;
@@ -171,7 +171,7 @@
                 if (documentedClasses != null && !documentedClasses.contains(classDoc)) {
                     continue;
                 }
-                if (!Util.isCoreClass(classDoc) || !configuration.isGeneratedDoc(classDoc)) {
+                if (!utils.isCoreClass(classDoc) || !configuration.isGeneratedDoc(classDoc)) {
                     continue;
                 }
                 if (!printedHeader) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -90,7 +90,7 @@
             // Do not list the package if -nodeprecated option is set and the
             // package is marked as deprecated.
             if (aPackage != null &&
-                (!(configuration.nodeprecated && Util.isDeprecated(aPackage)))) {
+                (!(configuration.nodeprecated && utils.isDeprecated(aPackage)))) {
                 ul.addContent(getPackage(aPackage));
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -168,7 +168,7 @@
         boolean altColor = true;
         for (PackageDoc pkg : packages) {
             if (pkg != null && !pkg.name().isEmpty()) {
-                if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                     Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
                     Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
                     HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -115,7 +115,7 @@
     protected void generatePackageTreeFile() throws IOException {
         Content body = getPackageTreeHeader();
         Content headContent = getResource("doclet.Hierarchy_For_Package",
-                Util.getPackageName(packagedoc));
+                utils.getPackageName(packagedoc));
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
                 HtmlStyle.title, headContent);
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -74,7 +74,7 @@
                             .get(usingPackage.name());
                     if (usedClasses == null) {
                         usedClasses = new TreeSet<>();
-                        usingPackageToUsedClasses.put(Util.getPackageName(usingPackage),
+                        usingPackageToUsedClasses.put(utils.getPackageName(usingPackage),
                                                       usedClasses);
                     }
                     usedClasses.add(usedClass);
@@ -151,7 +151,7 @@
         Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
                 getTableCaption(configuration.getResource(
                 "doclet.ClassUse_Packages.that.use.0",
-                getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)))));
+                getPackageLink(pkgdoc, utils.getPackageName(pkgdoc)))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
@@ -194,8 +194,8 @@
             Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
                                            getTableCaption(configuration.getResource(
                                                    "doclet.ClassUse_Classes.in.0.used.by.1",
-                                                   getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
-                                                   getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
+                                                   getPackageLink(pkgdoc, utils.getPackageName(pkgdoc)),
+                                                   getPackageLink(usingPackage, utils.getPackageName(usingPackage)))));
             table.addContent(getSummaryTableHeader(classTableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             Iterator<ClassDoc> itc =
@@ -241,8 +241,8 @@
      */
     protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
         Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
-                getHyperLink(Util.getPackageName(pkg),
-                new StringContent(Util.getPackageName(pkg))));
+                getHyperLink(utils.getPackageName(pkg),
+                new StringContent(utils.getPackageName(pkg))));
         contentTree.addContent(tdFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -138,7 +138,7 @@
      */
     public void addDeprecationInfo(Content div) {
         Tag[] deprs = packageDoc.tags("deprecated");
-        if (Util.isDeprecated(packageDoc)) {
+        if (utils.isDeprecated(packageDoc)) {
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
             Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
@@ -175,7 +175,7 @@
             table.addContent(getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             for (int i = 0; i < classes.length; i++) {
-                if (!Util.isCoreClass(classes[i]) ||
+                if (!utils.isCoreClass(classes[i]) ||
                     !configuration.isGeneratedDoc(classes[i])) {
                     continue;
                 }
@@ -189,7 +189,7 @@
                     tr.addStyle(HtmlStyle.rowColor);
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
-                if (Util.isDeprecated(classes[i])) {
+                if (utils.isDeprecated(classes[i])) {
                     tdClassDescription.addContent(deprecatedLabel);
                     if (classes[i].tags("deprecated").length > 0) {
                         addSummaryDeprecatedComment(classes[i],
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -91,7 +91,7 @@
             StringBuilder winTitle = new StringBuilder(profileName);
             String sep = " - ";
             winTitle.append(sep);
-            String pkgName = Util.getPackageName(packageDoc);
+            String pkgName = configuration.utils.getPackageName(packageDoc);
             winTitle.append(pkgName);
             Content body = profpackgen.getBody(false,
                     profpackgen.getWindowTitle(winTitle.toString()));
@@ -163,7 +163,7 @@
                 if (!isTypeInProfile(classDoc, profileValue)) {
                     continue;
                 }
-                if (!Util.isCoreClass(classDoc) || !
+                if (!utils.isCoreClass(classDoc) || !
                         configuration.isGeneratedDoc(classDoc)) {
                     continue;
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -95,7 +95,7 @@
         ul.setTitle(packagesLabel);
         List<PackageDoc> packages = configuration.profilePackages.get(profileName);
         for (PackageDoc packageDoc : packages) {
-            if ((!(configuration.nodeprecated && Util.isDeprecated(packageDoc)))) {
+            if ((!(configuration.nodeprecated && utils.isDeprecated(packageDoc)))) {
                 ul.addContent(getPackage(packageDoc, profileName));
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,7 +26,6 @@
 package com.sun.tools.doclets.formats.html;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.jvm.Profile;
@@ -155,7 +154,7 @@
      */
     public void addDeprecationInfo(Content div) {
         Tag[] deprs = packageDoc.tags("deprecated");
-        if (Util.isDeprecated(packageDoc)) {
+        if (utils.isDeprecated(packageDoc)) {
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
             Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,7 +26,6 @@
 package com.sun.tools.doclets.formats.html;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.jvm.Profile;
@@ -183,7 +182,7 @@
      */
     public void addPackageDeprecationInfo(Content li, PackageDoc pkg) {
         Tag[] deprs;
-        if (Util.isDeprecated(pkg)) {
+        if (utils.isDeprecated(pkg)) {
             deprs = pkg.tags("deprecated");
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -126,7 +126,7 @@
         ClassDoc holder = property.containingClass();
         if (property.inlineTags().length > 0) {
             if (holder.equals(classdoc) ||
-                    (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
+                    (! (holder.isPublic() || utils.isLinkable(holder, configuration)))) {
                 writer.addInlineComment(property, propertyDocTree);
             } else {
                 Content link =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -61,6 +61,7 @@
     private static final String NEW_LINE = DocletConstants.NL;
 
     private final ConfigurationImpl configuration;
+    private final Utils utils;
 
     private final RootDoc rootDoc;
 
@@ -75,6 +76,7 @@
     private SourceToHTMLConverter(ConfigurationImpl configuration, RootDoc rd,
             DocPath outputdir) {
         this.configuration  = configuration;
+        this.utils = configuration.utils;
         this.rootDoc = rd;
         this.outputdir = outputdir;
     }
@@ -98,7 +100,7 @@
         for (PackageDoc pd : rootDoc.specifiedPackages()) {
             // If -nodeprecated option is set and the package is marked as deprecated,
             // do not convert the package files to HTML.
-            if (!(configuration.nodeprecated && Util.isDeprecated(pd)))
+            if (!(configuration.nodeprecated && utils.isDeprecated(pd)))
                 convertPackage(pd, outputdir);
         }
         for (ClassDoc cd : rootDoc.specifiedClasses()) {
@@ -106,7 +108,7 @@
             // or the containing package is deprecated, do not convert the
             // package files to HTML.
             if (!(configuration.nodeprecated &&
-                  (Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()))))
+                  (utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage()))))
                 convertClass(cd, outputdir);
         }
     }
@@ -126,7 +128,7 @@
             // do not convert the package files to HTML. We do not check for
             // containing package deprecation since it is already check in
             // the calling method above.
-            if (!(configuration.nodeprecated && Util.isDeprecated(cd)))
+            if (!(configuration.nodeprecated && utils.isDeprecated(cd)))
                 convertClass(cd, outputdir);
         }
     }
@@ -260,7 +262,7 @@
      */
     private void addLine(Content pre, String line, int currentLineNo) {
         if (line != null) {
-            pre.addContent(Util.replaceTabs(configuration, line));
+            pre.addContent(utils.replaceTabs(configuration, line));
             Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
             pre.addContent(anchor);
             pre.addContent(NEW_LINE);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -174,7 +174,7 @@
             Content tdSummary) {
         Tag[] deprs = member.tags("deprecated");
         Content div;
-        if (Util.isDeprecated((ProgramElementDoc) member)) {
+        if (utils.isDeprecated((ProgramElementDoc) member)) {
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
             div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             div.addContent(getSpace());
@@ -185,7 +185,7 @@
             return;
         } else {
             ClassDoc cd = ((ProgramElementDoc)member).containingClass();
-            if (cd != null && Util.isDeprecated(cd)) {
+            if (cd != null && utils.isDeprecated(cd)) {
                 Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
                 div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
                 div.addContent(getSpace());
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -53,11 +53,13 @@
 
     private final HtmlDocletWriter htmlWriter;
     private final ConfigurationImpl configuration;
+    private final Utils utils;
 
     public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) {
         super(isFirstSentence);
         this.htmlWriter = htmlWriter;
         configuration = htmlWriter.configuration;
+        this.utils = configuration.utils;
     }
 
     /**
@@ -71,7 +73,7 @@
      * {@inheritDoc}
      */
     protected Content codeTagOutput(Tag tag) {
-        Content result = HtmlTree.CODE(new StringContent(Util.normalizeNewlines(tag.text())));
+        Content result = HtmlTree.CODE(new StringContent(utils.normalizeNewlines(tag.text())));
         return result;
     }
 
@@ -94,7 +96,7 @@
         ContentBuilder result = new ContentBuilder();
         Tag[] deprs = doc.tags("deprecated");
         if (doc instanceof ClassDoc) {
-            if (Util.isDeprecated((ProgramElementDoc) doc)) {
+            if (utils.isDeprecated((ProgramElementDoc) doc)) {
                 result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
                         new StringContent(configuration.getText("doclet.Deprecated"))));
                 result.addContent(RawHtml.nbsp);
@@ -109,7 +111,7 @@
             }
         } else {
             MemberDoc member = (MemberDoc) doc;
-            if (Util.isDeprecated((ProgramElementDoc) doc)) {
+            if (utils.isDeprecated((ProgramElementDoc) doc)) {
                 result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
                         new StringContent(configuration.getText("doclet.Deprecated"))));
                 result.addContent(RawHtml.nbsp);
@@ -120,7 +122,7 @@
                         result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
                 }
             } else {
-                if (Util.isDeprecated(member.containingClass())) {
+                if (utils.isDeprecated(member.containingClass())) {
                     result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
                             new StringContent(configuration.getText("doclet.Deprecated"))));
                     result.addContent(RawHtml.nbsp);
@@ -134,7 +136,7 @@
      * {@inheritDoc}
      */
     protected Content literalTagOutput(Tag tag) {
-        Content result = new StringContent(Util.normalizeNewlines(tag.text()));
+        Content result = new StringContent(utils.normalizeNewlines(tag.text()));
         return result;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -142,7 +142,7 @@
                 // is set and the package is marked as deprecated, do not include
                 // the page in the list of package hierarchies.
                 if (pkg.name().isEmpty() ||
-                        (configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                        (configuration.nodeprecated && utils.isDeprecated(pkg))) {
                     i++;
                     continue;
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -45,6 +45,10 @@
      * The global configuration information for this run.
      */
     public Configuration configuration;
+    /*
+     *  a handle to our utility methods
+     */
+    protected Utils utils;
 
     /**
      * The only doclet that may use this toolkit is {@value}
@@ -75,6 +79,7 @@
     public boolean start(AbstractDoclet doclet, RootDoc root) {
         configuration = configuration();
         configuration.root = root;
+        utils = configuration.utils;
         if (! isValidDoclet(doclet)) {
             return false;
         }
@@ -94,7 +99,6 @@
             }
             return false;
         } catch (Exception exc) {
-            exc.printStackTrace();
             return false;
         }
         return true;
@@ -135,7 +139,7 @@
         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
 
         generateClassFiles(root, classtree);
-        Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
+        configuration.utils.copyDocFiles(configuration, DocPaths.DOC_FILES);
 
         PackageListWriter.generate(configuration);
         generatePackageFiles(classtree);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Sun Jun 15 08:41:57 2014 -0700
@@ -140,7 +140,7 @@
     /**
      * The meta tag keywords instance.
      */
-    public final MetaKeywords metakeywords = new MetaKeywords(this);
+    public final MetaKeywords metakeywords;
 
     /**
      * The list of doc-file subdirectories to exclude
@@ -158,6 +158,10 @@
     public RootDoc root;
 
     /**
+     * An utility class for commonly used helpers
+     */
+    public Utils utils;
+    /**
      * Destination directory name, in which doclet will generate the entire
      * documentation. Default is current directory.
      */
@@ -310,6 +314,8 @@
         excludedDocFileDirs = new HashSet<>();
         excludedQualifiers = new HashSet<>();
         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
+        utils = new Utils();
+        metakeywords = new MetaKeywords(this);
     }
 
     /**
@@ -397,7 +403,7 @@
             interimResults.put(p, new ArrayList<PackageDoc>());
 
         for (PackageDoc pkg: packages) {
-            if (nodeprecated && Util.isDeprecated(pkg)) {
+            if (nodeprecated && utils.isDeprecated(pkg)) {
                 continue;
             }
             // the getProfile method takes a type name, not a package name,
@@ -933,7 +939,7 @@
         if (!nodeprecated) {
             return true;
         }
-        return !(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()));
+        return !(utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage()));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -85,6 +85,8 @@
      */
     protected final Configuration configuration;
 
+    protected final Utils utils;
+
     /**
      * Keep track of which packages we have seen for
      * efficiency purposes.  We don't want to copy the
@@ -106,6 +108,7 @@
      */
     public AbstractBuilder(Context c) {
         this.configuration = c.configuration;
+        this.utils = configuration.utils;
         this.containingPackagesSeen = c.containingPackagesSeen;
         this.layoutParser = c.layoutParser;
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -26,11 +26,9 @@
 package com.sun.tools.doclets.internal.toolkit.builders;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given annotation type.
@@ -138,7 +136,7 @@
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
-            Util.copyDocFiles(configuration, containingPackage);
+            utils.copyDocFiles(configuration, containingPackage);
             containingPackagesSeen.add(containingPackage);
         }
      }
@@ -174,7 +172,7 @@
     public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
         StringBuilder modifiers = new StringBuilder(
                 annotationTypeDoc.modifiers() + " ");
-        writer.addAnnotationTypeSignature(Util.replaceText(
+        writer.addAnnotationTypeSignature(utils.replaceText(
                 modifiers.toString(), "interface", "@interface"), annotationInfoTree);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -26,11 +26,9 @@
 package com.sun.tools.doclets.internal.toolkit.builders;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given class.
@@ -94,7 +92,7 @@
         } else if (classDoc.isEnum()) {
             isInterface = false;
             isEnum = true;
-            Util.setEnumDocumentation(configuration, classDoc);
+            utils.setEnumDocumentation(configuration, classDoc);
         } else {
             isInterface = false;
             isEnum = false;
@@ -276,7 +274,7 @@
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
-            Util.copyDocFiles(configuration, containingPackage);
+            utils.copyDocFiles(configuration, containingPackage);
             containingPackagesSeen.add(containingPackage);
         }
      }
@@ -296,12 +294,12 @@
             if ((index = modifiers.indexOf("abstract")) >= 0) {
                 modifiers.delete(index, index + "abstract".length());
                 modifiers = new StringBuilder(
-                        Util.replaceText(modifiers.toString(), "  ", " "));
+                        utils.replaceText(modifiers.toString(), "  ", " "));
             }
             if ((index = modifiers.indexOf("final")) >= 0) {
                 modifiers.delete(index, index + "final".length());
                 modifiers = new StringBuilder(
-                        Util.replaceText(modifiers.toString(), "  ", " "));
+                        utils.replaceText(modifiers.toString(), "  ", " "));
             }
         //} else if (classDoc.isAnnotationType()) {
             //modifiers.append("@interface ");
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -347,7 +347,7 @@
                     //Inherit comments from overriden or implemented method if
                     //necessary.
                     DocFinder.Output inheritedDoc =
-                            DocFinder.search(new DocFinder.Input((MethodDoc) member));
+                            DocFinder.search(configuration, new DocFinder.Input((MethodDoc) member));
                     if (inheritedDoc.holder != null
                             && inheritedDoc.holder.firstSentenceTags().length > 0) {
                         firstSentenceTags = inheritedDoc.holder.firstSentenceTags();
@@ -384,13 +384,13 @@
                 commentTextBuilder.append(
                         MessageFormat.format(
                                 configuration.getText("doclet.PropertySetterWithName"),
-                                Util.propertyNameFromMethodName(configuration, member.name())));
+                                utils.propertyNameFromMethodName(configuration, member.name())));
             }
             if (isGetter) {
                 commentTextBuilder.append(
                         MessageFormat.format(
                                 configuration.getText("doclet.PropertyGetterWithName"),
-                                Util.propertyNameFromMethodName(configuration, member.name())));
+                                utils.propertyNameFromMethodName(configuration, member.name())));
             }
             if (propertyDoc.commentText() != null
                         && !propertyDoc.commentText().isEmpty()) {
@@ -477,7 +477,7 @@
             VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
         for (ClassDoc inhclass : visibleMemberMap.getVisibleClassesList()) {
             if (!(inhclass.isPublic() ||
-                  Util.isLinkable(inhclass, configuration))) {
+                  utils.isLinkable(inhclass, configuration))) {
                 continue;
             }
             if (inhclass == classDoc) {
@@ -491,7 +491,7 @@
                 for (int j = 0; j < inhmembers.size(); ++j) {
                     writer.addInheritedMemberSummary(
                             inhclass.isPackagePrivate() &&
-                            !Util.isLinkable(inhclass, configuration) ?
+                            !utils.isLinkable(inhclass, configuration) ?
                             classDoc : inhclass,
                             inhmembers.get(j),
                             j == 0,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -207,7 +207,7 @@
             MethodDoc method = (MethodDoc) methods.get(currentMethodIndex);
 
             if (method.inlineTags().length == 0) {
-                DocFinder.Output docs = DocFinder.search(
+                DocFinder.Output docs = DocFinder.search(configuration,
                         new DocFinder.Input(method));
                 method = docs.inlineTags != null && docs.inlineTags.length > 0 ?
                     (MethodDoc) docs.holder : method;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,7 +29,6 @@
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given package.
@@ -120,12 +119,12 @@
      * @param contentTree the content tree to which the documentation will be added
      */
     public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
-        contentTree = packageWriter.getPackageHeader(Util.getPackageName(packageDoc));
+        contentTree = packageWriter.getPackageHeader(utils.getPackageName(packageDoc));
         buildChildren(node, contentTree);
         packageWriter.addPackageFooter(contentTree);
         packageWriter.printDocument(contentTree);
         packageWriter.close();
-        Util.copyDocFiles(configuration, packageDoc);
+        utils.copyDocFiles(configuration, packageDoc);
     }
 
     /**
@@ -174,8 +173,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.interfaces()
                         : configuration.classDocCatalog.interfaces(
-                                Util.getPackageName(packageDoc));
-        interfaces = Util.filterOutPrivateClasses(interfaces, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        interfaces = utils.filterOutPrivateClasses(interfaces, configuration.javafx);
         if (interfaces.length > 0) {
             packageWriter.addClassesSummary(
                     interfaces,
@@ -204,8 +203,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.ordinaryClasses()
                         : configuration.classDocCatalog.ordinaryClasses(
-                                Util.getPackageName(packageDoc));
-        classes = Util.filterOutPrivateClasses(classes, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        classes = utils.filterOutPrivateClasses(classes, configuration.javafx);
         if (classes.length > 0) {
             packageWriter.addClassesSummary(
                     classes,
@@ -234,8 +233,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.enums()
                         : configuration.classDocCatalog.enums(
-                                Util.getPackageName(packageDoc));
-        enums = Util.filterOutPrivateClasses(enums, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        enums = utils.filterOutPrivateClasses(enums, configuration.javafx);
         if (enums.length > 0) {
             packageWriter.addClassesSummary(
                     enums,
@@ -264,8 +263,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.exceptions()
                         : configuration.classDocCatalog.exceptions(
-                                Util.getPackageName(packageDoc));
-        exceptions = Util.filterOutPrivateClasses(exceptions, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        exceptions = utils.filterOutPrivateClasses(exceptions, configuration.javafx);
         if (exceptions.length > 0) {
             packageWriter.addClassesSummary(
                     exceptions,
@@ -294,8 +293,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.errors()
                         : configuration.classDocCatalog.errors(
-                                Util.getPackageName(packageDoc));
-        errors = Util.filterOutPrivateClasses(errors, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        errors = utils.filterOutPrivateClasses(errors, configuration.javafx);
         if (errors.length > 0) {
             packageWriter.addClassesSummary(
                     errors,
@@ -324,8 +323,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.annotationTypes()
                         : configuration.classDocCatalog.annotationTypes(
-                                Util.getPackageName(packageDoc));
-        annotationTypes = Util.filterOutPrivateClasses(annotationTypes, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        annotationTypes = utils.filterOutPrivateClasses(annotationTypes, configuration.javafx);
         if (annotationTypes.length > 0) {
             packageWriter.addClassesSummary(
                     annotationTypes,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,7 +30,6 @@
 import com.sun.javadoc.*;
 import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given profile package.
@@ -136,12 +135,12 @@
      */
     public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
         contentTree = profilePackageWriter.getPackageHeader(
-                Util.getPackageName(packageDoc));
+                utils.getPackageName(packageDoc));
         buildChildren(node, contentTree);
         profilePackageWriter.addPackageFooter(contentTree);
         profilePackageWriter.printDocument(contentTree);
         profilePackageWriter.close();
-        Util.copyDocFiles(configuration, packageDoc);
+        utils.copyDocFiles(configuration, packageDoc);
     }
 
     /**
@@ -190,7 +189,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.interfaces()
                         : configuration.classDocCatalog.interfaces(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (interfaces.length > 0) {
             profilePackageWriter.addClassesSummary(
                     interfaces,
@@ -219,7 +218,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.ordinaryClasses()
                         : configuration.classDocCatalog.ordinaryClasses(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (classes.length > 0) {
             profilePackageWriter.addClassesSummary(
                     classes,
@@ -248,7 +247,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.enums()
                         : configuration.classDocCatalog.enums(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (enums.length > 0) {
             profilePackageWriter.addClassesSummary(
                     enums,
@@ -277,7 +276,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.exceptions()
                         : configuration.classDocCatalog.exceptions(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (exceptions.length > 0) {
             profilePackageWriter.addClassesSummary(
                     exceptions,
@@ -306,7 +305,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.errors()
                         : configuration.classDocCatalog.errors(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (errors.length > 0) {
             profilePackageWriter.addClassesSummary(
                     errors,
@@ -335,7 +334,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.annotationTypes()
                         : configuration.classDocCatalog.annotationTypes(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (annotationTypes.length > 0) {
             profilePackageWriter.addClassesSummary(
                     annotationTypes,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -129,7 +129,7 @@
         profileWriter.addProfileFooter(contentTree);
         profileWriter.printDocument(contentTree);
         profileWriter.close();
-        Util.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
+        utils.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -201,7 +201,7 @@
      */
     public void buildPackageHeader(XMLNode node, Content packageSerializedTree) {
         packageSerializedTree.addContent(writer.getPackageHeader(
-                Util.getPackageName(currentPackage)));
+                utils.getPackageName(currentPackage)));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -133,7 +133,7 @@
                 "doclet.noInheritedDoc", message);
          }
         DocFinder.Output inheritedDoc =
-            DocFinder.search(new DocFinder.Input(ped,
+            DocFinder.search(configuration, new DocFinder.Input(ped,
                 (InheritableTaglet) inheritableTaglet, holderTag,
                 isFirstSentence, true));
         if (inheritedDoc.isValidInheritDocTag) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -228,7 +228,7 @@
                 //This parameter does not have any @param documentation.
                 //Try to inherit it.
                 DocFinder.Output inheritedDoc =
-                    DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
+                    DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this,
                         String.valueOf(i), ! isNonTypeParams));
                 if (inheritedDoc.inlineTags != null &&
                         inheritedDoc.inlineTags.length > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -89,7 +89,7 @@
         //Inherit @return tag if necessary.
         if (tags.length == 0) {
             DocFinder.Output inheritedDoc =
-                DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
+                DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this));
             tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
         }
         return tags.length > 0 ? writer.returnTagOutput(tags[0]) : null;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -66,7 +66,7 @@
         SeeTag[] tags = holder.seeTags();
         if (tags.length == 0 && holder instanceof MethodDoc) {
             DocFinder.Output inheritedDoc =
-                DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
+                DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this));
             if (inheritedDoc.holder != null) {
                 tags = inheritedDoc.holder.seeTags();
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -116,10 +116,10 @@
             Set<Tag> declaredExceptionTags = new LinkedHashSet<>();
             for (Type declaredExceptionType : declaredExceptionTypes) {
                 DocFinder.Output inheritedDoc =
-                        DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
+                        DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this,
                                                              declaredExceptionType.typeName()));
                 if (inheritedDoc.tagList.size() == 0) {
-                    inheritedDoc = DocFinder.search(new DocFinder.Input(
+                    inheritedDoc = DocFinder.search(writer.configuration(), new DocFinder.Input(
                             (MethodDoc) holder, this,
                             declaredExceptionType.qualifiedTypeName()));
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -91,6 +91,7 @@
      private Map<String,Set<ClassDoc>> interfaces;
 
      private Configuration configuration;
+     private Utils utils;
 
      /**
       * Construct a new ClassDocCatalog.
@@ -100,6 +101,7 @@
      public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) {
          init();
          this.configuration = config;
+         this.utils = config.utils;
          for (ClassDoc classdoc : classdocs) {
              addClassDoc(classdoc);
          }
@@ -156,13 +158,13 @@
       private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) {
 
           PackageDoc pkg = classdoc.containingPackage();
-          if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) {
+          if (pkg.isIncluded() || (configuration.nodeprecated && utils.isDeprecated(pkg))) {
               //No need to catalog this class if it's package is
               //included on the command line or if -nodeprecated option is set
               // and the containing package is marked as deprecated.
               return;
           }
-          String key = Util.getPackageName(pkg);
+          String key = utils.getPackageName(pkg);
           Set<ClassDoc> s = map.get(key);
           if (s == null) {
               packageSet.add(key);
@@ -190,7 +192,7 @@
       public ClassDoc[] allClasses(PackageDoc pkgDoc) {
           return pkgDoc.isIncluded() ?
                 pkgDoc.allClasses() :
-                getArray(allClasses, Util.getPackageName(pkgDoc));
+                getArray(allClasses, utils.getPackageName(pkgDoc));
       }
 
       /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -81,6 +81,8 @@
     */
     private Map<ClassDoc,List<ClassDoc>> implementingclasses = new HashMap<>();
 
+    private final Configuration configuration;
+    private final Utils utils;
     /**
      * Constructor. Build the Tree using the Root of this Javadoc run.
      *
@@ -90,17 +92,21 @@
      */
     public ClassTree(Configuration configuration, boolean noDeprecated) {
         configuration.message.notice("doclet.Building_Tree");
-        buildTree(configuration.root.classes(), configuration);
+        this.configuration = configuration;
+        this.utils = configuration.utils;
+        buildTree(configuration.root.classes());
     }
 
     /**
      * Constructor. Build the Tree using the Root of this Javadoc run.
      *
      * @param root Root of the Document.
-     * @param configuration The curren configuration of the doclet.
+     * @param configuration The current configuration of the doclet.
      */
     public ClassTree(RootDoc root, Configuration configuration) {
-        buildTree(root.classes(), configuration);
+        this.configuration = configuration;
+        this.utils = configuration.utils;
+        buildTree(root.classes());
     }
 
     /**
@@ -110,7 +116,9 @@
      * @param configuration The curren configuration of the doclet.
      */
     public ClassTree(ClassDoc[] classes, Configuration configuration) {
-        buildTree(classes, configuration);
+        this.configuration = configuration;
+        this.utils = configuration.utils;
+        buildTree(classes);
     }
 
     /**
@@ -122,14 +130,14 @@
      * @param classes all the classes in this run.
      * @param configuration the current configuration of the doclet.
      */
-    private void buildTree(ClassDoc[] classes, Configuration configuration) {
+    private void buildTree(ClassDoc[] classes) {
         for (ClassDoc aClass : classes) {
             // In the tree page (e.g overview-tree.html) do not include
             // information of classes which are deprecated or are a part of a
             // deprecated package.
             if (configuration.nodeprecated &&
-                    (Util.isDeprecated(aClass) ||
-                    Util.isDeprecated(aClass.containingPackage()))) {
+                    (utils.isDeprecated(aClass) ||
+                    utils.isDeprecated(aClass.containingPackage()))) {
                 continue;
             }
 
@@ -177,7 +185,7 @@
      */
     private void processType(ClassDoc cd, Configuration configuration,
             List<ClassDoc> bases, Map<ClassDoc,List<ClassDoc>> subs) {
-        ClassDoc superclass = Util.getFirstVisibleSuperClassCD(cd, configuration);
+        ClassDoc superclass = utils.getFirstVisibleSuperClassCD(cd, configuration);
         if (superclass != null) {
             if (!add(subs, superclass, cd)) {
                 return;
@@ -189,7 +197,7 @@
                 bases.add(cd);
             }
         }
-        List<Type> intfacs = Util.getAllInterfaces(cd, configuration);
+        List<Type> intfacs = utils.getAllInterfaces(cd, configuration);
         for (Type intfac : intfacs) {
             add(implementingclasses, intfac.asClassDoc(), cd);
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/CommentedMethodFinder.java	Sat Jul 12 07:32:28 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1999, 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.doclets.internal.toolkit.util;
-
-import com.sun.javadoc.*;
-
-/**
- * Find a commented method.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- *
- */
-public class CommentedMethodFinder extends MethodFinder {
-    public boolean isCorrectMethod(MethodDoc method) {
-        return method.inlineTags().length > 0;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -61,7 +61,8 @@
      * List of deprecated type Lists.
      */
     private List<List<Doc>> deprecatedLists;
-
+    private final Configuration configuration;
+    private final Utils utils;
 
     /**
      * Constructor.
@@ -69,11 +70,13 @@
      * @param configuration the current configuration of the doclet
      */
     public DeprecatedAPIListBuilder(Configuration configuration) {
+        this.configuration = configuration;
+        this.utils = configuration.utils;
         deprecatedLists = new ArrayList<>();
         for (int i = 0; i < NUM_TYPES; i++) {
             deprecatedLists.add(i, new ArrayList<Doc>());
         }
-        buildDeprecatedAPIInfo(configuration);
+        buildDeprecatedAPIInfo();
     }
 
     /**
@@ -83,15 +86,15 @@
      *
      * @param configuration the current configuration of the doclet.
      */
-    private void buildDeprecatedAPIInfo(Configuration configuration) {
+    private void buildDeprecatedAPIInfo() {
         Set<PackageDoc> packages = configuration.packages;
         for (PackageDoc pkg : packages) {
-            if (Util.isDeprecated(pkg)) {
+            if (utils.isDeprecated(pkg)) {
                 getList(PACKAGE).add(pkg);
             }
         }
         for (ClassDoc cd : configuration.root.classes()) {
-            if (Util.isDeprecated(cd)) {
+            if (utils.isDeprecated(cd)) {
                 if (cd.isOrdinaryClass()) {
                     getList(CLASS).add(cd);
                 } else if (cd.isInterface()) {
@@ -128,7 +131,7 @@
      */
     private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) {
         for (MemberDoc member : members) {
-            if (Util.isDeprecated(member)) {
+            if (utils.isDeprecated(member)) {
                 list.add(member);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.Configuration;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 
 /**
@@ -184,7 +185,7 @@
      *
      * @return an Output object representing the documentation that was found.
      */
-    public static Output search(Input input) {
+    public static Output search(Configuration configuration, Input input) {
         Output output = new Output();
         if (input.isInheritDocTag) {
             //Do nothing because "element" does not have any documentation.
@@ -209,7 +210,7 @@
             MethodDoc overriddenMethod = ((MethodDoc) input.element).overriddenMethod();
             if (overriddenMethod != null) {
                 inheritedSearchInput.element = overriddenMethod;
-                output = search(inheritedSearchInput);
+                output = search(configuration, inheritedSearchInput);
                 output.isValidInheritDocTag = true;
                 if (output.inlineTags.length > 0) {
                     return output;
@@ -219,10 +220,10 @@
             //       not pass all implemented interfaces, we will use the
             //       appropriate element here.
             MethodDoc[] implementedMethods =
-                (new ImplementedMethods((MethodDoc) input.element, null)).build(false);
+                (new ImplementedMethods((MethodDoc) input.element, configuration)).build(false);
             for (MethodDoc implementedMethod : implementedMethods) {
                 inheritedSearchInput.element = implementedMethod;
-                output = search(inheritedSearchInput);
+                output = search(configuration, inheritedSearchInput);
                 output.isValidInheritDocTag = true;
                 if (output.inlineTags.length > 0) {
                     return output;
@@ -232,7 +233,7 @@
             ProgramElementDoc superclass = ((ClassDoc) input.element).superclass();
             if (superclass != null) {
                 inheritedSearchInput.element = superclass;
-                output = search(inheritedSearchInput);
+                output = search(configuration, inheritedSearchInput);
                 output.isValidInheritDocTag = true;
                 if (output.inlineTags.length > 0) {
                     return output;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -43,15 +43,17 @@
  */
 public class ImplementedMethods {
 
-    private Map<MethodDoc,Type> interfaces = new HashMap<>();
-    private List<MethodDoc> methlist = new ArrayList<>();
-    private Configuration configuration;
+    private final Map<MethodDoc,Type> interfaces = new HashMap<>();
+    private final List<MethodDoc> methlist = new ArrayList<>();
+    private final Configuration configuration;
+    private final Utils utils;
     private final ClassDoc classdoc;
     private final MethodDoc method;
 
     public ImplementedMethods(MethodDoc method, Configuration configuration) {
         this.method = method;
         this.configuration = configuration;
+        this.utils = configuration.utils;
         classdoc = method.containingClass();
     }
 
@@ -88,9 +90,9 @@
      * from the array passed.
      */
     private void buildImplementedMethodList(boolean sort) {
-        List<Type> intfacs = Util.getAllInterfaces(classdoc, configuration, sort);
+        List<Type> intfacs = utils.getAllInterfaces(classdoc, configuration, sort);
         for (Type interfaceType : intfacs) {
-            MethodDoc found = Util.findMethod(interfaceType.asClassDoc(), method);
+            MethodDoc found = utils.findMethod(interfaceType.asClassDoc(), method);
             if (found != null) {
                 removeOverriddenMethod(found);
                 if (!overridingMethodFound(found)) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Sun Jun 15 08:41:57 2014 -0700
@@ -71,6 +71,7 @@
     // make ProgramElementDoc[] when new toArray is available
     protected final Object[] elements;
 
+    private final Configuration configuration;
     /**
      * Constructor. Build the index map.
      *
@@ -92,6 +93,7 @@
      */
     public IndexBuilder(Configuration configuration, boolean noDeprecated,
                         boolean classesOnly) {
+        this.configuration  = configuration;
         if (classesOnly) {
             configuration.message.notice("doclet.Building_Index_For_All_Classes");
         } else {
@@ -112,7 +114,7 @@
      */
     protected void sortIndexMap() {
         for (List<Doc> docs : indexmap.values()) {
-            Collections.sort(docs, Util.makeComparatorForIndexUse());
+            Collections.sort(docs, configuration.utils.makeComparatorForIndexUse());
         }
     }
 
@@ -202,14 +204,14 @@
         if (element instanceof PackageDoc)
             // Do not add to index map if -nodeprecated option is set and the
             // package is marked as deprecated.
-            return !(noDeprecated && Util.isDeprecated(element));
+            return !(noDeprecated && configuration.utils.isDeprecated(element));
         else
             // Do not add to index map if -nodeprecated option is set and if the
             // Doc is marked as deprecated or the containing package is marked as
             // deprecated.
             return !(noDeprecated &&
-                    (Util.isDeprecated(element) ||
-                    Util.isDeprecated(((ProgramElementDoc)element).containingPackage())));
+                    (configuration.utils.isDeprecated(element) ||
+                    configuration.utils.isDeprecated(((ProgramElementDoc)element).containingPackage())));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -50,12 +50,14 @@
      * The global configuration information for this run.
      */
     private final Configuration configuration;
+    private final Utils utils;
 
     /**
      * Constructor
      */
     public MetaKeywords(Configuration configuration) {
         this.configuration = configuration;
+        this.utils = configuration.utils;
     }
 
     /**
@@ -98,7 +100,7 @@
      */
     public String[] getMetaKeywords(PackageDoc packageDoc) {
         if( configuration.keywords ) {
-            String pkgName = Util.getPackageName(packageDoc);
+            String pkgName = utils.getPackageName(packageDoc);
             return new String[] { pkgName + " " + "package" };
         } else {
             return new String[] {};
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java	Sat Jul 12 07:32:28 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1999, 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.doclets.internal.toolkit.util;
-
-import com.sun.javadoc.*;
-
-/**
- * This class is useful for searching a method which has documentation
- * comment and documentation tags. The method is searched in all the
- * superclasses and interfaces(subsequently super-interfaces also)
- * recursively.
- *
- *  <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 MethodFinder {
-
-    abstract boolean isCorrectMethod(MethodDoc method);
-
-    public MethodDoc search(ClassDoc cd, MethodDoc method) {
-        MethodDoc meth = searchInterfaces(cd, method);
-        if (meth != null) {
-            return meth;
-        }
-        ClassDoc icd = cd.superclass();
-        if (icd != null) {
-            meth = Util.findMethod(icd, method);
-            if (meth != null) {
-            if (isCorrectMethod(meth)) {
-                    return meth;
-                }
-            }
-            return search(icd, method);
-        }
-        return null;
-    }
-
-    public MethodDoc searchInterfaces(ClassDoc cd, MethodDoc method) {
-        MethodDoc[] implementedMethods = (new ImplementedMethods(method, null)).build();
-        for (MethodDoc implementedMethod : implementedMethods) {
-            if (isCorrectMethod(implementedMethod)) {
-                return implementedMethod;
-            }
-        }
-        return null;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -44,7 +44,8 @@
  */
 public class PackageListWriter extends PrintWriter {
 
-    private Configuration configuration;
+    private final Configuration configuration;
+    private final Utils utils;
 
     /**
      * Constructor.
@@ -54,6 +55,7 @@
     public PackageListWriter(Configuration configuration) throws IOException {
         super(DocFile.createFileForOutput(configuration, DocPaths.PACKAGE_LIST).openWriter());
         this.configuration = configuration;
+        this.utils = configuration.utils;
     }
 
     /**
@@ -80,7 +82,7 @@
         for (PackageDoc pkg : configuration.packages) {
             // if the -nodeprecated option is set and the package is marked as
             // deprecated, do not include it in the packages list.
-            if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
+            if (!(configuration.nodeprecated && utils.isDeprecated(pkg)))
                 names.add(pkg.name());
         }
         Collections.sort(names);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/TaggedMethodFinder.java	Sat Jul 12 07:32:28 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999, 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.doclets.internal.toolkit.util;
-
-import com.sun.javadoc.*;
-
-/**
- * Find a tagged method.
- *
- *  <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 class TaggedMethodFinder extends MethodFinder {
-    public boolean isCorrectMethod(MethodDoc method) {
-        return method.paramTags().length + method.tags("return").length +
-               method.throwsTags().length + method.seeTags().length > 0;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Sat Jul 12 07:32:28 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1018 +0,0 @@
-/*
- * Copyright (c) 1999, 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.doclets.internal.toolkit.util;
-
-import java.io.*;
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.text.Collator;
-import java.util.*;
-
-import javax.tools.StandardLocation;
-
-import com.sun.javadoc.*;
-import com.sun.javadoc.AnnotationDesc.ElementValuePair;
-import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.javac.util.StringUtils;
-
-/**
- * Utilities Class for Doclets.
- *
- *  <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 Jamie Ho
- */
-public class Util {
-    /**
-     * Return array of class members whose documentation is to be generated.
-     * If the member is deprecated do not include such a member in the
-     * returned array.
-     *
-     * @param  members             Array of members to choose from.
-     * @return ProgramElementDoc[] Array of eligible members for whom
-     *                             documentation is getting generated.
-     */
-    public static ProgramElementDoc[] excludeDeprecatedMembers(
-        ProgramElementDoc[] members) {
-        return
-            toProgramElementDocArray(excludeDeprecatedMembersAsList(members));
-    }
-
-    /**
-     * Return array of class members whose documentation is to be generated.
-     * If the member is deprecated do not include such a member in the
-     * returned array.
-     *
-     * @param  members    Array of members to choose from.
-     * @return List       List of eligible members for whom
-     *                    documentation is getting generated.
-     */
-    public static List<ProgramElementDoc> excludeDeprecatedMembersAsList(
-        ProgramElementDoc[] members) {
-        List<ProgramElementDoc> list = new ArrayList<>();
-        for (ProgramElementDoc member : members) {
-            if (member.tags("deprecated").length == 0) {
-                list.add(member);
-            }
-        }
-        Collections.sort(list);
-        return list;
-    }
-
-    /**
-     * Return the list of ProgramElementDoc objects as Array.
-     */
-    public static ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) {
-        ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()];
-        for (int i = 0; i < list.size(); i++) {
-            pgmarr[i] = list.get(i);
-        }
-        return pgmarr;
-    }
-
-    /**
-     * Return true if a non-public member found in the given array.
-     *
-     * @param  members Array of members to look into.
-     * @return boolean True if non-public member found, false otherwise.
-     */
-    public static boolean nonPublicMemberFound(ProgramElementDoc[] members) {
-        for (ProgramElementDoc member : members) {
-            if (!member.isPublic()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Search for the given method in the given class.
-     *
-     * @param  cd        Class to search into.
-     * @param  method    Method to be searched.
-     * @return MethodDoc Method found, null otherwise.
-     */
-    public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
-        MethodDoc[] methods = cd.methods();
-        for (MethodDoc m : methods) {
-            if (executableMembersEqual(method, m)) {
-                return m;
-
-            }
-        }
-        return null;
-    }
-
-    /**
-     * @param member1 the first method to compare.
-     * @param member2 the second method to compare.
-     * @return true if member1 overrides/hides or is overriden/hidden by member2.
-     */
-    public static boolean executableMembersEqual(ExecutableMemberDoc member1,
-            ExecutableMemberDoc member2) {
-        if (! (member1 instanceof MethodDoc && member2 instanceof MethodDoc))
-            return false;
-
-        MethodDoc method1 = (MethodDoc) member1;
-        MethodDoc method2 = (MethodDoc) member2;
-        if (method1.isStatic() && method2.isStatic()) {
-            Parameter[] targetParams = method1.parameters();
-            Parameter[] currentParams;
-            if (method1.name().equals(method2.name()) &&
-                   (currentParams = method2.parameters()).length ==
-                targetParams.length) {
-                int j;
-                for (j = 0; j < targetParams.length; j++) {
-                    if (! (targetParams[j].typeName().equals(
-                              currentParams[j].typeName()) ||
-                                   currentParams[j].type() instanceof TypeVariable ||
-                                   targetParams[j].type() instanceof TypeVariable)) {
-                        break;
-                    }
-                }
-                if (j == targetParams.length) {
-                    return true;
-                }
-            }
-            return false;
-        } else {
-                return method1.overrides(method2) ||
-                method2.overrides(method1) ||
-                                member1 == member2;
-        }
-    }
-
-    /**
-     * According to
-     * <cite>The Java&trade; Language Specification</cite>,
-     * all the outer classes and static inner classes are core classes.
-     */
-    public static boolean isCoreClass(ClassDoc cd) {
-        return cd.containingClass() == null || cd.isStatic();
-    }
-
-    public static boolean matches(ProgramElementDoc doc1,
-            ProgramElementDoc doc2) {
-        if (doc1 instanceof ExecutableMemberDoc &&
-            doc2 instanceof ExecutableMemberDoc) {
-            ExecutableMemberDoc ed1 = (ExecutableMemberDoc)doc1;
-            ExecutableMemberDoc ed2 = (ExecutableMemberDoc)doc2;
-            return executableMembersEqual(ed1, ed2);
-        } else {
-            return doc1.name().equals(doc2.name());
-        }
-    }
-
-    /**
-     * Copy the given directory contents from the source package directory
-     * to the generated documentation directory. For example for a package
-     * java.lang this method find out the source location of the package using
-     * {@link SourcePath} and if given directory is found in the source
-     * directory structure, copy the entire directory, to the generated
-     * documentation hierarchy.
-     *
-     * @param configuration The configuration of the current doclet.
-     * @param path The relative path to the directory to be copied.
-     * @param dir The original directory name to copy from.
-     * @param overwrite Overwrite files if true.
-     */
-    public static void copyDocFiles(Configuration configuration, PackageDoc pd) {
-        copyDocFiles(configuration, DocPath.forPackage(pd).resolve(DocPaths.DOC_FILES));
-    }
-
-    public static void copyDocFiles(Configuration configuration, DocPath dir) {
-        try {
-            boolean first = true;
-            for (DocFile f : DocFile.list(configuration, StandardLocation.SOURCE_PATH, dir)) {
-                if (!f.isDirectory()) {
-                    continue;
-                }
-                DocFile srcdir = f;
-                DocFile destdir = DocFile.createFileForOutput(configuration, dir);
-                if (srcdir.isSameFile(destdir)) {
-                    continue;
-                }
-
-                for (DocFile srcfile: srcdir.list()) {
-                    DocFile destfile = destdir.resolve(srcfile.getName());
-                    if (srcfile.isFile()) {
-                        if (destfile.exists() && !first) {
-                            configuration.message.warning((SourcePosition) null,
-                                    "doclet.Copy_Overwrite_warning",
-                                    srcfile.getPath(), destdir.getPath());
-                        } else {
-                            configuration.message.notice(
-                                    "doclet.Copying_File_0_To_Dir_1",
-                                    srcfile.getPath(), destdir.getPath());
-                            destfile.copyFile(srcfile);
-                        }
-                    } else if (srcfile.isDirectory()) {
-                        if (configuration.copydocfilesubdirs
-                                && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
-                            copyDocFiles(configuration, dir.resolve(srcfile.getName()));
-                        }
-                    }
-                }
-
-                first = false;
-            }
-        } catch (SecurityException | IOException exc) {
-            throw new DocletAbortException(exc);
-        }
-    }
-
-    /**
-     * We want the list of types in alphabetical order.  However, types are not
-     * comparable.  We need a comparator for now.
-     */
-    private static class TypeComparator implements Comparator<Type> {
-        public int compare(Type type1, Type type2) {
-            return type1.qualifiedTypeName().compareToIgnoreCase(
-                type2.qualifiedTypeName());
-        }
-    }
-
-    /**
-     * For the class return all implemented interfaces including the
-     * superinterfaces of the implementing interfaces, also iterate over for
-     * all the superclasses. For interface return all the extended interfaces
-     * as well as superinterfaces for those extended interfaces.
-     *
-     * @param  type       type whose implemented or
-     *                    super interfaces are sought.
-     * @param  configuration the current configuration of the doclet.
-     * @param  sort if true, return list of interfaces sorted alphabetically.
-     * @return List of all the required interfaces.
-     */
-    public static List<Type> getAllInterfaces(Type type,
-            Configuration configuration, boolean sort) {
-        Map<ClassDoc,Type> results = sort ?
-                new TreeMap<ClassDoc,Type>() :
-                new LinkedHashMap<ClassDoc,Type>();
-        Type[] interfaceTypes = null;
-        Type superType = null;
-        if (type instanceof ParameterizedType) {
-            interfaceTypes = ((ParameterizedType) type).interfaceTypes();
-            superType = ((ParameterizedType) type).superclassType();
-        } else if (type instanceof ClassDoc) {
-            interfaceTypes = ((ClassDoc) type).interfaceTypes();
-            superType = ((ClassDoc) type).superclassType();
-        } else {
-            interfaceTypes = type.asClassDoc().interfaceTypes();
-            superType = type.asClassDoc().superclassType();
-        }
-
-        for (Type interfaceType : interfaceTypes) {
-            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
-            if (!(interfaceClassDoc.isPublic() ||
-                  (configuration == null ||
-                   isLinkable(interfaceClassDoc, configuration)))) {
-                continue;
-            }
-            results.put(interfaceClassDoc, interfaceType);
-            for (Type t : getAllInterfaces(interfaceType, configuration, sort)) {
-                results.put(t.asClassDoc(), t);
-            }
-        }
-        if (superType == null)
-            return new ArrayList<>(results.values());
-        //Try walking the tree.
-        addAllInterfaceTypes(results,
-            superType,
-            interfaceTypesOf(superType),
-            false, configuration);
-        List<Type> resultsList = new ArrayList<>(results.values());
-        if (sort) {
-                Collections.sort(resultsList, new TypeComparator());
-        }
-        return resultsList;
-    }
-
-    private static Type[] interfaceTypesOf(Type type) {
-        if (type instanceof AnnotatedType)
-            type = ((AnnotatedType)type).underlyingType();
-        return type instanceof ClassDoc ?
-                ((ClassDoc)type).interfaceTypes() :
-                ((ParameterizedType)type).interfaceTypes();
-    }
-
-    public static List<Type> getAllInterfaces(Type type, Configuration configuration) {
-        return getAllInterfaces(type, configuration, true);
-    }
-
-    private static void findAllInterfaceTypes(Map<ClassDoc,Type> results, ClassDoc c, boolean raw,
-            Configuration configuration) {
-        Type superType = c.superclassType();
-        if (superType == null)
-            return;
-        addAllInterfaceTypes(results, superType,
-                interfaceTypesOf(superType),
-                raw, configuration);
-    }
-
-    private static void findAllInterfaceTypes(Map<ClassDoc,Type> results, ParameterizedType p,
-            Configuration configuration) {
-        Type superType = p.superclassType();
-        if (superType == null)
-            return;
-        addAllInterfaceTypes(results, superType,
-                interfaceTypesOf(superType),
-                false, configuration);
-    }
-
-    private static void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type,
-            Type[] interfaceTypes, boolean raw,
-            Configuration configuration) {
-        for (Type interfaceType : interfaceTypes) {
-            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
-            if (!(interfaceClassDoc.isPublic() ||
-                  (configuration != null &&
-                   isLinkable(interfaceClassDoc, configuration)))) {
-                continue;
-            }
-            if (raw)
-                interfaceType = interfaceType.asClassDoc();
-            results.put(interfaceClassDoc, interfaceType);
-            List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration);
-            for (Type superInterface : superInterfaces) {
-                results.put(superInterface.asClassDoc(), superInterface);
-            }
-        }
-        if (type instanceof AnnotatedType)
-            type = ((AnnotatedType)type).underlyingType();
-
-        if (type instanceof ParameterizedType)
-            findAllInterfaceTypes(results, (ParameterizedType) type, configuration);
-        else if (((ClassDoc) type).typeParameters().length == 0)
-            findAllInterfaceTypes(results, (ClassDoc) type, raw, configuration);
-        else
-            findAllInterfaceTypes(results, (ClassDoc) type, true, configuration);
-    }
-
-    /**
-     * Enclose in quotes, used for paths and filenames that contains spaces
-     */
-    public static String quote(String filepath) {
-        return ("\"" + filepath + "\"");
-    }
-
-    /**
-     * Given a package, return its name.
-     * @param packageDoc the package to check.
-     * @return the name of the given package.
-     */
-    public static String getPackageName(PackageDoc packageDoc) {
-        return packageDoc == null || packageDoc.name().length() == 0 ?
-            DocletConstants.DEFAULT_PACKAGE_NAME : packageDoc.name();
-    }
-
-    /**
-     * Given a package, return its file name without the extension.
-     * @param packageDoc the package to check.
-     * @return the file name of the given package.
-     */
-    public static String getPackageFileHeadName(PackageDoc packageDoc) {
-        return packageDoc == null || packageDoc.name().length() == 0 ?
-            DocletConstants.DEFAULT_PACKAGE_FILE_NAME : packageDoc.name();
-    }
-
-    /**
-     * Given a string, replace all occurrences of 'newStr' with 'oldStr'.
-     * @param originalStr the string to modify.
-     * @param oldStr the string to replace.
-     * @param newStr the string to insert in place of the old string.
-     */
-    public static String replaceText(String originalStr, String oldStr,
-            String newStr) {
-        if (oldStr == null || newStr == null || oldStr.equals(newStr)) {
-            return originalStr;
-        }
-        return originalStr.replace(oldStr, newStr);
-    }
-
-    /**
-     * Given an annotation, return true if it should be documented and false
-     * otherwise.
-     *
-     * @param annotationDoc the annotation to check.
-     *
-     * @return true return true if it should be documented and false otherwise.
-     */
-    public static boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
-        for (AnnotationDesc anno : annotationDoc.annotations()) {
-            if (anno.annotationType().qualifiedName().equals(
-                    Documented.class.getName())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private static boolean isDeclarationTarget(AnnotationDesc targetAnno) {
-        // The error recovery steps here are analogous to TypeAnnotations
-        ElementValuePair[] elems = targetAnno.elementValues();
-        if (elems == null
-            || elems.length != 1
-            || !"value".equals(elems[0].element().name())
-            || !(elems[0].value().value() instanceof AnnotationValue[]))
-            return true;    // error recovery
-
-        for (AnnotationValue aValue : (AnnotationValue[])elems[0].value().value()) {
-            Object value = aValue.value();
-            if (!(value instanceof FieldDoc))
-                return true; // error recovery
-
-            FieldDoc eValue = (FieldDoc) value;
-            if (Util.isJava5DeclarationElementType(eValue)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Returns true if the {@code annotationDoc} is to be treated
-     * as a declaration annotation, when targeting the
-     * {@code elemType} element type.
-     *
-     * @param annotationDoc the annotationDoc to check
-     * @param elemType  the targeted elemType
-     * @return true if annotationDoc is a declaration annotation
-     */
-    public static boolean isDeclarationAnnotation(AnnotationTypeDoc annotationDoc,
-            boolean isJava5DeclarationLocation) {
-        if (!isJava5DeclarationLocation)
-            return false;
-        AnnotationDesc[] annotationDescList = annotationDoc.annotations();
-        // Annotations with no target are treated as declaration as well
-        if (annotationDescList.length==0)
-            return true;
-        for (AnnotationDesc anno : annotationDescList) {
-            if (anno.annotationType().qualifiedName().equals(
-                    Target.class.getName())) {
-                if (isDeclarationTarget(anno))
-                    return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Return true if this class is linkable and false if we can't link to the
-     * desired class.
-     * <br>
-     * <b>NOTE:</b>  You can only link to external classes if they are public or
-     * protected.
-     *
-     * @param classDoc the class to check.
-     * @param configuration the current configuration of the doclet.
-     *
-     * @return true if this class is linkable and false if we can't link to the
-     * desired class.
-     */
-    public static boolean isLinkable(ClassDoc classDoc,
-            Configuration configuration) {
-        return
-            ((classDoc.isIncluded() && configuration.isGeneratedDoc(classDoc))) ||
-            (configuration.extern.isExternal(classDoc) &&
-                (classDoc.isPublic() || classDoc.isProtected()));
-    }
-
-    /**
-     * Given a class, return the closest visible super class.
-     *
-     * @param classDoc the class we are searching the parent for.
-     * @param configuration the current configuration of the doclet.
-     * @return the closest visible super class.  Return null if it cannot
-     *         be found (i.e. classDoc is java.lang.Object).
-     */
-    public static Type getFirstVisibleSuperClass(ClassDoc classDoc,
-            Configuration configuration) {
-        if (classDoc == null) {
-            return null;
-        }
-        Type sup = classDoc.superclassType();
-        ClassDoc supClassDoc = classDoc.superclass();
-        while (sup != null &&
-                  (! (supClassDoc.isPublic() ||
-                              isLinkable(supClassDoc, configuration))) ) {
-            if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName()))
-                break;
-            sup = supClassDoc.superclassType();
-            supClassDoc = supClassDoc.superclass();
-        }
-        if (classDoc.equals(supClassDoc)) {
-            return null;
-        }
-        return sup;
-    }
-
-    /**
-     * Given a class, return the closest visible super class.
-     *
-     * @param classDoc the class we are searching the parent for.
-     * @param configuration the current configuration of the doclet.
-     * @return the closest visible super class.  Return null if it cannot
-     *         be found (i.e. classDoc is java.lang.Object).
-     */
-    public static ClassDoc getFirstVisibleSuperClassCD(ClassDoc classDoc,
-            Configuration configuration) {
-        if (classDoc == null) {
-            return null;
-        }
-        ClassDoc supClassDoc = classDoc.superclass();
-        while (supClassDoc != null &&
-                  (! (supClassDoc.isPublic() ||
-                              isLinkable(supClassDoc, configuration))) ) {
-            supClassDoc = supClassDoc.superclass();
-        }
-        if (classDoc.equals(supClassDoc)) {
-            return null;
-        }
-        return supClassDoc;
-    }
-
-    /**
-     * Given a ClassDoc, return the name of its type (Class, Interface, etc.).
-     *
-     * @param cd the ClassDoc to check.
-     * @param lowerCaseOnly true if you want the name returned in lower case.
-     *                      If false, the first letter of the name is capitalized.
-     * @return
-     */
-    public static String getTypeName(Configuration config,
-        ClassDoc cd, boolean lowerCaseOnly) {
-        String typeName = "";
-        if (cd.isOrdinaryClass()) {
-            typeName = "doclet.Class";
-        } else if (cd.isInterface()) {
-            typeName = "doclet.Interface";
-        } else if (cd.isException()) {
-            typeName = "doclet.Exception";
-        } else if (cd.isError()) {
-            typeName = "doclet.Error";
-        } else if (cd.isAnnotationType()) {
-            typeName = "doclet.AnnotationType";
-        } else if (cd.isEnum()) {
-            typeName = "doclet.Enum";
-        }
-        return config.getText(
-            lowerCaseOnly ? StringUtils.toLowerCase(typeName) : typeName);
-    }
-
-    /**
-     * Replace all tabs in a string with the appropriate number of spaces.
-     * The string may be a multi-line string.
-     * @param configuration the doclet configuration defining the setting for the
-     *                      tab length.
-     * @param text the text for which the tabs should be expanded
-     * @return the text with all tabs expanded
-     */
-    public static String replaceTabs(Configuration configuration, String text) {
-        if (!text.contains("\t"))
-            return text;
-
-        final int tabLength = configuration.sourcetab;
-        final String whitespace = configuration.tabSpaces;
-        final int textLength = text.length();
-        StringBuilder result = new StringBuilder(textLength);
-        int pos = 0;
-        int lineLength = 0;
-        for (int i = 0; i < textLength; i++) {
-            char ch = text.charAt(i);
-            switch (ch) {
-                case '\n': case '\r':
-                    lineLength = 0;
-                    break;
-                case '\t':
-                    result.append(text, pos, i);
-                    int spaceCount = tabLength - lineLength % tabLength;
-                    result.append(whitespace, 0, spaceCount);
-                    lineLength += spaceCount;
-                    pos = i + 1;
-                    break;
-                default:
-                    lineLength++;
-            }
-        }
-        result.append(text, pos, textLength);
-        return result.toString();
-    }
-
-    public static String normalizeNewlines(String text) {
-        StringBuilder sb = new StringBuilder();
-        final int textLength = text.length();
-        final String NL = DocletConstants.NL;
-        int pos = 0;
-        for (int i = 0; i < textLength; i++) {
-            char ch = text.charAt(i);
-            switch (ch) {
-                case '\n':
-                    sb.append(text, pos, i);
-                    sb.append(NL);
-                    pos = i + 1;
-                    break;
-                case '\r':
-                    sb.append(text, pos, i);
-                    sb.append(NL);
-                    if (i + 1 < textLength && text.charAt(i + 1) == '\n')
-                        i++;
-                    pos = i + 1;
-                    break;
-            }
-        }
-        sb.append(text, pos, textLength);
-        return sb.toString();
-    }
-
-    /**
-     * The documentation for values() and valueOf() in Enums are set by the
-     * doclet.
-     */
-    public static void setEnumDocumentation(Configuration configuration,
-            ClassDoc classDoc) {
-        for (MethodDoc currentMethod : classDoc.methods()) {
-            if (currentMethod.name().equals("values") &&
-                currentMethod.parameters().length == 0) {
-                StringBuilder sb = new StringBuilder();
-                sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
-                sb.append("\n@return ");
-                sb.append(configuration.getText("doclet.enum_values_doc.return"));
-                currentMethod.setRawCommentText(sb.toString());
-            } else if (currentMethod.name().equals("valueOf") &&
-                     currentMethod.parameters().length == 1) {
-                Type paramType = currentMethod.parameters()[0].type();
-                if (paramType != null &&
-                    paramType.qualifiedTypeName().equals(String.class.getName())) {
-                    StringBuilder sb = new StringBuilder();
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
-                    sb.append("\n@param name ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
-                    sb.append("\n@return ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
-                    sb.append("\n@throws IllegalArgumentException ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
-                    sb.append("\n@throws NullPointerException ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
-                    currentMethod.setRawCommentText(sb.toString());
-                }
-            }
-        }
-    }
-
-    /**
-     *  Return true if the given Doc is deprecated.
-     *
-     * @param doc the Doc to check.
-     * @return true if the given Doc is deprecated.
-     */
-    public static boolean isDeprecated(Doc doc) {
-        if (doc.tags("deprecated").length > 0) {
-            return true;
-        }
-        AnnotationDesc[] annotationDescList;
-        if (doc instanceof PackageDoc)
-            annotationDescList = ((PackageDoc)doc).annotations();
-        else
-            annotationDescList = ((ProgramElementDoc)doc).annotations();
-        for (AnnotationDesc anno : annotationDescList) {
-            if (anno.annotationType().qualifiedName().equals(
-                    Deprecated.class.getName())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * A convenience method to get property name from the name of the
-     * getter or setter method.
-     * @param name name of the getter or setter method.
-     * @return the name of the property of the given setter of getter.
-     */
-    public static String propertyNameFromMethodName(Configuration configuration, String name) {
-        String propertyName = null;
-        if (name.startsWith("get") || name.startsWith("set")) {
-            propertyName = name.substring(3);
-        } else if (name.startsWith("is")) {
-            propertyName = name.substring(2);
-        }
-        if ((propertyName == null) || propertyName.isEmpty()){
-            return "";
-        }
-        return propertyName.substring(0, 1).toLowerCase(configuration.getLocale())
-                + propertyName.substring(1);
-    }
-
-    /**
-     * In case of JavaFX mode on, filters out classes that are private,
-     * package private or having the @treatAsPrivate annotation. Those are not
-     * documented in JavaFX mode.
-     *
-     * @param classes array of classes to be filtered.
-     * @param javafx set to true if in JavaFX mode.
-     * @return list of filtered classes.
-     */
-    public static ClassDoc[] filterOutPrivateClasses(final ClassDoc[] classes,
-                                                     boolean javafx) {
-        if (!javafx) {
-            return classes;
-        }
-        final List<ClassDoc> filteredOutClasses = new ArrayList<>(classes.length);
-        for (ClassDoc classDoc : classes) {
-            if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
-                continue;
-            }
-            Tag[] aspTags = classDoc.tags("treatAsPrivate");
-            if (aspTags != null && aspTags.length > 0) {
-                continue;
-            }
-            filteredOutClasses.add(classDoc);
-        }
-
-        return filteredOutClasses.toArray(new ClassDoc[0]);
-    }
-
-    /**
-     * Test whether the given FieldDoc is one of the declaration annotation ElementTypes
-     * defined in Java 5.
-     * Instead of testing for one of the new enum constants added in Java 8, test for
-     * the old constants. This prevents bootstrapping problems.
-     *
-     * @param elt The FieldDoc to test
-     * @return true, iff the given ElementType is one of the constants defined in Java 5
-     * @since 1.8
-     */
-    public static boolean isJava5DeclarationElementType(FieldDoc elt) {
-        return elt.name().contentEquals(ElementType.ANNOTATION_TYPE.name()) ||
-                elt.name().contentEquals(ElementType.CONSTRUCTOR.name()) ||
-                elt.name().contentEquals(ElementType.FIELD.name()) ||
-                elt.name().contentEquals(ElementType.LOCAL_VARIABLE.name()) ||
-                elt.name().contentEquals(ElementType.METHOD.name()) ||
-                elt.name().contentEquals(ElementType.PACKAGE.name()) ||
-                elt.name().contentEquals(ElementType.PARAMETER.name()) ||
-                elt.name().contentEquals(ElementType.TYPE.name());
-    }
-
-    /**
-     * A general purpose case insensitive String comparator, which compares two Strings using a Collator
-     * strength of "TERTIARY".
-     *
-     * @param s1 first String to compare.
-     * @param s2 second String to compare.
-     * @return a negative integer, zero, or a positive integer as the first
-     *         argument is less than, equal to, or greater than the second.
-     */
-    public static int compareStrings(String s1, String s2) {
-        return compareStrings(true, s1, s2);
-    }
-    /**
-     * A general purpose case sensitive String comparator, which compares two Strings using a Collator
-     * strength of "SECONDARY".
-     *
-     * @param s1 first String to compare.
-     * @param s2 second String to compare.
-     * @return a negative integer, zero, or a positive integer as the first
-     *         argument is less than, equal to, or greater than the second.
-     */
-    public static int compareCaseCompare(String s1, String s2) {
-        return compareStrings(false, s1, s2);
-    }
-    private static int compareStrings(boolean caseSensitive, String s1, String s2) {
-        Collator collator = Collator.getInstance();
-        collator.setStrength(caseSensitive ? Collator.TERTIARY : Collator.SECONDARY);
-        return collator.compare(s1, s2);
-    }
-
-    /**
-     * A comparator for index file presentations, and are sorted as follows:
-     *  1. sort on simple names of entities
-     *  2. if equal, then compare the DocKind ex: Package, Interface etc.
-     *  3a. if equal and if the type is of ExecutableMemberDoc(Constructor, Methods),
-     *      a case insensitive comparison of parameter the type signatures
-     *  3b. if equal, case sensitive comparison of the type signatures
-     *  4. finally, if equal, compare the FQNs of the entities
-     * @return a comparator for index file use
-     */
-    public static Comparator<Doc> makeComparatorForIndexUse() {
-        return new Util.DocComparator<Doc>() {
-            /**
-             * Compare two given Doc entities, first sort on names, then on the kinds,
-             * then on the parameters only if the type is an instance of ExecutableMemberDocs,
-             * the parameters are compared and finally the fully qualified names.
-             *
-             * @param d1 - a Doc element.
-             * @param d2 - a Doc element.
-             * @return a negative integer, zero, or a positive integer as the first
-             *         argument is less than, equal to, or greater than the second.
-             */
-            public int compare(Doc d1, Doc d2) {
-                int result = compareNames(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                result = compareDocKinds(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                if (hasParameters(d1)) {
-                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
-                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
-                    result = compareParameters(false, param1, param2);
-                    if (result != 0) {
-                        return result;
-                    }
-                    result = compareParameters(true, param1, param2);
-                    if (result != 0) {
-                        return result;
-                    }
-                }
-                return compareFullyQualifiedNames(d1, d2);
-            }
-        };
-    }
-    /**
-     * Comparator for ClassUse presentations, and sorted as follows,
-     * 1. compares simple names of entities
-     * 2. if equal, the fully qualified names of the entities
-     * 3. if equal and if applicable, the string representation of parameter types
-     * 3a. first by using case insensitive comparison
-     * 3b. second by using a case sensitive comparison
-     * 4. finally the Doc kinds ie. package, class, interface etc.
-     * @return a comparator to sort classes and members for class use
-     */
-    public static Comparator<Doc> makeComparatorForClassUse() {
-        return new Util.DocComparator<Doc>() {
-            /**
-             * Compares two given Doc entities, first sort on name, and if
-             * applicable on the fully qualified name, and if applicable
-             * on the parameter types, and finally the DocKind.
-             * @param d1 - a Doc element.
-             * @param d2 - a Doc element.
-             * @return a negative integer, zero, or a positive integer as the first
-             *         argument is less than, equal to, or greater than the second.
-             */
-            public int compare(Doc d1, Doc d2) {
-                int result = compareNames(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                result = compareFullyQualifiedNames(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                if (hasParameters(d1) && hasParameters(d2)) {
-                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
-                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
-                    result = compareParameters(false, param1, param2);
-                    if (result != 0) {
-                        return result;
-                    }
-                    return compareParameters(true, param1, param2);
-                }
-                return compareDocKinds(d1, d2);
-            }
-        };
-    }
-    /**
-     * A general purpose comparator to sort Doc entities, basically provides the building blocks
-     * for creating specific comparators for an use-case.
-     * @param <T> a Doc entity
-     */
-    static abstract class DocComparator<T extends Doc> implements Comparator<Doc> {
-        static enum DocKind {
-           PACKAGE,
-           CLASS,
-           ENUM,
-           INTERFACE,
-           ANNOTATION,
-           FIELD,
-           CONSTRUCTOR,
-           METHOD
-        };
-        boolean hasParameters(Doc d) {
-            return d instanceof ExecutableMemberDoc;
-        }
-        DocKind getDocKind(Doc d) {
-            if (d.isAnnotationType() || d.isAnnotationTypeElement()) {
-                return DocKind.ANNOTATION;
-            } else if (d.isEnum() || d.isEnumConstant()) {
-                return DocKind.ENUM;
-            } else if (d.isField()) {
-                return DocKind.FIELD;
-            } else if (d.isInterface()) {
-                return DocKind.INTERFACE;
-            } else if (d.isClass()) {
-                return DocKind.CLASS;
-            } else if (d.isConstructor()) {
-                return DocKind.CONSTRUCTOR;
-            } else if (d.isMethod()) {
-                return DocKind.METHOD;
-            } else {
-                return DocKind.PACKAGE;
-            }
-        }
-        /**
-         * Compares two Doc entities' kinds, and these are ordered as defined in
-         * the DocKind enumeration.
-         * @param d1 the first Doc object
-         * @param d2 the second Doc object
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is less than, equal to, or greater than the second.
-         */
-        protected int compareDocKinds(Doc d1, Doc d2) {
-            return getDocKind(d1).compareTo(getDocKind(d2));
-        }
-        /**
-         * Compares arrays of parameters as a string representation of their types.
-         *
-         * @param ignoreCase specifies case sensitive or insensitive comparison.
-         * @param params1 the first parameter array.
-         * @param params2 the first parameter array.
-         * @return a negative integer, zero, or a positive integer as the first argument is less
-         * than, equal to, or greater than the second.
-         */
-        protected int compareParameters(boolean caseSensitive,
-                                        Parameter[] params1,
-                                        Parameter[] params2) {
-            String s1 = getParametersAsString(params1);
-            String s2 = getParametersAsString(params2);
-            return compareStrings(caseSensitive, s1, s2);
-        }
-        /*
-         * This method returns a string representation solely for comparison purposes.
-         */
-        protected String getParametersAsString(Parameter[] params) {
-            StringBuilder sb = new StringBuilder();
-            for (Parameter param : params) {
-                Type t = param.type();
-                // add parameter type to arrays, as TypeMirror does.
-                String tname = (t.asParameterizedType() != null && t.getElementType() != null)
-                        ? t.getElementType() + t.dimension()
-                        : t.toString();
-                // prefix P for primitive and R for reference types, thus items will
-                // be ordered naturally.
-                sb.append(t.isPrimitive() ? "P" : "R").append("-").append(tname).append("-");
-            }
-            return sb.toString();
-        }
-
-        /**
-         * Compares two Doc entities typically the simple name of a method,
-         * field, constructor etc.
-         * @param d1 the first Doc.
-         * @param d2 the second Doc.
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is less than, equal to, or greater than the second.
-         */
-        protected int compareNames(Doc d1, Doc d2) {
-            return compareStrings(d1.name(), d2.name());
-        }
-
-        /**
-         * Compares the fully qualified names of the entities
-         * @param d1 the first entity
-         * @param d2 the second entity
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is less than, equal to, or greater than the second.
-         */
-        protected int compareFullyQualifiedNames(Doc d1, Doc d2) {
-            String name1 = (d1 instanceof ProgramElementDoc)
-                    ? ((ProgramElementDoc)d1).qualifiedName()
-                    : d1.name();
-            String name2 = (d2 instanceof ProgramElementDoc)
-                    ? ((ProgramElementDoc)d2).qualifiedName()
-                    : d2.name();
-            return compareStrings(name1, name2);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java	Sun Jun 15 08:41:57 2014 -0700
@@ -0,0 +1,1018 @@
+/*
+ * Copyright (c) 1999, 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.doclets.internal.toolkit.util;
+
+import java.io.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.text.Collator;
+import java.util.*;
+
+import javax.tools.StandardLocation;
+
+import com.sun.javadoc.*;
+import com.sun.javadoc.AnnotationDesc.ElementValuePair;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.javac.util.StringUtils;
+
+/**
+ * Utilities Class for Doclets.
+ *
+ *  <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 Jamie Ho
+ */
+public class Utils {
+    /**
+     * Return array of class members whose documentation is to be generated.
+     * If the member is deprecated do not include such a member in the
+     * returned array.
+     *
+     * @param  members             Array of members to choose from.
+     * @return ProgramElementDoc[] Array of eligible members for whom
+     *                             documentation is getting generated.
+     */
+    public ProgramElementDoc[] excludeDeprecatedMembers(
+        ProgramElementDoc[] members) {
+        return
+            toProgramElementDocArray(excludeDeprecatedMembersAsList(members));
+    }
+
+    /**
+     * Return array of class members whose documentation is to be generated.
+     * If the member is deprecated do not include such a member in the
+     * returned array.
+     *
+     * @param  members    Array of members to choose from.
+     * @return List       List of eligible members for whom
+     *                    documentation is getting generated.
+     */
+    public List<ProgramElementDoc> excludeDeprecatedMembersAsList(
+        ProgramElementDoc[] members) {
+        List<ProgramElementDoc> list = new ArrayList<>();
+        for (ProgramElementDoc member : members) {
+            if (member.tags("deprecated").length == 0) {
+                list.add(member);
+            }
+        }
+        Collections.sort(list);
+        return list;
+    }
+
+    /**
+     * Return the list of ProgramElementDoc objects as Array.
+     */
+    public ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) {
+        ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()];
+        for (int i = 0; i < list.size(); i++) {
+            pgmarr[i] = list.get(i);
+        }
+        return pgmarr;
+    }
+
+    /**
+     * Return true if a non-public member found in the given array.
+     *
+     * @param  members Array of members to look into.
+     * @return boolean True if non-public member found, false otherwise.
+     */
+    public boolean nonPublicMemberFound(ProgramElementDoc[] members) {
+        for (ProgramElementDoc member : members) {
+            if (!member.isPublic()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Search for the given method in the given class.
+     *
+     * @param  cd        Class to search into.
+     * @param  method    Method to be searched.
+     * @return MethodDoc Method found, null otherwise.
+     */
+    public MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
+        MethodDoc[] methods = cd.methods();
+        for (MethodDoc m : methods) {
+            if (executableMembersEqual(method, m)) {
+                return m;
+
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @param member1 the first method to compare.
+     * @param member2 the second method to compare.
+     * @return true if member1 overrides/hides or is overriden/hidden by member2.
+     */
+    public boolean executableMembersEqual(ExecutableMemberDoc member1,
+            ExecutableMemberDoc member2) {
+        if (! (member1 instanceof MethodDoc && member2 instanceof MethodDoc))
+            return false;
+
+        MethodDoc method1 = (MethodDoc) member1;
+        MethodDoc method2 = (MethodDoc) member2;
+        if (method1.isStatic() && method2.isStatic()) {
+            Parameter[] targetParams = method1.parameters();
+            Parameter[] currentParams;
+            if (method1.name().equals(method2.name()) &&
+                   (currentParams = method2.parameters()).length ==
+                targetParams.length) {
+                int j;
+                for (j = 0; j < targetParams.length; j++) {
+                    if (! (targetParams[j].typeName().equals(
+                              currentParams[j].typeName()) ||
+                                   currentParams[j].type() instanceof TypeVariable ||
+                                   targetParams[j].type() instanceof TypeVariable)) {
+                        break;
+                    }
+                }
+                if (j == targetParams.length) {
+                    return true;
+                }
+            }
+            return false;
+        } else {
+                return method1.overrides(method2) ||
+                method2.overrides(method1) ||
+                                member1 == member2;
+        }
+    }
+
+    /**
+     * According to
+     * <cite>The Java&trade; Language Specification</cite>,
+     * all the outer classes and static inner classes are core classes.
+     */
+    public boolean isCoreClass(ClassDoc cd) {
+        return cd.containingClass() == null || cd.isStatic();
+    }
+
+    public boolean matches(ProgramElementDoc doc1,
+            ProgramElementDoc doc2) {
+        if (doc1 instanceof ExecutableMemberDoc &&
+            doc2 instanceof ExecutableMemberDoc) {
+            ExecutableMemberDoc ed1 = (ExecutableMemberDoc)doc1;
+            ExecutableMemberDoc ed2 = (ExecutableMemberDoc)doc2;
+            return executableMembersEqual(ed1, ed2);
+        } else {
+            return doc1.name().equals(doc2.name());
+        }
+    }
+
+    /**
+     * Copy the given directory contents from the source package directory
+     * to the generated documentation directory. For example for a package
+     * java.lang this method find out the source location of the package using
+     * {@link SourcePath} and if given directory is found in the source
+     * directory structure, copy the entire directory, to the generated
+     * documentation hierarchy.
+     *
+     * @param configuration The configuration of the current doclet.
+     * @param path The relative path to the directory to be copied.
+     * @param dir The original directory name to copy from.
+     * @param overwrite Overwrite files if true.
+     */
+    public void copyDocFiles(Configuration configuration, PackageDoc pd) {
+        copyDocFiles(configuration, DocPath.forPackage(pd).resolve(DocPaths.DOC_FILES));
+    }
+
+    public void copyDocFiles(Configuration configuration, DocPath dir) {
+        try {
+            boolean first = true;
+            for (DocFile f : DocFile.list(configuration, StandardLocation.SOURCE_PATH, dir)) {
+                if (!f.isDirectory()) {
+                    continue;
+                }
+                DocFile srcdir = f;
+                DocFile destdir = DocFile.createFileForOutput(configuration, dir);
+                if (srcdir.isSameFile(destdir)) {
+                    continue;
+                }
+
+                for (DocFile srcfile: srcdir.list()) {
+                    DocFile destfile = destdir.resolve(srcfile.getName());
+                    if (srcfile.isFile()) {
+                        if (destfile.exists() && !first) {
+                            configuration.message.warning((SourcePosition) null,
+                                    "doclet.Copy_Overwrite_warning",
+                                    srcfile.getPath(), destdir.getPath());
+                        } else {
+                            configuration.message.notice(
+                                    "doclet.Copying_File_0_To_Dir_1",
+                                    srcfile.getPath(), destdir.getPath());
+                            destfile.copyFile(srcfile);
+                        }
+                    } else if (srcfile.isDirectory()) {
+                        if (configuration.copydocfilesubdirs
+                                && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
+                            copyDocFiles(configuration, dir.resolve(srcfile.getName()));
+                        }
+                    }
+                }
+
+                first = false;
+            }
+        } catch (SecurityException | IOException exc) {
+            throw new DocletAbortException(exc);
+        }
+    }
+
+    /**
+     * We want the list of types in alphabetical order.  However, types are not
+     * comparable.  We need a comparator for now.
+     */
+    private static class TypeComparator implements Comparator<Type> {
+        public int compare(Type type1, Type type2) {
+            return type1.qualifiedTypeName().compareToIgnoreCase(
+                type2.qualifiedTypeName());
+        }
+    }
+
+    /**
+     * For the class return all implemented interfaces including the
+     * superinterfaces of the implementing interfaces, also iterate over for
+     * all the superclasses. For interface return all the extended interfaces
+     * as well as superinterfaces for those extended interfaces.
+     *
+     * @param  type       type whose implemented or
+     *                    super interfaces are sought.
+     * @param  configuration the current configuration of the doclet.
+     * @param  sort if true, return list of interfaces sorted alphabetically.
+     * @return List of all the required interfaces.
+     */
+    public List<Type> getAllInterfaces(Type type,
+            Configuration configuration, boolean sort) {
+        Map<ClassDoc,Type> results = sort ?
+                new TreeMap<ClassDoc,Type>() :
+                new LinkedHashMap<ClassDoc,Type>();
+        Type[] interfaceTypes = null;
+        Type superType = null;
+        if (type instanceof ParameterizedType) {
+            interfaceTypes = ((ParameterizedType) type).interfaceTypes();
+            superType = ((ParameterizedType) type).superclassType();
+        } else if (type instanceof ClassDoc) {
+            interfaceTypes = ((ClassDoc) type).interfaceTypes();
+            superType = ((ClassDoc) type).superclassType();
+        } else {
+            interfaceTypes = type.asClassDoc().interfaceTypes();
+            superType = type.asClassDoc().superclassType();
+        }
+
+        for (Type interfaceType : interfaceTypes) {
+            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
+            if (!(interfaceClassDoc.isPublic() ||
+                  (configuration == null ||
+                   isLinkable(interfaceClassDoc, configuration)))) {
+                continue;
+            }
+            results.put(interfaceClassDoc, interfaceType);
+            for (Type t : getAllInterfaces(interfaceType, configuration, sort)) {
+                results.put(t.asClassDoc(), t);
+            }
+        }
+        if (superType == null)
+            return new ArrayList<>(results.values());
+        //Try walking the tree.
+        addAllInterfaceTypes(results,
+            superType,
+            interfaceTypesOf(superType),
+            false, configuration);
+        List<Type> resultsList = new ArrayList<>(results.values());
+        if (sort) {
+                Collections.sort(resultsList, new TypeComparator());
+        }
+        return resultsList;
+    }
+
+    private Type[] interfaceTypesOf(Type type) {
+        if (type instanceof AnnotatedType)
+            type = ((AnnotatedType)type).underlyingType();
+        return type instanceof ClassDoc ?
+                ((ClassDoc)type).interfaceTypes() :
+                ((ParameterizedType)type).interfaceTypes();
+    }
+
+    public List<Type> getAllInterfaces(Type type, Configuration configuration) {
+        return getAllInterfaces(type, configuration, true);
+    }
+
+    private void findAllInterfaceTypes(Map<ClassDoc,Type> results, ClassDoc c, boolean raw,
+            Configuration configuration) {
+        Type superType = c.superclassType();
+        if (superType == null)
+            return;
+        addAllInterfaceTypes(results, superType,
+                interfaceTypesOf(superType),
+                raw, configuration);
+    }
+
+    private void findAllInterfaceTypes(Map<ClassDoc,Type> results, ParameterizedType p,
+            Configuration configuration) {
+        Type superType = p.superclassType();
+        if (superType == null)
+            return;
+        addAllInterfaceTypes(results, superType,
+                interfaceTypesOf(superType),
+                false, configuration);
+    }
+
+    private void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type,
+            Type[] interfaceTypes, boolean raw,
+            Configuration configuration) {
+        for (Type interfaceType : interfaceTypes) {
+            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
+            if (!(interfaceClassDoc.isPublic() ||
+                  (configuration != null &&
+                   isLinkable(interfaceClassDoc, configuration)))) {
+                continue;
+            }
+            if (raw)
+                interfaceType = interfaceType.asClassDoc();
+            results.put(interfaceClassDoc, interfaceType);
+            List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration);
+            for (Type superInterface : superInterfaces) {
+                results.put(superInterface.asClassDoc(), superInterface);
+            }
+        }
+        if (type instanceof AnnotatedType)
+            type = ((AnnotatedType)type).underlyingType();
+
+        if (type instanceof ParameterizedType)
+            findAllInterfaceTypes(results, (ParameterizedType) type, configuration);
+        else if (((ClassDoc) type).typeParameters().length == 0)
+            findAllInterfaceTypes(results, (ClassDoc) type, raw, configuration);
+        else
+            findAllInterfaceTypes(results, (ClassDoc) type, true, configuration);
+    }
+
+    /**
+     * Enclose in quotes, used for paths and filenames that contains spaces
+     */
+    public String quote(String filepath) {
+        return ("\"" + filepath + "\"");
+    }
+
+    /**
+     * Given a package, return its name.
+     * @param packageDoc the package to check.
+     * @return the name of the given package.
+     */
+    public String getPackageName(PackageDoc packageDoc) {
+        return packageDoc == null || packageDoc.name().length() == 0 ?
+            DocletConstants.DEFAULT_PACKAGE_NAME : packageDoc.name();
+    }
+
+    /**
+     * Given a package, return its file name without the extension.
+     * @param packageDoc the package to check.
+     * @return the file name of the given package.
+     */
+    public String getPackageFileHeadName(PackageDoc packageDoc) {
+        return packageDoc == null || packageDoc.name().length() == 0 ?
+            DocletConstants.DEFAULT_PACKAGE_FILE_NAME : packageDoc.name();
+    }
+
+    /**
+     * Given a string, replace all occurrences of 'newStr' with 'oldStr'.
+     * @param originalStr the string to modify.
+     * @param oldStr the string to replace.
+     * @param newStr the string to insert in place of the old string.
+     */
+    public String replaceText(String originalStr, String oldStr,
+            String newStr) {
+        if (oldStr == null || newStr == null || oldStr.equals(newStr)) {
+            return originalStr;
+        }
+        return originalStr.replace(oldStr, newStr);
+    }
+
+    /**
+     * Given an annotation, return true if it should be documented and false
+     * otherwise.
+     *
+     * @param annotationDoc the annotation to check.
+     *
+     * @return true return true if it should be documented and false otherwise.
+     */
+    public boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
+        for (AnnotationDesc anno : annotationDoc.annotations()) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Documented.class.getName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean isDeclarationTarget(AnnotationDesc targetAnno) {
+        // The error recovery steps here are analogous to TypeAnnotations
+        ElementValuePair[] elems = targetAnno.elementValues();
+        if (elems == null
+            || elems.length != 1
+            || !"value".equals(elems[0].element().name())
+            || !(elems[0].value().value() instanceof AnnotationValue[]))
+            return true;    // error recovery
+
+        for (AnnotationValue aValue : (AnnotationValue[])elems[0].value().value()) {
+            Object value = aValue.value();
+            if (!(value instanceof FieldDoc))
+                return true; // error recovery
+
+            FieldDoc eValue = (FieldDoc) value;
+            if (isJava5DeclarationElementType(eValue)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns true if the {@code annotationDoc} is to be treated
+     * as a declaration annotation, when targeting the
+     * {@code elemType} element type.
+     *
+     * @param annotationDoc the annotationDoc to check
+     * @param elemType  the targeted elemType
+     * @return true if annotationDoc is a declaration annotation
+     */
+    public boolean isDeclarationAnnotation(AnnotationTypeDoc annotationDoc,
+            boolean isJava5DeclarationLocation) {
+        if (!isJava5DeclarationLocation)
+            return false;
+        AnnotationDesc[] annotationDescList = annotationDoc.annotations();
+        // Annotations with no target are treated as declaration as well
+        if (annotationDescList.length==0)
+            return true;
+        for (AnnotationDesc anno : annotationDescList) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Target.class.getName())) {
+                if (isDeclarationTarget(anno))
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return true if this class is linkable and false if we can't link to the
+     * desired class.
+     * <br>
+     * <b>NOTE:</b>  You can only link to external classes if they are public or
+     * protected.
+     *
+     * @param classDoc the class to check.
+     * @param configuration the current configuration of the doclet.
+     *
+     * @return true if this class is linkable and false if we can't link to the
+     * desired class.
+     */
+    public boolean isLinkable(ClassDoc classDoc,
+            Configuration configuration) {
+        return
+            ((classDoc.isIncluded() && configuration.isGeneratedDoc(classDoc))) ||
+            (configuration.extern.isExternal(classDoc) &&
+                (classDoc.isPublic() || classDoc.isProtected()));
+    }
+
+    /**
+     * Given a class, return the closest visible super class.
+     *
+     * @param classDoc the class we are searching the parent for.
+     * @param configuration the current configuration of the doclet.
+     * @return the closest visible super class.  Return null if it cannot
+     *         be found (i.e. classDoc is java.lang.Object).
+     */
+    public Type getFirstVisibleSuperClass(ClassDoc classDoc,
+            Configuration configuration) {
+        if (classDoc == null) {
+            return null;
+        }
+        Type sup = classDoc.superclassType();
+        ClassDoc supClassDoc = classDoc.superclass();
+        while (sup != null &&
+                  (! (supClassDoc.isPublic() ||
+                              isLinkable(supClassDoc, configuration))) ) {
+            if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName()))
+                break;
+            sup = supClassDoc.superclassType();
+            supClassDoc = supClassDoc.superclass();
+        }
+        if (classDoc.equals(supClassDoc)) {
+            return null;
+        }
+        return sup;
+    }
+
+    /**
+     * Given a class, return the closest visible super class.
+     *
+     * @param classDoc the class we are searching the parent for.
+     * @param configuration the current configuration of the doclet.
+     * @return the closest visible super class.  Return null if it cannot
+     *         be found (i.e. classDoc is java.lang.Object).
+     */
+    public ClassDoc getFirstVisibleSuperClassCD(ClassDoc classDoc,
+            Configuration configuration) {
+        if (classDoc == null) {
+            return null;
+        }
+        ClassDoc supClassDoc = classDoc.superclass();
+        while (supClassDoc != null &&
+                  (! (supClassDoc.isPublic() ||
+                              isLinkable(supClassDoc, configuration))) ) {
+            supClassDoc = supClassDoc.superclass();
+        }
+        if (classDoc.equals(supClassDoc)) {
+            return null;
+        }
+        return supClassDoc;
+    }
+
+    /**
+     * Given a ClassDoc, return the name of its type (Class, Interface, etc.).
+     *
+     * @param cd the ClassDoc to check.
+     * @param lowerCaseOnly true if you want the name returned in lower case.
+     *                      If false, the first letter of the name is capitalized.
+     * @return
+     */
+    public String getTypeName(Configuration config,
+        ClassDoc cd, boolean lowerCaseOnly) {
+        String typeName = "";
+        if (cd.isOrdinaryClass()) {
+            typeName = "doclet.Class";
+        } else if (cd.isInterface()) {
+            typeName = "doclet.Interface";
+        } else if (cd.isException()) {
+            typeName = "doclet.Exception";
+        } else if (cd.isError()) {
+            typeName = "doclet.Error";
+        } else if (cd.isAnnotationType()) {
+            typeName = "doclet.AnnotationType";
+        } else if (cd.isEnum()) {
+            typeName = "doclet.Enum";
+        }
+        return config.getText(
+            lowerCaseOnly ? StringUtils.toLowerCase(typeName) : typeName);
+    }
+
+    /**
+     * Replace all tabs in a string with the appropriate number of spaces.
+     * The string may be a multi-line string.
+     * @param configuration the doclet configuration defining the setting for the
+     *                      tab length.
+     * @param text the text for which the tabs should be expanded
+     * @return the text with all tabs expanded
+     */
+    public String replaceTabs(Configuration configuration, String text) {
+        if (!text.contains("\t"))
+            return text;
+
+        final int tabLength = configuration.sourcetab;
+        final String whitespace = configuration.tabSpaces;
+        final int textLength = text.length();
+        StringBuilder result = new StringBuilder(textLength);
+        int pos = 0;
+        int lineLength = 0;
+        for (int i = 0; i < textLength; i++) {
+            char ch = text.charAt(i);
+            switch (ch) {
+                case '\n': case '\r':
+                    lineLength = 0;
+                    break;
+                case '\t':
+                    result.append(text, pos, i);
+                    int spaceCount = tabLength - lineLength % tabLength;
+                    result.append(whitespace, 0, spaceCount);
+                    lineLength += spaceCount;
+                    pos = i + 1;
+                    break;
+                default:
+                    lineLength++;
+            }
+        }
+        result.append(text, pos, textLength);
+        return result.toString();
+    }
+
+    public String normalizeNewlines(String text) {
+        StringBuilder sb = new StringBuilder();
+        final int textLength = text.length();
+        final String NL = DocletConstants.NL;
+        int pos = 0;
+        for (int i = 0; i < textLength; i++) {
+            char ch = text.charAt(i);
+            switch (ch) {
+                case '\n':
+                    sb.append(text, pos, i);
+                    sb.append(NL);
+                    pos = i + 1;
+                    break;
+                case '\r':
+                    sb.append(text, pos, i);
+                    sb.append(NL);
+                    if (i + 1 < textLength && text.charAt(i + 1) == '\n')
+                        i++;
+                    pos = i + 1;
+                    break;
+            }
+        }
+        sb.append(text, pos, textLength);
+        return sb.toString();
+    }
+
+    /**
+     * The documentation for values() and valueOf() in Enums are set by the
+     * doclet.
+     */
+    public void setEnumDocumentation(Configuration configuration,
+            ClassDoc classDoc) {
+        for (MethodDoc currentMethod : classDoc.methods()) {
+            if (currentMethod.name().equals("values") &&
+                currentMethod.parameters().length == 0) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
+                sb.append("\n@return ");
+                sb.append(configuration.getText("doclet.enum_values_doc.return"));
+                currentMethod.setRawCommentText(sb.toString());
+            } else if (currentMethod.name().equals("valueOf") &&
+                     currentMethod.parameters().length == 1) {
+                Type paramType = currentMethod.parameters()[0].type();
+                if (paramType != null &&
+                    paramType.qualifiedTypeName().equals(String.class.getName())) {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
+                    sb.append("\n@param name ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
+                    sb.append("\n@return ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
+                    sb.append("\n@throws IllegalArgumentException ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
+                    sb.append("\n@throws NullPointerException ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
+                    currentMethod.setRawCommentText(sb.toString());
+                }
+            }
+        }
+    }
+
+    /**
+     *  Return true if the given Doc is deprecated.
+     *
+     * @param doc the Doc to check.
+     * @return true if the given Doc is deprecated.
+     */
+    public boolean isDeprecated(Doc doc) {
+        if (doc.tags("deprecated").length > 0) {
+            return true;
+        }
+        AnnotationDesc[] annotationDescList;
+        if (doc instanceof PackageDoc)
+            annotationDescList = ((PackageDoc)doc).annotations();
+        else
+            annotationDescList = ((ProgramElementDoc)doc).annotations();
+        for (AnnotationDesc anno : annotationDescList) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Deprecated.class.getName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * A convenience method to get property name from the name of the
+     * getter or setter method.
+     * @param name name of the getter or setter method.
+     * @return the name of the property of the given setter of getter.
+     */
+    public String propertyNameFromMethodName(Configuration configuration, String name) {
+        String propertyName = null;
+        if (name.startsWith("get") || name.startsWith("set")) {
+            propertyName = name.substring(3);
+        } else if (name.startsWith("is")) {
+            propertyName = name.substring(2);
+        }
+        if ((propertyName == null) || propertyName.isEmpty()){
+            return "";
+        }
+        return propertyName.substring(0, 1).toLowerCase(configuration.getLocale())
+                + propertyName.substring(1);
+    }
+
+    /**
+     * In case of JavaFX mode on, filters out classes that are private,
+     * package private or having the @treatAsPrivate annotation. Those are not
+     * documented in JavaFX mode.
+     *
+     * @param classes array of classes to be filtered.
+     * @param javafx set to true if in JavaFX mode.
+     * @return list of filtered classes.
+     */
+    public ClassDoc[] filterOutPrivateClasses(final ClassDoc[] classes,
+                                                     boolean javafx) {
+        if (!javafx) {
+            return classes;
+        }
+        final List<ClassDoc> filteredOutClasses = new ArrayList<>(classes.length);
+        for (ClassDoc classDoc : classes) {
+            if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
+                continue;
+            }
+            Tag[] aspTags = classDoc.tags("treatAsPrivate");
+            if (aspTags != null && aspTags.length > 0) {
+                continue;
+            }
+            filteredOutClasses.add(classDoc);
+        }
+
+        return filteredOutClasses.toArray(new ClassDoc[0]);
+    }
+
+    /**
+     * Test whether the given FieldDoc is one of the declaration annotation ElementTypes
+     * defined in Java 5.
+     * Instead of testing for one of the new enum constants added in Java 8, test for
+     * the old constants. This prevents bootstrapping problems.
+     *
+     * @param elt The FieldDoc to test
+     * @return true, iff the given ElementType is one of the constants defined in Java 5
+     * @since 1.8
+     */
+    public boolean isJava5DeclarationElementType(FieldDoc elt) {
+        return elt.name().contentEquals(ElementType.ANNOTATION_TYPE.name()) ||
+                elt.name().contentEquals(ElementType.CONSTRUCTOR.name()) ||
+                elt.name().contentEquals(ElementType.FIELD.name()) ||
+                elt.name().contentEquals(ElementType.LOCAL_VARIABLE.name()) ||
+                elt.name().contentEquals(ElementType.METHOD.name()) ||
+                elt.name().contentEquals(ElementType.PACKAGE.name()) ||
+                elt.name().contentEquals(ElementType.PARAMETER.name()) ||
+                elt.name().contentEquals(ElementType.TYPE.name());
+    }
+
+    /**
+     * A general purpose case insensitive String comparator, which compares two Strings using a Collator
+     * strength of "TERTIARY".
+     *
+     * @param s1 first String to compare.
+     * @param s2 second String to compare.
+     * @return a negative integer, zero, or a positive integer as the first
+     *         argument is less than, equal to, or greater than the second.
+     */
+    public static int compareStrings(String s1, String s2) {
+        return compareStrings(true, s1, s2);
+    }
+    /**
+     * A general purpose case sensitive String comparator, which compares two Strings using a Collator
+     * strength of "SECONDARY".
+     *
+     * @param s1 first String to compare.
+     * @param s2 second String to compare.
+     * @return a negative integer, zero, or a positive integer as the first
+     *         argument is less than, equal to, or greater than the second.
+     */
+    public static int compareCaseCompare(String s1, String s2) {
+        return compareStrings(false, s1, s2);
+    }
+    private static int compareStrings(boolean caseSensitive, String s1, String s2) {
+        Collator collator = Collator.getInstance();
+        collator.setStrength(caseSensitive ? Collator.TERTIARY : Collator.SECONDARY);
+        return collator.compare(s1, s2);
+    }
+
+    /**
+     * A comparator for index file presentations, and are sorted as follows:
+     *  1. sort on simple names of entities
+     *  2. if equal, then compare the DocKind ex: Package, Interface etc.
+     *  3a. if equal and if the type is of ExecutableMemberDoc(Constructor, Methods),
+     *      a case insensitive comparison of parameter the type signatures
+     *  3b. if equal, case sensitive comparison of the type signatures
+     *  4. finally, if equal, compare the FQNs of the entities
+     * @return a comparator for index file use
+     */
+    public Comparator<Doc> makeComparatorForIndexUse() {
+        return new Utils.DocComparator<Doc>() {
+            /**
+             * Compare two given Doc entities, first sort on names, then on the kinds,
+             * then on the parameters only if the type is an instance of ExecutableMemberDocs,
+             * the parameters are compared and finally the fully qualified names.
+             *
+             * @param d1 - a Doc element.
+             * @param d2 - a Doc element.
+             * @return a negative integer, zero, or a positive integer as the first
+             *         argument is less than, equal to, or greater than the second.
+             */
+            public int compare(Doc d1, Doc d2) {
+                int result = compareNames(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                result = compareDocKinds(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                if (hasParameters(d1)) {
+                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
+                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
+                    result = compareParameters(false, param1, param2);
+                    if (result != 0) {
+                        return result;
+                    }
+                    result = compareParameters(true, param1, param2);
+                    if (result != 0) {
+                        return result;
+                    }
+                }
+                return compareFullyQualifiedNames(d1, d2);
+            }
+        };
+    }
+    /**
+     * Comparator for ClassUse presentations, and sorted as follows,
+     * 1. compares simple names of entities
+     * 2. if equal, the fully qualified names of the entities
+     * 3. if equal and if applicable, the string representation of parameter types
+     * 3a. first by using case insensitive comparison
+     * 3b. second by using a case sensitive comparison
+     * 4. finally the Doc kinds ie. package, class, interface etc.
+     * @return a comparator to sort classes and members for class use
+     */
+    public Comparator<Doc> makeComparatorForClassUse() {
+        return new Utils.DocComparator<Doc>() {
+            /**
+             * Compares two given Doc entities, first sort on name, and if
+             * applicable on the fully qualified name, and if applicable
+             * on the parameter types, and finally the DocKind.
+             * @param d1 - a Doc element.
+             * @param d2 - a Doc element.
+             * @return a negative integer, zero, or a positive integer as the first
+             *         argument is less than, equal to, or greater than the second.
+             */
+            public int compare(Doc d1, Doc d2) {
+                int result = compareNames(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                result = compareFullyQualifiedNames(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                if (hasParameters(d1) && hasParameters(d2)) {
+                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
+                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
+                    result = compareParameters(false, param1, param2);
+                    if (result != 0) {
+                        return result;
+                    }
+                    return compareParameters(true, param1, param2);
+                }
+                return compareDocKinds(d1, d2);
+            }
+        };
+    }
+    /**
+     * A general purpose comparator to sort Doc entities, basically provides the building blocks
+     * for creating specific comparators for an use-case.
+     * @param <T> a Doc entity
+     */
+    static abstract class DocComparator<T extends Doc> implements Comparator<Doc> {
+        static enum DocKind {
+           PACKAGE,
+           CLASS,
+           ENUM,
+           INTERFACE,
+           ANNOTATION,
+           FIELD,
+           CONSTRUCTOR,
+           METHOD
+        };
+        boolean hasParameters(Doc d) {
+            return d instanceof ExecutableMemberDoc;
+        }
+        DocKind getDocKind(Doc d) {
+            if (d.isAnnotationType() || d.isAnnotationTypeElement()) {
+                return DocKind.ANNOTATION;
+            } else if (d.isEnum() || d.isEnumConstant()) {
+                return DocKind.ENUM;
+            } else if (d.isField()) {
+                return DocKind.FIELD;
+            } else if (d.isInterface()) {
+                return DocKind.INTERFACE;
+            } else if (d.isClass()) {
+                return DocKind.CLASS;
+            } else if (d.isConstructor()) {
+                return DocKind.CONSTRUCTOR;
+            } else if (d.isMethod()) {
+                return DocKind.METHOD;
+            } else {
+                return DocKind.PACKAGE;
+            }
+        }
+        /**
+         * Compares two Doc entities' kinds, and these are ordered as defined in
+         * the DocKind enumeration.
+         * @param d1 the first Doc object
+         * @param d2 the second Doc object
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareDocKinds(Doc d1, Doc d2) {
+            return getDocKind(d1).compareTo(getDocKind(d2));
+        }
+        /**
+         * Compares arrays of parameters as a string representation of their types.
+         *
+         * @param ignoreCase specifies case sensitive or insensitive comparison.
+         * @param params1 the first parameter array.
+         * @param params2 the first parameter array.
+         * @return a negative integer, zero, or a positive integer as the first argument is less
+         * than, equal to, or greater than the second.
+         */
+        protected int compareParameters(boolean caseSensitive,
+                                        Parameter[] params1,
+                                        Parameter[] params2) {
+            String s1 = getParametersAsString(params1);
+            String s2 = getParametersAsString(params2);
+            return compareStrings(caseSensitive, s1, s2);
+        }
+        /*
+         * This method returns a string representation solely for comparison purposes.
+         */
+        protected String getParametersAsString(Parameter[] params) {
+            StringBuilder sb = new StringBuilder();
+            for (Parameter param : params) {
+                Type t = param.type();
+                // add parameter type to arrays, as TypeMirror does.
+                String tname = (t.asParameterizedType() != null && t.getElementType() != null)
+                        ? t.getElementType() + t.dimension()
+                        : t.toString();
+                // prefix P for primitive and R for reference types, thus items will
+                // be ordered naturally.
+                sb.append(t.isPrimitive() ? "P" : "R").append("-").append(tname).append("-");
+            }
+            return sb.toString();
+        }
+
+        /**
+         * Compares two Doc entities typically the simple name of a method,
+         * field, constructor etc.
+         * @param d1 the first Doc.
+         * @param d2 the second Doc.
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareNames(Doc d1, Doc d2) {
+            return compareStrings(d1.name(), d2.name());
+        }
+
+        /**
+         * Compares the fully qualified names of the entities
+         * @param d1 the first entity
+         * @param d2 the second entity
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareFullyQualifiedNames(Doc d1, Doc d2) {
+            String name1 = (d1 instanceof ProgramElementDoc)
+                    ? ((ProgramElementDoc)d1).qualifiedName()
+                    : d1.name();
+            String name2 = (d2 instanceof ProgramElementDoc)
+                    ? ((ProgramElementDoc)d2).qualifiedName()
+                    : d2.name();
+            return compareStrings(name1, name2);
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Sun Jun 15 08:41:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -99,6 +99,7 @@
      * The configuration this VisibleMemberMap was created with.
      */
     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<>();
@@ -121,6 +122,7 @@
         this.classdoc = classdoc;
         this.kind = kind;
         this.configuration = configuration;
+        this.utils = configuration.utils;
         new ClassMembers(classdoc, STARTLEVEL).build();
     }
 
@@ -173,7 +175,7 @@
         for (ClassDoc currentClass : visibleClasses) {
             if (currentClass != classdoc &&
                 currentClass.isPackagePrivate() &&
-                !Util.isLinkable(currentClass, configuration)) {
+                !utils.isLinkable(currentClass, configuration)) {
                 // Document these members in the child class because
                 // the parent is inaccessible.
                 results.addAll(getMembersFor(currentClass));
@@ -270,7 +272,7 @@
 
         public boolean isEqual(MethodDoc member) {
             for (ProgramElementDoc element : members) {
-                if (Util.executableMembersEqual(member, (MethodDoc) element)) {
+                if (utils.executableMembersEqual(member, (MethodDoc) element)) {
                     members.add(member);
                     return true;
                 }
@@ -465,7 +467,7 @@
             }
             // Deprected members should be excluded or not?
             if (configuration.nodeprecated) {
-                return Util.excludeDeprecatedMembersAsList(members);
+                return utils.excludeDeprecatedMembersAsList(members);
             }
             return Arrays.asList(members);
         }
@@ -496,7 +498,7 @@
 
         private boolean found(List<ProgramElementDoc> list, ProgramElementDoc elem) {
             for (ProgramElementDoc pgmelem : list) {
-                if (Util.matches(pgmelem, elem)) {
+                if (utils.matches(pgmelem, elem)) {
                     return true;
                 }
             }
@@ -692,7 +694,7 @@
         private boolean isPropertyGetterOrSetter(MethodDoc[] members,
                                                  MethodDoc methodDoc) {
             boolean found = false;
-            String propertyName = Util.propertyNameFromMethodName(configuration, methodDoc.name());
+            String propertyName = utils.propertyNameFromMethodName(configuration, methodDoc.name());
             if (!propertyName.isEmpty()) {
                 String propertyMethodName = propertyName + "Property";
                 for (MethodDoc member: members) {
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Sat Jul 12 07:32:28 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Sun Jun 15 08:41:57 2014 -0700
@@ -91,6 +91,19 @@
                 "PrivateParent",
                 "PrivateInterface");
 
+        checkOutput("pkg/PublicChild.html", false,
+                // Should not document comments from private inherited interfaces
+                "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
+                "<a href=\"../pkg/PublicChild.html#methodInterface-int-\">" +
+                "methodInterface</a></span>(int&nbsp;p1)</code>\n" +
+                "<div class=\"block\">Comment from interface.</div>\n</td>",
+                // and similarly one more
+                "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
+                "<a href=\"../pkg/PublicChild.html#methodInterface2-int-\">" +
+                "methodInterface2</a></span>(int&nbsp;p1)</code>\n" +
+                "<div class=\"block\">Comment from interface.</div>\n</td>"
+        );
+
         checkOutput("pkg/PublicInterface.html", true,
                 // Field inheritance from non-public superinterface.
                 "<a href=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">"
@@ -111,7 +124,7 @@
                 "PrivateInterface",
                 "All Superinterfaces");
 
-        checkOutput("pkg2/C.html", true,
+        checkOutput("pkg2/C.html", false,
                 //Generic interface method test.
                 "This comment should get copied to the implementing class");