changeset 2169:91bd2a6d7737

Merge from main OpenJDK repository
author Greg Lewis <glewis@eyesbeyond.com>
date Sun, 21 May 2017 11:12:40 -0700
parents ffc7e7c4794c b1802aa8be3a
children a7e28ea56c00
files .hgtags test/Makefile
diffstat 76 files changed, 1858 insertions(+), 2505 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Sat Aug 20 11:56:22 2016 -0700
+++ b/.hgtags	Sun May 21 11:12:40 2017 -0700
@@ -609,3 +609,5 @@
 5713b8d2db3f1fc0c9802fdaf30ca802cddf8f65 jdk7u101-b00
 e65eb66727550af75293996fc42e2c49c2002659 jdk7u111-b00
 a5002845bff276d1a8e4bdb4a0dcb972509f7d07 jdk7u111-b01
+3715f0221fd743e878ae5198dbaebe61ebd4fa97 jdk7u121-b00
+240ca8086e7151b5c516b5b46d84201e4e8f5806 jdk7u131-b00
--- a/make/build.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/make/build.properties	Sun May 21 11:12:40 2017 -0700
@@ -126,7 +126,8 @@
 
 javadoc.includes = \
         com/sun/javadoc/ \
-        com/sun/tools/javadoc/
+        com/sun/tools/javadoc/ \
+	com/sun/tools/doclets/internal/toolkit/util/FatalError.java
 
 javadoc.tests = \
         tools/javadoc/
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -181,23 +181,6 @@
      */
     protected abstract void addNavDetailLink(boolean link, Content liNav);
 
-    /***  ***/
-
-    protected void print(String str) {
-        writer.print(str);
-        writer.displayLength += str.length();
-    }
-
-    protected void print(char ch) {
-        writer.print(ch);
-        writer.displayLength++;
-    }
-
-    protected void strong(String str) {
-        writer.strong(str);
-        writer.displayLength += str.length();
-    }
-
     /**
      * Add the member name to the content tree and modifies the display length.
      *
@@ -304,23 +287,6 @@
         tdSummaryType.addContent(code);
     }
 
-    private void printModifier(ProgramElementDoc member) {
-        if (member.isProtected()) {
-            print("protected ");
-        } else if (member.isPrivate()) {
-            print("private ");
-        } else if (!member.isPublic()) { // Package private
-            writer.printText("doclet.Package_private");
-            print(" ");
-        }
-        if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
-            print("abstract ");
-        }
-        if (member.isStatic()) {
-            print("static");
-        }
-    }
-
     /**
      * Add the modifier for the member.
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -104,7 +104,7 @@
             configuration.standardmessage.
                      error("doclet.exception_encountered",
                            exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -25,6 +25,8 @@
 
 package com.sun.tools.doclets.formats.html;
 
+import java.io.IOException;
+
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -187,7 +189,7 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content contentTree) {
+    public void printDocument(Content contentTree) throws IOException {
         printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
                 true, contentTree);
     }
@@ -299,7 +301,7 @@
             subDiv.addContent(div);
         } catch (Exception e) {
             e.printStackTrace();
-            throw new DocletAbortException();
+            throw new DocletAbortException(e);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -210,7 +210,7 @@
             configuration.standardmessage.
                 error("doclet.exception_encountered",
                       exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -25,6 +25,7 @@
 
 package com.sun.tools.doclets.formats.html;
 
+import java.io.IOException;
 import java.util.*;
 
 import com.sun.javadoc.*;
@@ -196,7 +197,7 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content contentTree) {
+    public void printDocument(Content contentTree) throws IOException {
         printHtmlDocument(configuration.metakeywords.getMetaKeywords(classDoc),
                 true, contentTree);
     }
@@ -578,7 +579,7 @@
             subDiv.addContent(div);
         } catch (Exception e) {
             e.printStackTrace();
-            throw new DocletAbortException();
+            throw new DocletAbortException(e);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javadoc.JavaScriptScanner;
+import com.sun.tools.javadoc.RootDocImpl;
 
 import com.sun.javadoc.*;
 import java.util.*;
@@ -171,6 +173,11 @@
     public boolean createoverview = false;
 
     /**
+     * Whether or not to check for JavaScript in doc comments.
+     */
+    private boolean allowScriptInComments;
+
+    /**
      * Unique Resource Handler for this package.
      */
     public final MessageRetriever standardmessage;
@@ -266,8 +273,11 @@
                 nooverview = true;
             } else if (opt.equals("-overview")) {
                 overview = true;
+            } else if (opt.equals("--allow-script-in-comments")) {
+                allowScriptInComments = true;
             }
         }
+
         if (root.specifiedClasses().length > 0) {
             Map<String,PackageDoc> map = new HashMap<String,PackageDoc>();
             PackageDoc pd;
@@ -281,6 +291,30 @@
         }
         setCreateOverview();
         setTopFile(root);
+
+        if (root instanceof RootDocImpl) {
+            JavaScriptScanner jss = ((RootDocImpl) root).initJavaScriptScanner(isAllowScriptInComments());
+            if (jss != null) {
+                // In a more object-oriented world, this would be done by methods on the Option objects.
+                // Note that -windowtitle silently removes any and all HTML elements, and so does not need
+                // to be handled here.
+                checkJavaScript(jss, "-header", header);
+                checkJavaScript(jss, "-footer", footer);
+                checkJavaScript(jss, "-top", top);
+                checkJavaScript(jss, "-bottom", bottom);
+                checkJavaScript(jss, "-doctitle", doctitle);
+                checkJavaScript(jss, "-packagesheader", packagesheader);
+            }
+        }
+    }
+
+    private void checkJavaScript(JavaScriptScanner jss, final String opt, String value) {
+        jss.parse(value, new JavaScriptScanner.Reporter() {
+            public void report() {
+                root.printError(getText("doclet.JavaScript_in_option", opt));
+                throw new FatalError();
+            }
+        });
     }
 
     /**
@@ -314,7 +348,8 @@
             option.equals("-serialwarn") ||
             option.equals("-use") ||
             option.equals("-nonavbar") ||
-            option.equals("-nooverview")) {
+            option.equals("-nooverview") ||
+            option.equals("--allow-script-in-comments")) {
             return 1;
         } else if (option.equals("-help")) {
             System.out.println(getText("doclet.usage"));
@@ -518,4 +553,13 @@
         else
             return Locale.getDefault();
     }
+
+    /**
+     * Returns whether or not to allow JavaScript in comments.
+     * Default is off; can be set true from a command line option.
+     * @return the allowScriptInComments
+     */
+    public boolean isAllowScriptInComments() {
+        return allowScriptInComments;
+    }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -297,7 +297,7 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content contentTree) {
+    public void printDocument(Content contentTree) throws IOException {
         printHtmlDocument(null, true, contentTree);
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -81,7 +81,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
@@ -89,7 +89,7 @@
      * Generate the contants in the "index.html" file. Print the frame details
      * as well as warning if browser is not supporting the Html frames.
      */
-    protected void generateFrameFile() {
+    protected void generateFrameFile() throws IOException {
         Content frameset = getFrameDetails();
         if (configuration.windowtitle.length() > 0) {
             printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -66,14 +66,14 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
     /**
      * Generate the help file contents.
      */
-    protected void generateHelpFile() {
+    protected void generateHelpFile() throws IOException {
         String title = configuration.getText("doclet.Window_Help_title");
         Content body = getBody(true, getWindowTitle(title));
         addTop(body);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -185,9 +185,15 @@
                             .getClassBuilder(curr, prev, next, classtree);
                     classBuilder.build();
                 }
+            } catch (IOException e) {
+                throw new DocletAbortException(e);
+            } catch (FatalError fe) {
+                throw fe;
+            } catch (DocletAbortException de) {
+                throw de;
             } catch (Exception e) {
                 e.printStackTrace();
-                throw new DocletAbortException();
+                throw new DocletAbortException(e);
             }
         }
     }
@@ -278,7 +284,7 @@
                 error((SourcePosition) null,
                     "doclet.perform_copy_exception_encountered",
                     exc.toString());
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -201,33 +201,6 @@
     }
 
     /**
-     * Print Html Hyper Link, with target frame.  This
-     * link will only appear if page is not in a frame.
-     *
-     * @param link String name of the file.
-     * @param where Position in the file
-     * @param target Name of the target frame.
-     * @param label Tag for the link.
-     * @param strong Whether the label should be strong or not?
-     */
-    public void printNoFramesTargetHyperLink(String link, String where,
-                                               String target, String label,
-                                               boolean strong) {
-        script();
-        println("  <!--");
-        println("  if(window==top) {");
-        println("    document.writeln('"
-            + getHyperLinkString(link, where, label, strong, "", "", target) + "');");
-        println("  }");
-        println("  //-->");
-        scriptEnd();
-        noScript();
-        println("  " + getHyperLinkString(link, where, label, strong, "", "", target));
-        noScriptEnd();
-        println(DocletConstants.NL);
-    }
-
-    /**
      * Get the script to show or hide the All classes link.
      *
      * @param id id of the element to show or hide
@@ -324,14 +297,6 @@
         return new TagletWriterImpl(this, isFirstSentence);
     }
 
-    protected void printTagsInfoHeader() {
-        dl();
-    }
-
-    protected void printTagsInfoFooter() {
-        dlEnd();
-    }
-
     /**
      * Get Package link, with target frame.
      *
@@ -346,66 +311,6 @@
     }
 
     /**
-     * Print the html file header. Also print Html page title and stylesheet
-     * default properties.
-     *
-     * @param title         String window title to go in the &lt;TITLE&gt; tag
-     * @param metakeywords  Array of String keywords for META tag.  Each element
-     *                      of the array is assigned to a separate META tag.
-     *                      Pass in null for no array.
-     * @param includeScript boolean true if printing windowtitle script.
-     *             False for files that appear in the left-hand frames.
-     */
-    public void printHtmlHeader(String title, String[] metakeywords,
-            boolean includeScript) {
-        println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " +
-                    "Transitional//EN\" " +
-                    "\"http://www.w3.org/TR/html4/loose.dtd\">");
-        println("<!--NewPage-->");
-        html();
-        head();
-        if (! configuration.notimestamp) {
-            print("<!-- Generated by javadoc (build " + ConfigurationImpl.BUILD_DATE + ") on ");
-            print(today());
-            println(" -->");
-        }
-        if (configuration.charset.length() > 0) {
-            println("<META http-equiv=\"Content-Type\" content=\"text/html; "
-                        + "charset=" + configuration.charset + "\">");
-        }
-        if ( configuration.windowtitle.length() > 0 ) {
-            title += " (" + configuration.windowtitle  + ")";
-        }
-        title(title);
-        println(title);
-        titleEnd();
-        println("");
-        if (! configuration.notimestamp) {
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                println("<META NAME=\"date\" "
-                                    + "CONTENT=\"" + dateFormat.format(new Date()) + "\">");
-        }
-        if ( metakeywords != null ) {
-            for ( int i=0; i < metakeywords.length; i++ ) {
-                println("<META NAME=\"keywords\" "
-                            + "CONTENT=\"" + metakeywords[i] + "\">");
-            }
-        }
-        println("");
-        printStyleSheetProperties();
-        println("");
-        // Don't print windowtitle script for overview-frame, allclasses-frame
-        // and package-frame
-        if (includeScript) {
-            printWinTitleScript(title);
-        }
-        println("");
-        headEnd();
-        println("");
-        body("white", includeScript);
-    }
-
-    /**
      * Generates the HTML document tree and prints it out.
      *
      * @param metakeywords Array of String keywords for META tag. Each element
@@ -416,13 +321,12 @@
      * @param body the body htmltree to be included in the document
      */
     public void printHtmlDocument(String[] metakeywords, boolean includeScript,
-            Content body) {
+            Content body) throws IOException {
         Content htmlDocType = DocType.Transitional();
         Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
         Content head = new HtmlTree(HtmlTag.HEAD);
         if (!configuration.notimestamp) {
-            Content headComment = new Comment("Generated by javadoc (version " +
-                    ConfigurationImpl.BUILD_DATE + ") on " + today());
+            Content headComment = new Comment(getGeneratedByString());
             head.addContent(headComment);
         }
         if (configuration.charset.length() > 0) {
@@ -447,7 +351,7 @@
                 head, body);
         Content htmlDocument = new HtmlDocument(htmlDocType,
                 htmlComment, htmlTree);
-        print(htmlDocument.toString());
+        write(htmlDocument);
     }
 
     /**
@@ -464,26 +368,6 @@
     }
 
     /**
-     * Print user specified header and the footer.
-     *
-     * @param header if true print the user provided header else print the
-     * user provided footer.
-     */
-    public void printUserHeaderFooter(boolean header) {
-        em();
-        if (header) {
-            print(replaceDocRootDir(configuration.header));
-        } else {
-            if (configuration.footer.length() != 0) {
-                print(replaceDocRootDir(configuration.footer));
-            } else {
-                print(replaceDocRootDir(configuration.header));
-            }
-        }
-        emEnd();
-    }
-
-    /**
      * Get user specified header and the footer.
      *
      * @param header if true print the user provided header else print the
@@ -506,14 +390,6 @@
     }
 
     /**
-     * Print the user specified top.
-     */
-    public void printTop() {
-        print(replaceDocRootDir(configuration.top));
-        hr();
-    }
-
-    /**
      * Adds the user specified top.
      *
      * @param body the content tree to which user specified top will be added
@@ -524,14 +400,6 @@
     }
 
     /**
-     * Print the user specified bottom.
-     */
-    public void printBottom() {
-        hr();
-        print(replaceDocRootDir(configuration.bottom));
-    }
-
-    /**
      * Adds the user specified bottom.
      *
      * @param body the content tree to which user specified bottom will be added
@@ -544,128 +412,6 @@
     }
 
     /**
-     * Print the navigation bar for the Html page at the top and and the bottom.
-     *
-     * @param header If true print navigation bar at the top of the page else
-     * print the nevigation bar at the bottom.
-     */
-    protected void navLinks(boolean header) {
-        println("");
-        if (!configuration.nonavbar) {
-            if (header) {
-                println(DocletConstants.NL + "<!-- ========= START OF TOP NAVBAR ======= -->");
-                anchor("navbar_top");
-                println();
-                print(getHyperLinkString("", "skip-navbar_top", "", false, "",
-                    configuration.getText("doclet.Skip_navigation_links"), ""));
-            } else {
-                println(DocletConstants.NL + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
-                anchor("navbar_bottom");
-                println();
-                print(getHyperLinkString("", "skip-navbar_bottom", "", false, "",
-                    configuration.getText("doclet.Skip_navigation_links"), ""));
-            }
-            table(0, "100%", 1, 0);
-            tr();
-            tdColspanBgcolorStyle(2, "#EEEEFF", "NavBarCell1");
-            println("");
-            if (header) {
-                anchor("navbar_top_firstrow");
-            } else {
-                anchor("navbar_bottom_firstrow");
-            }
-            table(0, 0, 3);
-            print("  ");
-            trAlignVAlign("center", "top");
-
-            if (configuration.createoverview) {
-                navLinkContents();
-            }
-
-            if (configuration.packages.length == 1) {
-                navLinkPackage(configuration.packages[0]);
-            } else if (configuration.packages.length > 1) {
-                navLinkPackage();
-            }
-
-            navLinkClass();
-
-            if(configuration.classuse) {
-                navLinkClassUse();
-            }
-            if(configuration.createtree) {
-                navLinkTree();
-            }
-            if(!(configuration.nodeprecated ||
-                     configuration.nodeprecatedlist)) {
-                navLinkDeprecated();
-            }
-            if(configuration.createindex) {
-                navLinkIndex();
-            }
-            if (!configuration.nohelp) {
-                navLinkHelp();
-            }
-            print("  ");
-            trEnd();
-            tableEnd();
-            tdEnd();
-
-            tdAlignVAlignRowspan("right", "top", 3);
-
-            printUserHeaderFooter(header);
-            tdEnd();
-            trEnd();
-            println("");
-
-            tr();
-            tdBgcolorStyle("white", "NavBarCell2");
-            font("-2");
-            space();
-            navLinkPrevious();
-            space();
-            println("");
-            space();
-            navLinkNext();
-            fontEnd();
-            tdEnd();
-
-            tdBgcolorStyle("white", "NavBarCell2");
-            font("-2");
-            print("  ");
-            navShowLists();
-            print("  ");
-            space();
-            println("");
-            space();
-            navHideLists(filename);
-            print("  ");
-            space();
-            println("");
-            space();
-            navLinkClassIndex();
-            fontEnd();
-            tdEnd();
-
-            trEnd();
-
-            printSummaryDetailLinks();
-
-            tableEnd();
-            if (header) {
-                aName("skip-navbar_top");
-                aEnd();
-                println(DocletConstants.NL + "<!-- ========= END OF TOP NAVBAR ========= -->");
-            } else {
-                aName("skip-navbar_bottom");
-                aEnd();
-                println(DocletConstants.NL + "<!-- ======== END OF BOTTOM NAVBAR ======= -->");
-            }
-            println("");
-        }
-    }
-
-    /**
      * Adds the navigation bar for the Html page at the top and and the bottom.
      *
      * @param header If true print navigation bar at the top of the page else
@@ -758,14 +504,6 @@
     }
 
     /**
-     * Print the word "NEXT" to indicate that no link is available.  Override
-     * this method to customize next link.
-     */
-    protected void navLinkNext() {
-        navLinkNext(null);
-    }
-
-    /**
      * Get the word "NEXT" to indicate that no link is available.  Override
      * this method to customize next link.
      *
@@ -776,14 +514,6 @@
     }
 
     /**
-     * Print the word "PREV" to indicate that no link is available.  Override
-     * this method to customize prev link.
-     */
-    protected void navLinkPrevious() {
-        navLinkPrevious(null);
-    }
-
-    /**
      * Get the word "PREV" to indicate that no link is available.  Override
      * this method to customize prev link.
      *
@@ -796,26 +526,10 @@
     /**
      * Do nothing. This is the default method.
      */
-    protected void printSummaryDetailLinks() {
-    }
-
-    /**
-     * Do nothing. This is the default method.
-     */
     protected void addSummaryDetailLinks(Content navDiv) {
     }
 
     /**
-     * Print link to the "overview-summary.html" page.
-     */
-    protected void navLinkContents() {
-        navCellStart();
-        printHyperLink(relativePath + "overview-summary.html", "",
-                       configuration.getText("doclet.Overview"), true, "NavBarFont1");
-        navCellEnd();
-    }
-
-    /**
      * Get link to the "overview-summary.html" page.
      *
      * @return a content tree for the link
@@ -828,46 +542,6 @@
     }
 
     /**
-     * Description for a cell in the navigation bar.
-     */
-    protected void navCellStart() {
-        print("  ");
-        tdBgcolorStyle("#EEEEFF", "NavBarCell1");
-        print("    ");
-    }
-
-    /**
-     * Description for a cell in the navigation bar, but with reverse
-     * high-light effect.
-     */
-    protected void navCellRevStart() {
-        print("  ");
-        tdBgcolorStyle("#FFFFFF", "NavBarCell1Rev");
-        print(" ");
-        space();
-    }
-
-    /**
-     * Closing tag for navigation bar cell.
-     */
-    protected void navCellEnd() {
-        space();
-        tdEnd();
-    }
-
-    /**
-     * Print link to the "package-summary.html" page for the package passed.
-     *
-     * @param pkg Package to which link will be generated.
-     */
-    protected void navLinkPackage(PackageDoc pkg) {
-        navCellStart();
-        printPackageLink(pkg, configuration.getText("doclet.Package"), true,
-            "NavBarFont1");
-        navCellEnd();
-    }
-
-    /**
      * Get link to the "package-summary.html" page for the package passed.
      *
      * @param pkg Package to which link will be generated
@@ -881,18 +555,6 @@
     }
 
     /**
-     * Print the word "Package" in the navigation bar cell, to indicate that
-     * link is not available here.
-     */
-    protected void navLinkPackage() {
-        navCellStart();
-        fontStyle("NavBarFont1");
-        printText("doclet.Package");
-        fontEnd();
-        navCellEnd();
-    }
-
-    /**
      * Get the word "Package" , to indicate that link is not available here.
      *
      * @return a content tree for the link
@@ -903,18 +565,6 @@
     }
 
     /**
-     * Print the word "Use" in the navigation bar cell, to indicate that link
-     * is not available.
-     */
-    protected void navLinkClassUse() {
-        navCellStart();
-        fontStyle("NavBarFont1");
-        printText("doclet.navClassUse");
-        fontEnd();
-        navCellEnd();
-    }
-
-    /**
      * Get the word "Use", to indicate that link is not available.
      *
      * @return a content tree for the link
@@ -925,20 +575,6 @@
     }
 
     /**
-     * Print link for previous file.
-     *
-     * @param prev File name for the prev link.
-     */
-    public void navLinkPrevious(String prev) {
-        String tag = configuration.getText("doclet.Prev");
-        if (prev != null) {
-            printHyperLink(prev, "", tag, true) ;
-        } else {
-            print(tag);
-        }
-    }
-
-    /**
      * Get link for previous file.
      *
      * @param prev File name for the prev link
@@ -955,21 +591,6 @@
     }
 
     /**
-     * Print link for next file.  If next is null, just print the label
-     * without linking it anywhere.
-     *
-     * @param next File name for the next link.
-     */
-    public void navLinkNext(String next) {
-        String tag = configuration.getText("doclet.Next");
-        if (next != null) {
-            printHyperLink(next, "", tag, true);
-        } else {
-            print(tag);
-        }
-    }
-
-    /**
      * Get link for next file.  If next is null, just print the label
      * without linking it anywhere.
      *
@@ -987,16 +608,6 @@
     }
 
     /**
-     * Print "FRAMES" link, to switch to the frame version of the output.
-     *
-     * @param link File to be linked, "index.html".
-     */
-    protected void navShowLists(String link) {
-        print(getHyperLinkString(link + "?" + path + filename, "",
-            configuration.getText("doclet.FRAMES"), true, "", "", "_top"));
-    }
-
-    /**
      * Get "FRAMES" link, to switch to the frame version of the output.
      *
      * @param link File to be linked, "index.html"
@@ -1010,13 +621,6 @@
     }
 
     /**
-     * Print "FRAMES" link, to switch to the frame version of the output.
-     */
-    protected void navShowLists() {
-        navShowLists(relativePath + "index.html");
-    }
-
-    /**
      * Get "FRAMES" link, to switch to the frame version of the output.
      *
      * @return a content tree for the link
@@ -1026,16 +630,6 @@
     }
 
     /**
-     * Print "NO FRAMES" link, to switch to the non-frame version of the output.
-     *
-     * @param link File to be linked.
-     */
-    protected void navHideLists(String link) {
-        print(getHyperLinkString(link, "", configuration.getText("doclet.NO_FRAMES"),
-            true, "", "", "_top"));
-    }
-
-    /**
      * Get "NO FRAMES" link, to switch to the non-frame version of the output.
      *
      * @param link File to be linked
@@ -1048,25 +642,6 @@
     }
 
     /**
-     * Print "Tree" link in the navigation bar. If there is only one package
-     * specified on the command line, then the "Tree" link will be to the
-     * only "package-tree.html" file otherwise it will be to the
-     * "overview-tree.html" file.
-     */
-    protected void navLinkTree() {
-        navCellStart();
-        PackageDoc[] packages = configuration.root.specifiedPackages();
-        if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) {
-            printHyperLink(pathString(packages[0], "package-tree.html"), "",
-                           configuration.getText("doclet.Tree"), true, "NavBarFont1");
-        } else {
-            printHyperLink(relativePath + "overview-tree.html", "",
-                           configuration.getText("doclet.Tree"), true, "NavBarFont1");
-        }
-        navCellEnd();
-    }
-
-    /**
      * Get "Tree" link in the navigation bar. If there is only one package
      * specified on the command line, then the "Tree" link will be to the
      * only "package-tree.html" file otherwise it will be to the
@@ -1103,18 +678,6 @@
     }
 
     /**
-     * Print the word "Class" in the navigation bar cell, to indicate that
-     * class link is not available.
-     */
-    protected void navLinkClass() {
-        navCellStart();
-        fontStyle("NavBarFont1");
-        printText("doclet.Class");
-        fontEnd();
-        navCellEnd();
-    }
-
-    /**
      * Get the word "Class", to indicate that class link is not available.
      *
      * @return a content tree for the link
@@ -1125,16 +688,6 @@
     }
 
     /**
-     * Print "Deprecated" API link in the navigation bar.
-     */
-    protected void navLinkDeprecated() {
-        navCellStart();
-        printHyperLink(relativePath + "deprecated-list.html", "",
-                       configuration.getText("doclet.navDeprecated"), true, "NavBarFont1");
-        navCellEnd();
-    }
-
-    /**
      * Get "Deprecated" API link in the navigation bar.
      *
      * @return a content tree for the link
@@ -1147,17 +700,6 @@
     }
 
     /**
-     * Print link for generated index. If the user has used "-splitindex"
-     * command line option, then link to file "index-files/index-1.html" is
-     * generated otherwise link to file "index-all.html" is generated.
-     */
-    protected void navLinkClassIndex() {
-        printNoFramesTargetHyperLink(relativePath +
-                AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES,
-            "", "", configuration.getText("doclet.All_Classes"), true);
-    }
-
-    /**
      * Get link for generated index. If the user has used "-splitindex"
      * command line option, then link to file "index-files/index-1.html" is
      * generated otherwise link to file "index-all.html" is generated.
@@ -1171,20 +713,6 @@
         Content li = HtmlTree.LI(allClassesContent);
         return li;
     }
-    /**
-     * Print link for generated class index.
-     */
-    protected void navLinkIndex() {
-        navCellStart();
-        printHyperLink(relativePath +
-                           (configuration.splitindex?
-                                DirectoryManager.getPath("index-files") +
-                                fileseparator: "") +
-                           (configuration.splitindex?
-                                "index-1.html" : "index-all.html"), "",
-                       configuration.getText("doclet.Index"), true, "NavBarFont1");
-        navCellEnd();
-    }
 
     /**
      * Get link for generated class index.
@@ -1201,27 +729,6 @@
     }
 
     /**
-     * Print help file link. If user has provided a help file, then generate a
-     * link to the user given file, which is already copied to current or
-     * destination directory.
-     */
-    protected void navLinkHelp() {
-        String helpfilenm = configuration.helpfile;
-        if (helpfilenm.equals("")) {
-            helpfilenm = "help-doc.html";
-        } else {
-            int lastsep;
-            if ((lastsep = helpfilenm.lastIndexOf(File.separatorChar)) != -1) {
-                helpfilenm = helpfilenm.substring(lastsep + 1);
-            }
-        }
-        navCellStart();
-        printHyperLink(relativePath + helpfilenm, "",
-                       configuration.getText("doclet.Help"), true, "NavBarFont1");
-        navCellEnd();
-    }
-
-    /**
      * Get help file link. If user has provided a help file, then generate a
      * link to the user given file, which is already copied to current or
      * destination directory.
@@ -1245,87 +752,6 @@
     }
 
     /**
-     * Print the word "Detail" in the navigation bar. No link is available.
-     */
-    protected void navDetail() {
-        printText("doclet.Detail");
-    }
-
-    /**
-     * Print the word "Summary" in the navigation bar. No link is available.
-     */
-    protected void navSummary() {
-        printText("doclet.Summary");
-    }
-
-    /**
-     * Print the Html table tag for the index summary tables. The table tag
-     * printed is
-     * &lt;TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
-     */
-    public void tableIndexSummary() {
-        table(1, "100%", 3, 0);
-    }
-
-    /**
-     * Print the Html table tag for the index summary tables.
-     *
-     * @param summary the summary for the table tag summary attribute.
-     */
-    public void tableIndexSummary(String summary) {
-        table(1, "100%", 3, 0, summary);
-    }
-
-    /**
-     * Same as {@link #tableIndexSummary()}.
-     */
-    public void tableIndexDetail() {
-        table(1, "100%", 3, 0);
-    }
-
-    /**
-     * Print Html tag for table elements. The tag printed is
-     * &lt;TD ALIGN="right" VALIGN="top" WIDTH="1%"&gt;.
-     */
-    public void tdIndex() {
-        print("<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\">");
-    }
-
-    /**
-     * Print table caption.
-     */
-    public void tableCaptionStart() {
-        captionStyle("TableCaption");
-    }
-
-    /**
-     * Print table sub-caption.
-     */
-    public void tableSubCaptionStart() {
-        captionStyle("TableSubCaption");
-    }
-
-    /**
-     * Print table caption end tags.
-     */
-    public void tableCaptionEnd() {
-        captionEnd();
-    }
-
-    /**
-     * Print summary table header.
-     */
-    public void summaryTableHeader(String[] header, String scope) {
-        tr();
-        for ( int i=0; i < header.length; i++ ) {
-            thScopeNoWrap("TableHeader", scope);
-            print(header[i]);
-            thEnd();
-        }
-        trEnd();
-    }
-
-    /**
      * Get summary table header.
      *
      * @param header the header for the table
@@ -1454,144 +880,6 @@
     }
 
     /**
-     * Prine table header information about color, column span and the font.
-     *
-     * @param color Background color.
-     * @param span  Column span.
-     */
-    public void tableHeaderStart(String color, int span) {
-        trBgcolorStyle(color, "TableHeadingColor");
-        thAlignColspan("left", span);
-        font("+2");
-    }
-
-    /**
-     * Print table header for the inherited members summary tables. Print the
-     * background color information.
-     *
-     * @param color Background color.
-     */
-    public void tableInheritedHeaderStart(String color) {
-        trBgcolorStyle(color, "TableSubHeadingColor");
-        thAlign("left");
-    }
-
-    /**
-     * Print "Use" table header. Print the background color and the column span.
-     *
-     * @param color Background color.
-     */
-    public void tableUseInfoHeaderStart(String color) {
-        trBgcolorStyle(color, "TableSubHeadingColor");
-        thAlignColspan("left", 2);
-    }
-
-    /**
-     * Print table header with the background color with default column span 2.
-     *
-     * @param color Background color.
-     */
-    public void tableHeaderStart(String color) {
-        tableHeaderStart(color, 2);
-    }
-
-    /**
-     * Print table header with the column span, with the default color #CCCCFF.
-     *
-     * @param span Column span.
-     */
-    public void tableHeaderStart(int span) {
-        tableHeaderStart("#CCCCFF", span);
-    }
-
-    /**
-     * Print table header with default column span 2 and default color #CCCCFF.
-     */
-    public void tableHeaderStart() {
-        tableHeaderStart(2);
-    }
-
-    /**
-     * Print table header end tags for font, column and row.
-     */
-    public void tableHeaderEnd() {
-        fontEnd();
-        thEnd();
-        trEnd();
-    }
-
-    /**
-     * Print table header end tags in inherited tables for column and row.
-     */
-    public void tableInheritedHeaderEnd() {
-        thEnd();
-        trEnd();
-    }
-
-    /**
-     * Print the summary table row cell attribute width.
-     *
-     * @param width Width of the table cell.
-     */
-    public void summaryRow(int width) {
-        if (width != 0) {
-            tdWidth(width + "%");
-        } else {
-            td();
-        }
-    }
-
-    /**
-     * Print the summary table row cell end tag.
-     */
-    public void summaryRowEnd() {
-        tdEnd();
-    }
-
-    /**
-     * Print the heading in Html &lt;H2> format.
-     *
-     * @param str The Header string.
-     */
-    public void printIndexHeading(String str) {
-        h2();
-        print(str);
-        h2End();
-    }
-
-    /**
-     * Print Html tag &lt;FRAMESET=arg&gt;.
-     *
-     * @param arg Argument for the tag.
-     */
-    public void frameSet(String arg) {
-        println("<FRAMESET " + arg + ">");
-    }
-
-    /**
-     * Print Html closing tag &lt;/FRAMESET&gt;.
-     */
-    public void frameSetEnd() {
-        println("</FRAMESET>");
-    }
-
-    /**
-     * Print Html tag &lt;FRAME=arg&gt;.
-     *
-     * @param arg Argument for the tag.
-     */
-    public void frame(String arg) {
-        println("<FRAME " + arg + ">");
-    }
-
-    /**
-     * Print Html closing tag &lt;/FRAME&gt;.
-     */
-    public void frameEnd() {
-        println("</FRAME>");
-    }
-
-    /**
      * Return path to the class page for a classdoc. For example, the class
      * name is "java.lang.Object" and if the current file getting generated is
      * "java/io/File.html", then the path string to the class, returned is
@@ -1630,30 +918,6 @@
     }
 
     /**
-     * Print the link to the given package.
-     *
-     * @param pkg the package to link to.
-     * @param label the label for the link.
-     * @param isStrong true if the label should be strong.
-     */
-    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong) {
-        print(getPackageLinkString(pkg, label, isStrong));
-    }
-
-    /**
-     * Print the link to the given package.
-     *
-     * @param pkg the package to link to.
-     * @param label the label for the link.
-     * @param isStrong true if the label should be strong.
-     * @param style  the font of the package link label.
-     */
-    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong,
-            String style) {
-        print(getPackageLinkString(pkg, label, isStrong, style));
-    }
-
-    /**
      * Return the link to the given package.
      *
      * @param pkg the package to link to.
@@ -1736,21 +1000,6 @@
         return (cd.isInterface())?  italicsText(name): name;
     }
 
-    public void printSrcLink(ProgramElementDoc d, String label) {
-        if (d == null) {
-            return;
-        }
-        ClassDoc cd = d.containingClass();
-        if (cd == null) {
-            //d must be a class doc since in has no containing class.
-            cd = (ClassDoc) d;
-        }
-        String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME
-            + DirectoryManager.getDirectoryPath(cd.containingPackage())
-            + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(d);
-        printHyperLink(href, "", label, true);
-    }
-
     /**
      * Add the link to the content tree.
      *
@@ -1800,13 +1049,6 @@
             factory.getTypeParameterLinks(linkInfo, false)).toString();
     }
 
-    /**
-     * Print the link to the given class.
-     */
-    public void printLink(LinkInfoImpl linkInfo) {
-        print(getLink(linkInfo));
-    }
-
     /*************************************************************
      * Return a class cross link to external class documentation.
      * The name must be fully qualified to determine which package
@@ -1830,7 +1072,7 @@
         while((periodIndex = packageName.lastIndexOf('.')) != -1) {
             className = packageName.substring(periodIndex + 1, packageName.length()) +
                 (className.length() > 0 ? "." + className : "");
-            String defaultLabel = code ? getCode() + className + getCodeEnd() : className;
+            String defaultLabel = code ? codeText(className) : className;
             packageName = packageName.substring(0, periodIndex);
             if (getCrossPackageLink(packageName) != null) {
                 //The package exists in external documentation, so link to the external
@@ -1938,30 +1180,6 @@
         addPreQualifiedClassLink(context, cd, true, contentTree);
     }
 
-    public void printText(String key) {
-        print(configuration.getText(key));
-    }
-
-    public void printText(String key, String a1) {
-        print(configuration.getText(key, a1));
-    }
-
-    public void printText(String key, String a1, String a2) {
-        print(configuration.getText(key, a1, a2));
-    }
-
-    public void strongText(String key) {
-        strong(configuration.getText(key));
-    }
-
-    public void strongText(String key, String a1) {
-        strong(configuration.getText(key, a1));
-    }
-
-    public void strongText(String key, String a1, String a2) {
-        strong(configuration.getText(key, a1, a2));
-    }
-
     /**
      * Get the link for the given member.
      *
@@ -1975,39 +1193,6 @@
     }
 
     /**
-     * Print the link for the given member.
-     *
-     * @param context the id of the context where the link will be printed.
-     * @param classDoc the classDoc that we should link to.  This is not
-     *                 necessarily equal to doc.containingClass().  We may be
-     *                 inheriting comments.
-     * @param doc the member being linked to.
-     * @param label the label for the link.
-     * @param strong true if the link should be strong.
-     */
-    public void printDocLink(int context, ClassDoc classDoc, MemberDoc doc,
-            String label, boolean strong) {
-        printDocLink(context, classDoc, doc, label, strong, false);
-    }
-
-    /**
-     * Print the link for the given member.
-     *
-     * @param context the id of the context where the link will be printed.
-     * @param classDoc the classDoc that we should link to.  This is not
-     *                 necessarily equal to doc.containingClass().  We may be
-     *                 inheriting comments.
-     * @param doc the member being linked to.
-     * @param label the label for the link.
-     * @param strong true if the link should be strong.
-     * @param isProperty true if the doc parameter is a JavaFX property.
-     */
-    public void printDocLink(int context, ClassDoc classDoc, MemberDoc doc,
-            String label, boolean strong, boolean isProperty) {
-        print(getDocLink(context, classDoc, doc, label, strong, isProperty));
-    }
-
-    /**
      * Return the link for the given member.
      *
      * @param context the id of the context where the link will be printed.
@@ -2096,10 +1281,6 @@
         }
     }
 
-    public void anchor(ExecutableMemberDoc emd) {
-        anchor(getAnchor(emd));
-    }
-
     public String getAnchor(ExecutableMemberDoc emd) {
         return getAnchor(emd, false);
     }
@@ -2129,66 +1310,61 @@
         if (! (tagName.startsWith("@link") || tagName.equals("@see"))) {
             return "";
         }
-        StringBuffer result = new StringBuffer();
-        boolean isplaintext = tagName.toLowerCase().equals("@linkplain");
-        String label = see.label();
-        label = (label.length() > 0)?
-            ((isplaintext) ? label :
-                 getCode() + label + getCodeEnd()):"";
+
         String seetext = replaceDocRootDir(see.text());
 
         //Check if @see is an href or "string"
         if (seetext.startsWith("<") || seetext.startsWith("\"")) {
-            result.append(seetext);
-            return result.toString();
+            return seetext;
         }
 
+        boolean plain = tagName.equalsIgnoreCase("@linkplain");
+        String label = plainOrCodeText(plain, see.label());
+
         //The text from the @see tag.  We will output this text when a label is not specified.
-        String text = (isplaintext) ? seetext : getCode() + seetext + getCodeEnd();
+        String text = plainOrCodeText(plain, seetext);
 
         ClassDoc refClass = see.referencedClass();
         String refClassName = see.referencedClassName();
         MemberDoc refMem = see.referencedMember();
         String refMemName = see.referencedMemberName();
+
         if (refClass == null) {
             //@see is not referencing an included class
             PackageDoc refPackage = see.referencedPackage();
             if (refPackage != null && refPackage.isIncluded()) {
                 //@see is referencing an included package
-                String packageName = isplaintext ? refPackage.name() :
-                    getCode() + refPackage.name() + getCodeEnd();
-                result.append(getPackageLinkString(refPackage,
-                    label.length() == 0 ? packageName : label, false));
+                if (label.isEmpty())
+                    label = plainOrCodeText(plain, refPackage.name());
+                return getPackageLinkString(refPackage, label, false);
             } else {
                 //@see is not referencing an included class or package.  Check for cross links.
                 String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName);
                 if (packageCrossLink != null) {
                     //Package cross link found
-                    result.append(getHyperLinkString(packageCrossLink, "",
-                        (label.length() == 0)? text : label, false));
+                    return getHyperLinkString(packageCrossLink, "",
+                        (label.isEmpty() ? text : label), false);
                 } else if ((classCrossLink = getCrossClassLink(refClassName,
-                        refMemName, label, false, "", ! isplaintext)) != null) {
-                    //Class cross link found (possiblly to a member in the class)
-                    result.append(classCrossLink);
+                        refMemName, label, false, "", !plain)) != null) {
+                    //Class cross link found (possibly to a member in the class)
+                    return classCrossLink;
                 } else {
                     //No cross link found so print warning
                     configuration.getDocletSpecificMsg().warning(see.position(), "doclet.see.class_or_package_not_found",
                             tagName, seetext);
-                    result.append((label.length() == 0)? text: label);
+                    return (label.isEmpty() ? text: label);
                 }
             }
         } else if (refMemName == null) {
             // Must be a class reference since refClass is not null and refMemName is null.
-            if (label.length() == 0) {
-                label = (isplaintext) ? refClass.name() : getCode() + refClass.name() + getCodeEnd();
-                result.append(getLink(new LinkInfoImpl(refClass, label)));
-            } else {
-                result.append(getLink(new LinkInfoImpl(refClass, label)));
+            if (label.isEmpty()) {
+                label = plainOrCodeText(plain, refClass.name());
             }
+            return getLink(new LinkInfoImpl(refClass, label));
         } else if (refMem == null) {
             // Must be a member reference since refClass is not null and refMemName is not null.
             // However, refMem is null, so this referenced member does not exist.
-            result.append((label.length() == 0)? text: label);
+            return (label.isEmpty() ? text: label);
         } else {
             // Must be a member reference since refClass is not null and refMemName is not null.
             // refMem is not null, so this @see tag must be referencing a valid member.
@@ -2227,17 +1403,16 @@
                 }
             }
 
-            text = (isplaintext) ?
-                refMemName : getCode() + Util.escapeHtmlChars(refMemName) + getCodeEnd();
 
-            result.append(getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing,
-                refMem, (label.length() == 0)? text: label, false));
+            text = plainOrCodeText(plain, Util.escapeHtmlChars(refMemName));
+
+            return getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing,
+                refMem, (label.isEmpty() ? text: label), false);
         }
-        return result.toString();
     }
 
-    public void printInlineComment(Doc doc, Tag tag) {
-        printCommentTags(doc, tag.inlineTags(), false, false);
+    private String plainOrCodeText(boolean plain, String text) {
+        return (plain || text.isEmpty()) ? text : codeText(text);
     }
 
     /**
@@ -2251,10 +1426,6 @@
         addCommentTags(doc, tag.inlineTags(), false, false, htmltree);
     }
 
-    public void printInlineDeprecatedComment(Doc doc, Tag tag) {
-        printCommentTags(doc, tag.inlineTags(), true, false);
-    }
-
     /**
      * Add the inline deprecated comment.
      *
@@ -2266,10 +1437,6 @@
         addCommentTags(doc, tag.inlineTags(), true, false, htmltree);
     }
 
-    public void printSummaryComment(Doc doc) {
-        printSummaryComment(doc, doc.firstSentenceTags());
-    }
-
     /**
      * Adds the summary content.
      *
@@ -2280,10 +1447,6 @@
         addSummaryComment(doc, doc.firstSentenceTags(), htmltree);
     }
 
-    public void printSummaryComment(Doc doc, Tag[] firstSentenceTags) {
-        printCommentTags(doc, firstSentenceTags, false, true);
-    }
-
     /**
      * Adds the summary content.
      *
@@ -2295,23 +1458,10 @@
         addCommentTags(doc, firstSentenceTags, false, true, htmltree);
     }
 
-    public void printSummaryDeprecatedComment(Doc doc) {
-        printCommentTags(doc, doc.firstSentenceTags(), true, true);
-    }
-
-    public void printSummaryDeprecatedComment(Doc doc, Tag tag) {
-        printCommentTags(doc, tag.firstSentenceTags(), true, true);
-    }
-
     public void addSummaryDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
         addCommentTags(doc, tag.firstSentenceTags(), true, true, htmltree);
     }
 
-    public void printInlineComment(Doc doc) {
-        printCommentTags(doc, doc.inlineTags(), false, false);
-        p();
-    }
-
     /**
      * Adds the inline comment.
      *
@@ -2322,27 +1472,6 @@
         addCommentTags(doc, doc.inlineTags(), false, false, htmltree);
     }
 
-    public void printInlineDeprecatedComment(Doc doc) {
-        printCommentTags(doc, doc.inlineTags(), true, false);
-    }
-
-    private void printCommentTags(Doc doc, Tag[] tags, boolean depr, boolean first) {
-        if(configuration.nocomment){
-            return;
-        }
-        if (depr) {
-            italic();
-        }
-        String result = commentTagsToString(null, doc, tags, first);
-        print(result);
-        if (depr) {
-            italicEnd();
-        }
-        if (tags.length == 0) {
-            space();
-        }
-    }
-
     /**
      * Adds the comment tags.
      *
@@ -2607,22 +1736,6 @@
         }
     }
 
-    public void printStyleSheetProperties() {
-        String filename = configuration.stylesheetfile;
-        if (filename.length() > 0) {
-            File stylefile = new File(filename);
-            String parent = stylefile.getParent();
-            filename = (parent == null)?
-                filename:
-                filename.substring(parent.length() + 1);
-        } else {
-            filename = "stylesheet.css";
-        }
-        filename = relativePath + filename;
-        link("REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"" +
-                 filename + "\" " + "TITLE=\"Style\"");
-    }
-
     /**
      * Returns a link to the stylesheet file.
      *
@@ -2654,15 +1767,6 @@
     }
 
     /**
-     * Write the annotatation types for the given packageDoc.
-     *
-     * @param packageDoc the package to write annotations for.
-     */
-    public void writeAnnotationInfo(PackageDoc packageDoc) {
-        writeAnnotationInfo(packageDoc, packageDoc.annotations());
-    }
-
-    /**
      * Adds the annotatation types for the given packageDoc.
      *
      * @param packageDoc the package to write annotations for.
@@ -2674,15 +1778,6 @@
     }
 
     /**
-     * Write the annotatation types for the given doc.
-     *
-     * @param doc the doc to write annotations for.
-     */
-    public void writeAnnotationInfo(ProgramElementDoc doc) {
-        writeAnnotationInfo(doc, doc.annotations());
-    }
-
-    /**
      * Adds the annotatation types for the given doc.
      *
      * @param packageDoc the package to write annotations for
@@ -2693,17 +1788,6 @@
     }
 
     /**
-     * Write the annotatation types for the given doc and parameter.
-     *
-     * @param indent the number of spaced to indent the parameters.
-     * @param doc the doc to write annotations for.
-     * @param param the parameter to write annotations for.
-     */
-    public boolean writeAnnotationInfo(int indent, Doc doc, Parameter param) {
-        return writeAnnotationInfo(indent, doc, param.annotations(), false);
-    }
-
-    /**
      * Add the annotatation types for the given doc and parameter.
      *
      * @param indent the number of spaces to indent the parameters.
@@ -2717,16 +1801,6 @@
     }
 
     /**
-     * Write the annotatation types for the given doc.
-     *
-     * @param doc the doc to write annotations for.
-     * @param descList the array of {@link AnnotationDesc}.
-     */
-    private void writeAnnotationInfo(Doc doc, AnnotationDesc[] descList) {
-        writeAnnotationInfo(0, doc, descList, true);
-    }
-
-    /**
      * Adds the annotatation types for the given doc.
      *
      * @param doc the doc to write annotations for.
@@ -2740,26 +1814,6 @@
     }
 
     /**
-     * Write the annotatation types for the given doc.
-     *
-     * @param indent the number of extra spaces to indent the annotations.
-     * @param doc the doc to write annotations for.
-     * @param descList the array of {@link AnnotationDesc}.
-     */
-    private boolean writeAnnotationInfo(int indent, Doc doc, AnnotationDesc[] descList, boolean lineBreak) {
-        List<String> annotations = getAnnotations(indent, descList, lineBreak);
-        if (annotations.size() == 0) {
-            return false;
-        }
-        fontNoNewLine("-1");
-        for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) {
-            print(iter.next());
-        }
-        fontEnd();
-        return true;
-    }
-
-    /**
      * Adds the annotatation types for the given doc.
      *
      * @param indent the number of extra spaces to indent the annotations.
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -55,18 +55,6 @@
         return Arrays.asList(cd.serializableFields());
     }
 
-    protected void printTypeLinkNoDimension(Type type) {
-        ClassDoc cd = type.asClassDoc();
-        //Linking to package private classes in serialized for causes
-        //broken links.  Don't link to them.
-        if (type.isPrimitive() || cd.isPackagePrivate()) {
-            print(type.typeName());
-        } else {
-            writer.printLink(new LinkInfoImpl(
-                LinkInfoImpl.CONTEXT_SERIAL_MEMBER, type));
-        }
-    }
-
     /**
      * Return the header for serializable fields section.
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -161,14 +161,4 @@
                 method.containingClass().qualifiedName(), method.name());
         }
     }
-
-    protected void printTypeLinkNoDimension(Type type) {
-        ClassDoc cd = type.asClassDoc();
-        if (type.isPrimitive() || cd.isPackagePrivate()) {
-            print(type.typeName());
-        } else {
-            writer.printLink(new LinkInfoImpl(
-                LinkInfoImpl.CONTEXT_SERIAL_MEMBER,type));
-        }
-    }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -109,7 +109,7 @@
             configuration.standardmessage.error(
                     "doclet.exception_encountered",
                     exc.toString(), OUTPUT_FILE_NAME);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -65,7 +65,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -91,7 +91,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -102,7 +102,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -102,7 +102,7 @@
             configuration.standardmessage.error(
                 "doclet.exception_encountered",
                 exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -248,7 +248,7 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content contentTree) {
+    public void printDocument(Content contentTree) throws IOException {
         printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
                 true, contentTree);
     }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -36,7 +36,7 @@
  * @author Atul M Dambalkar
  */
 public class SerializedFormWriterImpl extends SubWriterHolderWriter
-    implements com.sun.tools.doclets.internal.toolkit.SerializedFormWriter {
+    implements SerializedFormWriter {
 
     private static final String FILE_NAME = "serialized-form.html";
 
@@ -49,23 +49,6 @@
     }
 
     /**
-     * Writes the given header.
-     *
-     * @param header the header to write.
-     */
-    public void writeHeader(String header) {
-        printHtmlHeader(header, null, true);
-        printTop();
-        navLinks(true);
-        hr();
-        center();
-        h1();
-        print(header);
-        h1End();
-        centerEnd();
-    }
-
-    /**
      * Get the given header.
      *
      * @param header the header to write
@@ -225,20 +208,10 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content serializedTree) {
+    public void printDocument(Content serializedTree) throws IOException {
         printHtmlDocument(null, true, serializedTree);
     }
 
-    private void tableHeader() {
-        tableIndexSummary();
-        trBgcolorStyle("#CCCCFF", "TableSubHeadingColor");
-    }
-
-    private void tableFooter() {
-        fontEnd();
-        thEnd(); trEnd(); tableEnd();
-    }
-
     /**
      * Return an instance of a SerialFieldWriter.
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -75,7 +75,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +99,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -60,18 +60,6 @@
         super(configuration, path, filename, relpath);
     }
 
-    public void printTypeSummaryHeader() {
-        tdIndex();
-        font("-1");
-        code();
-    }
-
-    public void printTypeSummaryFooter() {
-        codeEnd();
-        fontEnd();
-        tdEnd();
-    }
-
     /**
      * Add the summary header.
      *
@@ -99,14 +87,6 @@
         return table;
     }
 
-    public void printTableHeadingBackground(String str) {
-        tableIndexDetail();
-        tableHeaderStart("#CCCCFF", 1);
-        strong(str);
-        tableHeaderEnd();
-        tableEnd();
-    }
-
     /**
      * Add the inherited summary header.
      *
@@ -120,19 +100,6 @@
         mw.addInheritedSummaryLabel(cd, inheritedTree);
     }
 
-    public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
-        tableEnd();
-        space();
-    }
-
-    public void printInheritedSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
-        codeEnd();
-        summaryRowEnd();
-        trEnd();
-        tableEnd();
-        space();
-    }
-
     /**
      * Add the index comment.
      *
@@ -143,24 +110,6 @@
         addIndexComment(member, member.firstSentenceTags(), contentTree);
     }
 
-    protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
-        Tag[] deprs = member.tags("deprecated");
-        if (Util.isDeprecated((ProgramElementDoc) member)) {
-            strongText("doclet.Deprecated");
-            space();
-            if (deprs.length > 0) {
-                printInlineDeprecatedComment(member, deprs[0]);
-            }
-            return;
-        } else {
-            ClassDoc cd = ((ProgramElementDoc)member).containingClass();
-            if (cd != null && Util.isDeprecated(cd)) {
-                strongText("doclet.Deprecated"); space();
-            }
-        }
-        printSummaryComment(member, firstSentenceTags);
-    }
-
     /**
      * Add the index comment.
      *
@@ -217,18 +166,6 @@
         addSummaryLinkComment(mw, member, member.firstSentenceTags(), contentTree);
     }
 
-    public void printSummaryLinkComment(AbstractMemberWriter mw,
-                                        ProgramElementDoc member,
-                                        Tag[] firstSentenceTags) {
-        codeEnd();
-        println();
-        br();
-        printNbsps();
-        printIndexComment(member, firstSentenceTags);
-        summaryRowEnd();
-        trEnd();
-    }
-
     /**
      * Add the summary link comment.
      *
@@ -259,13 +196,6 @@
         mw.addInheritedSummaryLink(cd, member, linksTree);
     }
 
-    public void printMemberHeader() {
-        hr();
-    }
-
-    public void printMemberFooter() {
-    }
-
     /**
      * Get the document content header tree
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,7 +88,7 @@
             configuration.standardmessage.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
+import java.io.IOException;
+import java.io.Writer;
+
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -33,7 +36,7 @@
  *
  * @author Bhavesh Patel
  */
-public class Comment extends Content{
+public class Comment extends Content {
 
     private String commentText;
 
@@ -55,7 +58,7 @@
      *                              is not supported.
      */
     public void addContent(Content content) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -67,7 +70,7 @@
      *                              is not supported.
      */
     public void addContent(String stringContent) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -80,11 +83,13 @@
     /**
      * {@inheritDoc}
      */
-    public void write(StringBuilder contentBuilder) {
-        if (!endsWithNewLine(contentBuilder))
-            contentBuilder.append(DocletConstants.NL);
-        contentBuilder.append("<!-- ");
-        contentBuilder.append(commentText);
-        contentBuilder.append(" -->" + DocletConstants.NL);
+    @Override
+    public boolean write(Writer out, boolean atNewline) throws IOException {
+        if (!atNewline)
+            out.write(DocletConstants.NL);
+        out.write("<!-- ");
+        out.write(commentText);
+        out.write(" -->" + DocletConstants.NL);
+        return true;
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
+import java.io.IOException;
+import java.io.Writer;
+
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -82,7 +85,7 @@
      *                              is not supported.
      */
     public void addContent(Content content) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -94,7 +97,7 @@
      *                              is not supported.
      */
     public void addContent(String stringContent) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -107,7 +110,9 @@
     /**
      * {@inheritDoc}
      */
-    public void write(StringBuilder contentBuilder) {
-        contentBuilder.append(docType);
+    @Override
+    public boolean write(Writer out, boolean atNewline) throws IOException {
+        out.write(docType);
+        return true; // guaranteed by constructor
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -29,6 +29,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.doclets.formats.html.ConfigurationImpl;
 import com.sun.tools.doclets.internal.toolkit.*;
 
 
@@ -79,48 +80,6 @@
     public abstract Configuration configuration();
 
     /**
-     * Print Html Hyper Link.
-     *
-     * @param link String name of the file.
-     * @param where Position of the link in the file. Character '#' is not
-     * needed.
-     * @param label Tag for the link.
-     * @param strong  Boolean that sets label to strong.
-     */
-    public void printHyperLink(String link, String where,
-                               String label, boolean strong) {
-        print(getHyperLinkString(link, where, label, strong, "", "", ""));
-    }
-
-    /**
-     * Print Html Hyper Link.
-     *
-     * @param link String name of the file.
-     * @param where Position of the link in the file. Character '#' is not
-     * needed.
-     * @param label Tag for the link.
-     */
-    public void printHyperLink(String link, String where, String label) {
-        printHyperLink(link, where, label, false);
-    }
-
-    /**
-     * Print Html Hyper Link.
-     *
-     * @param link       String name of the file.
-     * @param where      Position of the link in the file. Character '#' is not
-     * needed.
-     * @param label      Tag for the link.
-     * @param strong       Boolean that sets label to strong.
-     * @param stylename  String style of text defined in style sheet.
-     */
-    public void printHyperLink(String link, String where,
-                               String label, boolean strong,
-                               String stylename) {
-        print(getHyperLinkString(link, where, label, strong, stylename, "", ""));
-    }
-
-    /**
      * Return Html Hyper Link string.
      *
      * @param link       String name of the file.
@@ -267,15 +226,6 @@
     }
 
     /**
-     * Print the name of the package, this class is in.
-     *
-     * @param cd    ClassDoc.
-     */
-    public void printPkgName(ClassDoc cd) {
-        print(getPkgName(cd));
-    }
-
-    /**
      * Get the name of the package, this class is in.
      *
      * @param cd    ClassDoc.
@@ -289,27 +239,6 @@
         return "";
     }
 
-    /**
-     * Keep track of member details list. Print the definition list start tag
-     * if it is not printed yet.
-     */
-    public void printMemberDetailsListStartTag () {
-        if (!getMemberDetailsListPrinted()) {
-            dl();
-            memberDetailsListPrinted = true;
-        }
-    }
-
-    /**
-     * Print the definition list end tag if the list start tag was printed.
-     */
-    public void printMemberDetailsListEndTag () {
-        if (getMemberDetailsListPrinted()) {
-            dlEnd();
-            memberDetailsListPrinted = false;
-        }
-    }
-
     public boolean getMemberDetailsListPrinted() {
         return memberDetailsListPrinted;
     }
@@ -323,12 +252,12 @@
      * @param frameset the frameset to be added to the HTML document
      */
     public void printFramesetDocument(String title, boolean noTimeStamp,
-            Content frameset) {
+            Content frameset) throws IOException {
         Content htmlDocType = DocType.Frameset();
         Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
         Content head = new HtmlTree(HtmlTag.HEAD);
         if (! noTimeStamp) {
-            Content headComment = new Comment("Generated by javadoc on " + today());
+            Content headComment = new Comment(getGeneratedByString());
             head.addContent(headComment);
         }
         if (configuration.charset.length() > 0) {
@@ -343,7 +272,7 @@
                 head, frameset);
         Content htmlDocument = new HtmlDocument(htmlDocType,
                 htmlComment, htmlTree);
-        print(htmlDocument.toString());
+        write(htmlDocument);
     }
 
     /**
@@ -360,46 +289,9 @@
         return space;
     }
 
-    /**
-     * Print the closing &lt;/body&gt; and &lt;/html&gt; tags.
-     */
-    public void printBodyHtmlEnd() {
-        println();
-        bodyEnd();
-        htmlEnd();
-    }
-
-    /**
-     * Calls {@link #printBodyHtmlEnd()} method.
-     */
-    public void printFooter() {
-        printBodyHtmlEnd();
-    }
-
-    /**
-     * Print closing &lt;/html&gt; tag.
-     */
-    public void printFrameFooter() {
-        htmlEnd();
-    }
-
-    /**
-     * Print ten non-breaking spaces("&#38;nbsp;").
-     */
-    public void printNbsps() {
-        print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
-    }
-
-    /**
-     * Get the day and date information for today, depending upon user option.
-     *
-     * @return String Today.
-     * @see java.util.Calendar
-     * @see java.util.GregorianCalendar
-     * @see java.util.TimeZone
-     */
-    public String today() {
+    protected String getGeneratedByString() {
         Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
-        return calendar.getTime().toString();
+        Date today = calendar.getTime();
+        return "Generated by javadoc ("+ ConfigurationImpl.BUILD_DATE + ") on " + today;
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,10 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
+import java.io.IOException;
+import java.io.Writer;
 import java.util.*;
+
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -69,7 +72,7 @@
      *
      * @param htmlContent html content to be added
      */
-    public void addContent(Content htmlContent) {
+    public final void addContent(Content htmlContent) {
         if (htmlContent.isValid())
             docContent.add(htmlContent);
     }
@@ -83,7 +86,7 @@
      *                              is not supported.
      */
     public void addContent(String stringContent) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -96,8 +99,9 @@
     /**
      * {@inheritDoc}
      */
-    public void write(StringBuilder contentBuilder) {
+    public boolean write(Writer out,  boolean atNewline) throws IOException {
         for (Content c : docContent)
-            c.write(contentBuilder);
+            atNewline = c.write(out, atNewline);
+        return atNewline;
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Sun May 21 11:12:40 2017 -0700
@@ -25,8 +25,11 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
+import java.io.IOException;
+import java.io.Writer;
 import java.util.*;
 import java.nio.charset.*;
+
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -792,35 +795,41 @@
     /**
      * {@inheritDoc}
      */
-    public void write(StringBuilder contentBuilder) {
-        if (!isInline() && !endsWithNewLine(contentBuilder))
-            contentBuilder.append(DocletConstants.NL);
+    @Override
+    public boolean write(Writer out, boolean atNewline) throws IOException {
+        if (!isInline() && !atNewline)
+            out.write(DocletConstants.NL);
         String tagString = htmlTag.toString();
-        contentBuilder.append("<");
-        contentBuilder.append(tagString);
+        out.write("<");
+        out.write(tagString);
         Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
         HtmlAttr key;
         String value = "";
         while (iterator.hasNext()) {
             key = iterator.next();
             value = attrs.get(key);
-            contentBuilder.append(" ");
-            contentBuilder.append(key.toString());
+            out.write(" ");
+            out.write(key.toString());
             if (!value.isEmpty()) {
-                contentBuilder.append("=\"");
-                contentBuilder.append(value);
-                contentBuilder.append("\"");
+                out.write("=\"");
+                out.write(value);
+                out.write("\"");
             }
         }
-        contentBuilder.append(">");
+        out.write(">");
+        boolean nl = false;
         for (Content c : content)
-            c.write(contentBuilder);
+            nl = c.write(out, nl);
         if (htmlTag.endTagRequired()) {
-            contentBuilder.append("</");
-            contentBuilder.append(tagString);
-            contentBuilder.append(">");
+            out.write("</");
+            out.write(tagString);
+            out.write(">");
         }
-        if (!isInline())
-            contentBuilder.append(DocletConstants.NL);
+        if (!isInline()) {
+            out.write(DocletConstants.NL);
+            return true;
+        } else {
+            return false;
+        }
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,14 @@
 
 /**
  * Class for the Html format code generation.
- * Initilizes PrintWriter with FileWriter, to enable print
+ * Initializes PrintWriter with FileWriter, to enable print
  * related methods to generate the code to the named File through FileWriter.
  *
  * @since 1.2
  * @author Atul M Dambalkar
  * @author Bhavesh Patel (Modified)
  */
-public class HtmlWriter extends PrintWriter {
+public class HtmlWriter {
 
     /**
      * Name of the file, to which this writer is writing to.
@@ -150,6 +150,12 @@
 
     public final Content descfrmInterfaceLabel;
 
+    private final File file;
+
+    private final String docEncoding;
+
+    private Writer writer;
+
     /**
      * Constructor.
      *
@@ -166,8 +172,9 @@
     public HtmlWriter(Configuration configuration,
                       String path, String filename, String docencoding)
                       throws IOException, UnsupportedEncodingException {
-        super(Util.genWriter(configuration, path, filename, docencoding));
+        file = Util.genWriterFile(configuration, path, filename);
         this.configuration = configuration;
+        this.docEncoding = docencoding;
         htmlFilename = filename;
         this.memberDetailsListPrinted = false;
         packageTableHeader = new String[] {
@@ -216,6 +223,15 @@
         descfrmInterfaceLabel = getResource("doclet.Description_From_Interface");
     }
 
+    public void write(Content c) throws IOException {
+        writer = Util.genWriter(file, docEncoding);
+        c.write(writer, true);
+    }
+
+    public void close() throws IOException {
+        writer.close();
+    }
+
     /**
      * Get the configuration string as a content.
      *
@@ -250,38 +266,6 @@
     }
 
     /**
-     * Print &lt;HTML&gt; tag. Add a newline character at the end.
-     */
-    public void html() {
-        println("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">");
-    }
-
-    /**
-     * Print &lt;/HTML&gt; tag. Add a newline character at the end.
-     */
-    public void htmlEnd() {
-        println("</HTML>");
-    }
-
-    /**
-     * Print the script code to be embeded before the  &lt;/HEAD&gt; tag.
-     */
-    protected void printWinTitleScript(String winTitle){
-        if(winTitle != null && winTitle.length() > 0) {
-            script();
-            println("function windowTitle()");
-            println("{");
-            println("    if (location.href.indexOf('is-external=true') == -1) {");
-            println("        parent.document.title=\"" + winTitle + "\";");
-            println("    }");
-            println("}");
-            scriptEnd();
-            noScript();
-            noScriptEnd();
-        }
-    }
-
-    /**
      * Returns an HtmlTree for the SCRIPT tag.
      *
      * @return an HtmlTree for the SCRIPT tag
@@ -291,8 +275,12 @@
         if(winTitle != null && winTitle.length() > 0) {
             script.addAttr(HtmlAttr.TYPE, "text/javascript");
             String scriptCode = "<!--" + DocletConstants.NL +
-                    "    if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
-                    "        parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
+                    "    try {" + DocletConstants.NL +
+                    "        if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
+                    "            parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
+                    "        }" + DocletConstants.NL +
+                    "    }" + DocletConstants.NL +
+                    "    catch(err) {" + DocletConstants.NL +
                     "    }" + DocletConstants.NL +
                     "//-->" + DocletConstants.NL;
             RawHtml scriptContent = new RawHtml(scriptCode);
@@ -353,14 +341,16 @@
      *
      * @return a content for the SCRIPT tag
      */
-    protected Content getFramesetJavaScript(){
+    protected Content getFramesetJavaScript() {
         HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
         script.addAttr(HtmlAttr.TYPE, "text/javascript");
-        String scriptCode = DocletConstants.NL + "    targetPage = \"\" + window.location.search;" + DocletConstants.NL +
-                "    if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
-                "        targetPage = targetPage.substring(1);" + DocletConstants.NL +
-                "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
-                "        targetPage = \"undefined\";" + DocletConstants.NL +
+        String scriptCode = DocletConstants.NL +
+                "    tmpTargetPage = \"\" + window.location.search;" + DocletConstants.NL +
+                "    if (tmpTargetPage != \"\" && tmpTargetPage != \"undefined\")" + DocletConstants.NL +
+                "        tmpTargetPage = tmpTargetPage.substring(1);" + DocletConstants.NL +
+                "    if (tmpTargetPage.indexOf(\":\") != -1 || (tmpTargetPage != \"\" && !validURL(tmpTargetPage)))" + DocletConstants.NL +
+                "        tmpTargetPage = \"undefined\";" + DocletConstants.NL +
+                "    targetPage = tmpTargetPage;" + DocletConstants.NL +
                 "    function validURL(url) {" + DocletConstants.NL +
                 "        try {" + DocletConstants.NL +
                 "            url = decodeURIComponent(url);" + DocletConstants.NL +
@@ -412,64 +402,6 @@
     }
 
     /**
-     * Print the Javascript &lt;SCRIPT&gt; start tag with its type
-     * attribute.
-     */
-    public void script() {
-        println("<SCRIPT type=\"text/javascript\">");
-    }
-
-    /**
-     * Print the Javascript &lt;/SCRIPT&gt; end tag.
-     */
-    public void scriptEnd() {
-        println("</SCRIPT>");
-    }
-
-    /**
-     * Print the Javascript &lt;NOSCRIPT&gt; start tag.
-     */
-    public void noScript() {
-        println("<NOSCRIPT>");
-    }
-
-    /**
-     * Print the Javascript &lt;/NOSCRIPT&gt; end tag.
-     */
-    public void noScriptEnd() {
-        println("</NOSCRIPT>");
-    }
-
-    /**
-     * Return the Javascript call to be embedded in the &lt;BODY&gt; tag.
-     * Return nothing if winTitle is empty.
-     * @return the Javascript call to be embedded in the &lt;BODY&gt; tag.
-     */
-    protected String getWindowTitleOnload(){
-        if(winTitle != null && winTitle.length() > 0) {
-            return " onload=\"windowTitle();\"";
-        } else {
-            return "";
-        }
-    }
-
-    /**
-     * Print &lt;BODY BGCOLOR="bgcolor"&gt;, including JavaScript
-     * "onload" call to load windowtitle script.  This script shows the name
-     * of the document in the window title bar when frames are on.
-     *
-     * @param bgcolor Background color.
-     * @param includeScript  boolean set true if printing windowtitle script
-     */
-    public void body(String bgcolor, boolean includeScript) {
-        print("<BODY BGCOLOR=\"" + bgcolor + "\"");
-        if (includeScript) {
-            print(getWindowTitleOnload());
-        }
-        println(">");
-    }
-
-    /**
      * Returns an HtmlTree for the BODY tag.
      *
      * @param includeScript  set true if printing windowtitle script
@@ -492,31 +424,6 @@
     }
 
     /**
-     * Print &lt;/BODY&gt; tag. Add a newline character at the end.
-     */
-    public void bodyEnd() {
-        println("</BODY>");
-    }
-
-    /**
-     * Print &lt;TITLE&gt; tag. Add a newline character at the end.
-     */
-    public void title() {
-        println("<TITLE>");
-    }
-
-    /**
-     * Print &lt;TITLE&gt; tag. Add a newline character at the end.
-     *
-     * @param winTitle The title of this document.
-     */
-    public void title(String winTitle) {
-        // Set window title string which is later printed
-        this.winTitle = winTitle;
-        title();
-    }
-
-    /**
      * Returns an HtmlTree for the TITLE tag.
      *
      * @return an HtmlTree for the TITLE tag
@@ -527,295 +434,6 @@
     }
 
     /**
-     * Print &lt;/TITLE&gt; tag. Add a newline character at the end.
-     */
-    public void titleEnd() {
-        println("</TITLE>");
-    }
-
-    /**
-     * Print &lt;UL&gt; tag. Add a newline character at the end.
-     */
-    public void ul() {
-        println("<UL>");
-    }
-
-    /**
-     * Print &lt;/UL&gt; tag. Add a newline character at the end.
-     */
-    public void ulEnd() {
-        println("</UL>");
-    }
-
-    /**
-     * Print &lt;LI&gt; tag.
-     */
-    public void li() {
-        print("<LI>");
-    }
-
-    /**
-     * Print &lt;LI TYPE="type"&gt; tag.
-     *
-     * @param type Type string.
-     */
-    public void li(String type) {
-        print("<LI TYPE=\"" + type + "\">");
-    }
-
-    /**
-     * Print &lt;H1&gt; tag. Add a newline character at the end.
-     */
-    public void h1() {
-        println("<H1>");
-    }
-
-    /**
-     * Print &lt;/H1&gt; tag. Add a newline character at the end.
-     */
-    public void h1End() {
-        println("</H1>");
-    }
-
-    /**
-     * Print text with &lt;H1&gt; tag. Also adds &lt;/H1&gt; tag. Add a newline character
-     * at the end of the text.
-     *
-     * @param text Text to be printed with &lt;H1&gt; format.
-     */
-    public void h1(String text) {
-        h1();
-        println(text);
-        h1End();
-    }
-
-    /**
-     * Print &lt;H2&gt; tag. Add a newline character at the end.
-     */
-    public void h2() {
-        println("<H2>");
-    }
-
-    /**
-     * Print text with &lt;H2&gt; tag. Also adds &lt;/H2&gt; tag. Add a newline character
-     *  at the end of the text.
-     *
-     * @param text Text to be printed with &lt;H2&gt; format.
-     */
-    public void h2(String text) {
-        h2();
-        println(text);
-        h2End();
-    }
-
-    /**
-     * Print &lt;/H2&gt; tag. Add a newline character at the end.
-     */
-    public void h2End() {
-        println("</H2>");
-    }
-
-    /**
-     * Print &lt;H3&gt; tag. Add a newline character at the end.
-     */
-    public void h3() {
-        println("<H3>");
-    }
-
-    /**
-     * Print text with &lt;H3&gt; tag. Also adds &lt;/H3&gt; tag. Add a newline character
-     *  at the end of the text.
-     *
-     * @param text Text to be printed with &lt;H3&gt; format.
-     */
-    public void h3(String text) {
-        h3();
-        println(text);
-        h3End();
-    }
-
-    /**
-     * Print &lt;/H3&gt; tag. Add a newline character at the end.
-     */
-    public void h3End() {
-        println("</H3>");
-    }
-
-    /**
-     * Print &lt;H4&gt; tag. Add a newline character at the end.
-     */
-    public void h4() {
-        println("<H4>");
-    }
-
-    /**
-     * Print &lt;/H4&gt; tag. Add a newline character at the end.
-     */
-    public void h4End() {
-        println("</H4>");
-    }
-
-    /**
-     * Print text with &lt;H4&gt; tag. Also adds &lt;/H4&gt; tag. Add a newline character
-     * at the end of the text.
-     *
-     * @param text Text to be printed with &lt;H4&gt; format.
-     */
-    public void h4(String text) {
-        h4();
-        println(text);
-        h4End();
-    }
-
-    /**
-     * Print &lt;H5&gt; tag. Add a newline character at the end.
-     */
-    public void h5() {
-        println("<H5>");
-    }
-
-    /**
-     * Print &lt;/H5&gt; tag. Add a newline character at the end.
-     */
-    public void h5End() {
-        println("</H5>");
-    }
-
-    /**
-     * Print HTML &lt;IMG SRC="imggif" WIDTH="width" HEIGHT="height" ALT="imgname&gt;
-     * tag. It prepends the "images" directory name to the "imggif". This
-     * method is used for oneone format generation. Add a newline character
-     * at the end.
-     *
-     * @param imggif   Image GIF file.
-     * @param imgname  Image name.
-     * @param width    Width of the image.
-     * @param height   Height of the image.
-     */
-    public void img(String imggif, String imgname, int width, int height) {
-        println("<IMG SRC=\"images/" + imggif + ".gif\""
-              + " WIDTH=\"" + width + "\" HEIGHT=\"" + height
-              + "\" ALT=\"" + imgname + "\">");
-    }
-
-    /**
-     * Print &lt;MENU&gt; tag. Add a newline character at the end.
-     */
-    public void menu() {
-        println("<MENU>");
-    }
-
-    /**
-     * Print &lt;/MENU&gt; tag. Add a newline character at the end.
-     */
-    public void menuEnd() {
-        println("</MENU>");
-    }
-
-    /**
-     * Print &lt;PRE&gt; tag. Add a newline character at the end.
-     */
-    public void pre() {
-        println("<PRE>");
-    }
-
-    /**
-     * Print &lt;PRE&gt; tag without adding new line character at th eend.
-     */
-    public void preNoNewLine() {
-        print("<PRE>");
-    }
-
-    /**
-     * Print &lt;/PRE&gt; tag. Add a newline character at the end.
-     */
-    public void preEnd() {
-        println("</PRE>");
-    }
-
-    /**
-     * Print &lt;HR&gt; tag. Add a newline character at the end.
-     */
-    public void hr() {
-        println("<HR>");
-    }
-
-    /**
-     * Print &lt;HR SIZE="size" WIDTH="widthpercent%"&gt; tag. Add a newline
-     * character at the end.
-     *
-     * @param size           Size of the ruler.
-     * @param widthPercent   Percentage Width of the ruler
-     */
-    public void hr(int size, int widthPercent) {
-        println("<HR SIZE=\"" + size + "\" WIDTH=\"" + widthPercent + "%\">");
-    }
-
-    /**
-     * Print &lt;HR SIZE="size" NOSHADE&gt; tag. Add a newline character at the end.
-     *
-     * @param size           Size of the ruler.
-     * @param noshade        noshade string.
-     */
-    public void hr(int size, String noshade) {
-        println("<HR SIZE=\"" + size + "\" NOSHADE>");
-    }
-
-    /**
-     * Get the "&lt;STRONG&gt;" string.
-     *
-     * @return String Return String "&lt;STRONG&gt;";
-     */
-    public String getStrong() {
-        return "<STRONG>";
-    }
-
-    /**
-     * Get the "&lt;/STRONG&gt;" string.
-     *
-     * @return String Return String "&lt;/STRONG&gt;";
-     */
-    public String getStrongEnd() {
-        return "</STRONG>";
-    }
-
-    /**
-     * Print &lt;STRONG&gt; tag.
-     */
-    public void strong() {
-        print("<STRONG>");
-    }
-
-    /**
-     * Print &lt;/STRONG&gt; tag.
-     */
-    public void strongEnd() {
-        print("</STRONG>");
-    }
-
-    /**
-     * Print text passed, in strong format using &lt;STRONG&gt; and &lt;/STRONG&gt; tags.
-     *
-     * @param text String to be printed in between &lt;STRONG&gt; and &lt;/STRONG&gt; tags.
-     */
-    public void strong(String text) {
-        strong();
-        print(text);
-        strongEnd();
-    }
-
-    /**
-     * Print text passed, in Italics using &lt;I&gt; and &lt;/I&gt; tags.
-     *
-     * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
-     */
-    public void italics(String text) {
-        print("<I>");
-        print(text);
-        println("</I>");
-    }
-
-    /**
      * Return, text passed, with Italics &lt;i&gt; and &lt;/i&gt; tags, surrounding it.
      * So if the text passed is "Hi", then string returned will be "&lt;i&gt;Hi&lt;/i&gt;".
      *
@@ -830,690 +448,16 @@
     }
 
     /**
-     * Print "&#38;nbsp;", non-breaking space.
-     */
-    public void space() {
-        print("&nbsp;");
-    }
-
-    /**
      * Return "&#38;nbsp;", non-breaking space.
      */
     public Content getSpace() {
         return RawHtml.nbsp;
     }
 
-    /**
-     * Print &lt;DL&gt; tag. Add a newline character at the end.
-     */
-    public void dl() {
-        println("<DL>");
-    }
-
-    /**
-     * Print &lt;/DL&gt; tag. Add a newline character at the end.
-     */
-    public void dlEnd() {
-        println("</DL>");
-    }
-
-    /**
-     * Print &lt;DT&gt; tag.
-     */
-    public void dt() {
-        print("<DT>");
-    }
-
-    /**
-     * Print &lt;/DT&gt; tag.
-     */
-    public void dtEnd() {
-        print("</DT>");
-    }
-
-    /**
-     * Print &lt;DD&gt; tag.
-     */
-    public void dd() {
-        print("<DD>");
-    }
-
-    /**
-     * Print &lt;/DD&gt; tag. Add a newline character at the end.
-     */
-    public void ddEnd() {
-        println("</DD>");
-    }
-
-    /**
-     * Print &lt;SUP&gt; tag. Add a newline character at the end.
-     */
-    public void sup() {
-        println("<SUP>");
-    }
-
-    /**
-     * Print &lt;/SUP&gt; tag. Add a newline character at the end.
-     */
-    public void supEnd() {
-        println("</SUP>");
-    }
-
-    /**
-     * Print &lt;FONT SIZE="size"&gt; tag. Add a newline character at the end.
-     *
-     * @param size String size.
-     */
-    public void font(String size) {
-        println("<FONT SIZE=\"" + size + "\">");
-    }
-
-    /**
-     * Print &lt;FONT SIZE="size"&gt; tag.
-     *
-     * @param size String size.
-     */
-    public void fontNoNewLine(String size) {
-        print("<FONT SIZE=\"" + size + "\">");
-    }
-
-    /**
-     * Print &lt;FONT CLASS="stylename"&gt; tag. Add a newline character at the end.
-     *
-     * @param stylename String stylename.
-     */
-    public void fontStyle(String stylename) {
-        print("<FONT CLASS=\"" + stylename + "\">");
-    }
-
-    /**
-     * Print &lt;FONT SIZE="size" CLASS="stylename"&gt; tag. Add a newline character
-     * at the end.
-     *
-     * @param size String size.
-     * @param stylename String stylename.
-     */
-    public void fontSizeStyle(String size, String stylename) {
-        println("<FONT size=\"" + size + "\" CLASS=\"" + stylename + "\">");
-    }
-
-    /**
-     * Print &lt;/FONT&gt; tag.
-     */
-    public void fontEnd() {
-        print("</FONT>");
-    }
-
-    /**
-     * Get the "&lt;FONT COLOR="color"&gt;" string.
-     *
-     * @param color String color.
-     * @return String Return String "&lt;FONT COLOR="color"&gt;".
-     */
-    public String getFontColor(String color) {
-        return "<FONT COLOR=\"" + color + "\">";
-    }
-
-    /**
-     * Get the "&lt;/FONT&gt;" string.
-     *
-     * @return String Return String "&lt;/FONT&gt;";
-     */
-    public String getFontEnd() {
-        return "</FONT>";
-    }
-
-    /**
-     * Print &lt;CENTER&gt; tag. Add a newline character at the end.
-     */
-    public void center() {
-        println("<CENTER>");
-    }
-
-    /**
-     * Print &lt;/CENTER&gt; tag. Add a newline character at the end.
-     */
-    public void centerEnd() {
-        println("</CENTER>");
-    }
-
-    /**
-     * Print anchor &lt;A NAME="name"&gt; tag.
-     *
-     * @param name Name String.
-     */
-    public void aName(String name) {
-        print("<A NAME=\"" + name + "\">");
-    }
-
-    /**
-     * Print &lt;/A&gt; tag.
-     */
-    public void aEnd() {
-        print("</A>");
-    }
-
-    /**
-     * Print &lt;I&gt; tag.
-     */
-    public void italic() {
-        print("<I>");
-    }
-
-    /**
-     * Print &lt;/I&gt; tag.
-     */
-    public void italicEnd() {
-        print("</I>");
-    }
-
-    /**
-     * Print contents within anchor &lt;A NAME="name"&gt; tags.
-     *
-     * @param name String name.
-     * @param content String contents.
-     */
-    public void anchor(String name, String content) {
-        aName(name);
-        print(content);
-        aEnd();
-    }
-
-    /**
-     * Print anchor &lt;A NAME="name"&gt; and &lt;/A&gt;tags. Print comment string
-     * "&lt;!-- --&gt;" within those tags.
-     *
-     * @param name String name.
-     */
-    public void anchor(String name) {
-        anchor(name, "<!-- -->");
-    }
-
-    /**
-     * Print newline and then print &lt;P&gt; tag. Add a newline character at the
-     * end.
-     */
-    public void p() {
-        println();
-        println("<P>");
-    }
-
-    /**
-     * Print newline and then print &lt;/P&gt; tag. Add a newline character at the
-     * end.
-     */
-    public void pEnd() {
-        println();
-        println("</P>");
-    }
-
-    /**
-     * Print newline and then print &lt;BR&gt; tag. Add a newline character at the
-     * end.
-     */
-    public void br() {
-        println();
-        println("<BR>");
-    }
-
-    /**
-     * Print &lt;ADDRESS&gt; tag. Add a newline character at the end.
-     */
-    public void address() {
-        println("<ADDRESS>");
-    }
-
-    /**
-     * Print &lt;/ADDRESS&gt; tag. Add a newline character at the end.
-     */
-    public void addressEnd() {
-        println("</ADDRESS>");
-    }
-
-    /**
-     * Print &lt;HEAD&gt; tag. Add a newline character at the end.
-     */
-    public void head() {
-        println("<HEAD>");
-    }
-
-    /**
-     * Print &lt;/HEAD&gt; tag. Add a newline character at the end.
-     */
-    public void headEnd() {
-        println("</HEAD>");
-    }
-
-    /**
-     * Print &lt;CODE&gt; tag.
-     */
-    public void code() {
-        print("<CODE>");
-    }
-
-    /**
-     * Print &lt;/CODE&gt; tag.
-     */
-    public void codeEnd() {
-        print("</CODE>");
-    }
-
-    /**
-     * Print &lt;EM&gt; tag. Add a newline character at the end.
-     */
-    public void em() {
-        println("<EM>");
-    }
-
-    /**
-     * Print &lt;/EM&gt; tag. Add a newline character at the end.
-     */
-    public void emEnd() {
-        println("</EM>");
-    }
-
-    /**
-     * Print HTML &lt;TABLE BORDER="border" WIDTH="width"
-     * CELLPADDING="cellpadding" CELLSPACING="cellspacing"&gt; tag.
-     *
-     * @param border       Border size.
-     * @param width        Width of the table.
-     * @param cellpadding  Cellpadding for the table cells.
-     * @param cellspacing  Cellspacing for the table cells.
-     */
-    public void table(int border, String width, int cellpadding,
-                      int cellspacing) {
-        println(DocletConstants.NL +
-                "<TABLE BORDER=\"" + border +
-                "\" WIDTH=\"" + width +
-                "\" CELLPADDING=\"" + cellpadding +
-                "\" CELLSPACING=\"" + cellspacing +
-                "\" SUMMARY=\"\">");
-    }
-
-    /**
-     * Print HTML &lt;TABLE BORDER="border" WIDTH="width"
-     * CELLPADDING="cellpadding" CELLSPACING="cellspacing" SUMMARY="summary"&gt; tag.
-     *
-     * @param border       Border size.
-     * @param width        Width of the table.
-     * @param cellpadding  Cellpadding for the table cells.
-     * @param cellspacing  Cellspacing for the table cells.
-     * @param summary      Table summary.
-     */
-    public void table(int border, String width, int cellpadding,
-                      int cellspacing, String summary) {
-        println(DocletConstants.NL +
-                "<TABLE BORDER=\"" + border +
-                "\" WIDTH=\"" + width +
-                "\" CELLPADDING=\"" + cellpadding +
-                "\" CELLSPACING=\"" + cellspacing +
-                "\" SUMMARY=\"" + summary + "\">");
-    }
-
-    /**
-     * Print HTML &lt;TABLE BORDER="border" CELLPADDING="cellpadding"
-     * CELLSPACING="cellspacing"&gt; tag.
-     *
-     * @param border       Border size.
-     * @param cellpadding  Cellpadding for the table cells.
-     * @param cellspacing  Cellspacing for the table cells.
-     */
-    public void table(int border, int cellpadding, int cellspacing) {
-        println(DocletConstants.NL +
-                "<TABLE BORDER=\"" + border +
-                "\" CELLPADDING=\"" + cellpadding +
-                "\" CELLSPACING=\"" + cellspacing +
-                "\" SUMMARY=\"\">");
-    }
-
-    /**
-     * Print HTML &lt;TABLE BORDER="border" CELLPADDING="cellpadding"
-     * CELLSPACING="cellspacing" SUMMARY="summary"&gt; tag.
-     *
-     * @param border       Border size.
-     * @param cellpadding  Cellpadding for the table cells.
-     * @param cellspacing  Cellspacing for the table cells.
-     * @param summary      Table summary.
-     */
-    public void table(int border, int cellpadding, int cellspacing, String summary) {
-        println(DocletConstants.NL +
-                "<TABLE BORDER=\"" + border +
-                "\" CELLPADDING=\"" + cellpadding +
-                "\" CELLSPACING=\"" + cellspacing +
-                "\" SUMMARY=\"" + summary + "\">");
-    }
-
-    /**
-     * Print HTML &lt;TABLE BORDER="border" WIDTH="width"&gt;
-     *
-     * @param border       Border size.
-     * @param width        Width of the table.
-     */
-    public void table(int border, String width) {
-        println(DocletConstants.NL +
-                "<TABLE BORDER=\"" + border +
-                "\" WIDTH=\"" + width +
-                "\" SUMMARY=\"\">");
-    }
-
-    /**
-     * Print the HTML table tag with border size 0 and width 100%.
-     */
-    public void table() {
-        table(0, "100%");
-    }
-
-    /**
-     * Print &lt;/TABLE&gt; tag. Add a newline character at the end.
-     */
-    public void tableEnd() {
-        println("</TABLE>");
-    }
-
-    /**
-     * Print &lt;TR&gt; tag. Add a newline character at the end.
-     */
-    public void tr() {
-        println("<TR>");
-    }
-
-    /**
-     * Print &lt;/TR&gt; tag. Add a newline character at the end.
-     */
-    public void trEnd() {
-        println("</TR>");
-    }
-
-    /**
-     * Print &lt;TD&gt; tag.
-     */
-    public void td() {
-        print("<TD>");
-    }
-
-    /**
-     * Print &lt;TD NOWRAP&gt; tag.
-     */
-    public void tdNowrap() {
-        print("<TD NOWRAP>");
-    }
-
-    /**
-     * Print &lt;TD WIDTH="width"&gt; tag.
-     *
-     * @param width String width.
-     */
-    public void tdWidth(String width) {
-        print("<TD WIDTH=\"" + width + "\">");
-    }
-
-    /**
-     * Print &lt;/TD&gt; tag. Add a newline character at the end.
-     */
-    public void tdEnd() {
-        println("</TD>");
-    }
-
-    /**
-     * Print &lt;LINK str&gt; tag.
-     *
-     * @param str String.
-     */
-    public void link(String str) {
-        println("<LINK " + str + ">");
-    }
-
-    /**
-     * Print "&lt;!-- " comment start string.
-     */
-    public void commentStart() {
-         print("<!-- ");
-    }
-
-    /**
-     * Print "--&gt;" comment end string. Add a newline character at the end.
-     */
-    public void commentEnd() {
-         println("-->");
-    }
-
-    /**
-     * Print &lt;CAPTION CLASS="stylename"&gt; tag. Adds a newline character
-     * at the end.
-     *
-     * @param stylename style to be applied.
-     */
-    public void captionStyle(String stylename) {
-        println("<CAPTION CLASS=\"" + stylename + "\">");
-    }
-
-    /**
-     * Print &lt;/CAPTION&gt; tag. Add a newline character at the end.
-     */
-    public void captionEnd() {
-        println("</CAPTION>");
-    }
-
-    /**
-     * Print &lt;TR BGCOLOR="color" CLASS="stylename"&gt; tag. Adds a newline character
-     * at the end.
-     *
-     * @param color String color.
-     * @param stylename String stylename.
-     */
-    public void trBgcolorStyle(String color, String stylename) {
-        println("<TR BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
-    }
-
-    /**
-     * Print &lt;TR BGCOLOR="color"&gt; tag. Adds a newline character at the end.
-     *
-     * @param color String color.
-     */
-    public void trBgcolor(String color) {
-        println("<TR BGCOLOR=\"" + color + "\">");
-    }
-
-    /**
-     * Print &lt;TR ALIGN="align" VALIGN="valign"&gt; tag. Adds a newline character
-     * at the end.
-     *
-     * @param align String align.
-     * @param valign String valign.
-     */
-    public void trAlignVAlign(String align, String valign) {
-        println("<TR ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
-    }
-
-    /**
-     * Print &lt;TH ALIGN="align"&gt; tag.
-     *
-     * @param align the align attribute.
-     */
-    public void thAlign(String align) {
-        print("<TH ALIGN=\"" + align + "\">");
-    }
-
-    /**
-     * Print &lt;TH CLASS="stylename" SCOPE="scope" NOWRAP&gt; tag.
-     *
-     * @param stylename style to be applied.
-     * @param scope the scope attribute.
-     */
-    public void thScopeNoWrap(String stylename, String scope) {
-        print("<TH CLASS=\"" + stylename + "\" SCOPE=\"" + scope + "\" NOWRAP>");
-    }
-
     /*
      * Returns a header for Modifier and Type column of a table.
      */
     public String getModifierTypeHeader() {
         return modifierTypeHeader;
     }
-
-    /**
-     * Print &lt;TH align="align" COLSPAN=i&gt; tag.
-     *
-     * @param align the align attribute.
-     * @param i integer.
-     */
-    public void thAlignColspan(String align, int i) {
-        print("<TH ALIGN=\"" + align + "\" COLSPAN=\"" + i + "\">");
-    }
-
-    /**
-     * Print &lt;TH align="align" NOWRAP&gt; tag.
-     *
-     * @param align the align attribute.
-     */
-    public void thAlignNowrap(String align) {
-        print("<TH ALIGN=\"" + align + "\" NOWRAP>");
-    }
-
-    /**
-     * Print &lt;/TH&gt; tag. Add a newline character at the end.
-     */
-    public void thEnd() {
-        println("</TH>");
-    }
-
-    /**
-     * Print &lt;TD COLSPAN=i&gt; tag.
-     *
-     * @param i integer.
-     */
-    public void tdColspan(int i) {
-        print("<TD COLSPAN=" + i + ">");
-    }
-
-    /**
-     * Print &lt;TD BGCOLOR="color" CLASS="stylename"&gt; tag.
-     *
-     * @param color String color.
-     * @param stylename String stylename.
-     */
-    public void tdBgcolorStyle(String color, String stylename) {
-        print("<TD BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
-    }
-
-    /**
-     * Print &lt;TD COLSPAN=i BGCOLOR="color" CLASS="stylename"&gt; tag.
-     *
-     * @param i integer.
-     * @param color String color.
-     * @param stylename String stylename.
-     */
-    public void tdColspanBgcolorStyle(int i, String color, String stylename) {
-        print("<TD COLSPAN=" + i + " BGCOLOR=\"" + color + "\" CLASS=\"" +
-              stylename + "\">");
-    }
-
-    /**
-     * Print &lt;TD ALIGN="align"&gt; tag. Adds a newline character
-     * at the end.
-     *
-     * @param align String align.
-     */
-    public void tdAlign(String align) {
-        print("<TD ALIGN=\"" + align + "\">");
-    }
-
-    /**
-     * Print &lt;TD ALIGN="align" CLASS="stylename"&gt; tag.
-     *
-     * @param align        String align.
-     * @param stylename    String stylename.
-     */
-    public void tdVAlignClass(String align, String stylename) {
-        print("<TD VALIGN=\"" + align + "\" CLASS=\"" + stylename + "\">");
-    }
-
-    /**
-     * Print &lt;TD VALIGN="valign"&gt; tag.
-     *
-     * @param valign String valign.
-     */
-    public void tdVAlign(String valign) {
-        print("<TD VALIGN=\"" + valign + "\">");
-    }
-
-    /**
-     * Print &lt;TD ALIGN="align" VALIGN="valign"&gt; tag.
-     *
-     * @param align   String align.
-     * @param valign  String valign.
-     */
-    public void tdAlignVAlign(String align, String valign) {
-        print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
-    }
-
-    /**
-     * Print &lt;TD ALIGN="align" ROWSPAN=rowspan&gt; tag.
-     *
-     * @param align    String align.
-     * @param rowspan  integer rowspan.
-     */
-    public void tdAlignRowspan(String align, int rowspan) {
-        print("<TD ALIGN=\"" + align + "\" ROWSPAN=" + rowspan + ">");
-    }
-
-    /**
-     * Print &lt;TD ALIGN="align" VALIGN="valign" ROWSPAN=rowspan&gt; tag.
-     *
-     * @param align    String align.
-     * @param valign  String valign.
-     * @param rowspan  integer rowspan.
-     */
-    public void tdAlignVAlignRowspan(String align, String valign,
-                                     int rowspan) {
-        print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign
-                + "\" ROWSPAN=" + rowspan + ">");
-    }
-
-    /**
-     * Print &lt;BLOCKQUOTE&gt; tag. Add a newline character at the end.
-     */
-    public void blockquote() {
-        println("<BLOCKQUOTE>");
-    }
-
-    /**
-     * Print &lt;/BLOCKQUOTE&gt; tag. Add a newline character at the end.
-     */
-    public void blockquoteEnd() {
-        println("</BLOCKQUOTE>");
-    }
-
-    /**
-     * Get the "&lt;code&gt;" string.
-     *
-     * @return String Return String "&lt;code&gt;";
-     */
-    public String getCode() {
-        return "<code>";
-    }
-
-    /**
-     * Get the "&lt;/code&gt;" string.
-     *
-     * @return String Return String "&lt;/code&gt;";
-     */
-    public String getCodeEnd() {
-        return "</code>";
-    }
-
-    /**
-     * Print &lt;NOFRAMES&gt; tag. Add a newline character at the end.
-     */
-    public void noFrames() {
-        println("<NOFRAMES>");
-    }
-
-    /**
-     * Print &lt;/NOFRAMES&gt; tag. Add a newline character at the end.
-     */
-    public void noFramesEnd() {
-        println("</NOFRAMES>");
-    }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java	Sun May 21 11:12:40 2017 -0700
@@ -25,6 +25,9 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
+import java.io.IOException;
+import java.io.Writer;
+
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -57,7 +60,7 @@
      *                              is not supported.
      */
     public void addContent(Content content) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -69,7 +72,7 @@
      *                              is not supported.
      */
     public void addContent(String stringContent) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -82,7 +85,16 @@
     /**
      * {@inheritDoc}
      */
-    public void write(StringBuilder contentBuilder) {
-        contentBuilder.append(rawHtmlContent);
+    public String toString() {
+        return rawHtmlContent;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean write(Writer out, boolean atNewline) throws IOException {
+        out.write(rawHtmlContent);
+        return rawHtmlContent.endsWith(DocletConstants.NL);
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java	Sun May 21 11:12:40 2017 -0700
@@ -25,6 +25,9 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
+import java.io.IOException;
+import java.io.Writer;
+
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -63,7 +66,7 @@
      *                              is not supported.
      */
     public void addContent(Content content) {
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
     /**
@@ -93,7 +96,10 @@
     /**
      * {@inheritDoc}
      */
-    public void write(StringBuilder contentBuilder) {
-        contentBuilder.append(stringContent);
+    @Override
+    public boolean write(Writer out, boolean atNewline) throws IOException {
+        String s = stringContent.toString();
+        out.write(s);
+        return s.endsWith(DocletConstants.NL);
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,6 +81,21 @@
         }
         try {
             doclet.startGeneration(root);
+        } catch (Configuration.Fault f) {
+            root.printError(f.getMessage());
+            return false;
+        } catch (FatalError fe) {
+            return false;
+        } catch (DocletAbortException e) {
+            Throwable cause = e.getCause();
+            if (cause != null) {
+                if (cause.getLocalizedMessage() != null) {
+                    root.printError(cause.getLocalizedMessage());
+                } else {
+                    root.printError(cause.toString());
+                }
+            }
+            return false;
         } catch (Exception exc) {
             exc.printStackTrace();
             return false;
@@ -111,7 +126,7 @@
      *
      * @see com.sun.javadoc.RootDoc
      */
-    private void startGeneration(RootDoc root) throws Exception {
+    private void startGeneration(RootDoc root) throws Configuration.Fault, Exception {
         if (root.classes().length == 0) {
             configuration.message.
                 error("doclet.No_Public_Classes_To_Document");
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -152,7 +152,7 @@
      *
      * @param contentTree content tree that will be printed as a document
      */
-    public void printDocument(Content contentTree);
+    public void printDocument(Content contentTree) throws IOException;
 
     /**
      * Close the writer.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -179,7 +179,7 @@
      *
      * @param contentTree content tree that will be printed as a document
      */
-    public void printDocument(Content contentTree);
+    public void printDocument(Content contentTree) throws IOException;
 
     /**
      * Close the writer.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Sun May 21 11:12:40 2017 -0700
@@ -49,6 +49,21 @@
 public abstract class Configuration {
 
     /**
+     * Exception used to report a problem during setOptions.
+     */
+    public class Fault extends Exception {
+        private static final long serialVersionUID = 0;
+
+        Fault(String msg) {
+            super(msg);
+        }
+
+        Fault(String msg, Exception cause) {
+            super(msg, cause);
+        }
+    }
+
+    /**
      * The factory for builders.
      */
     protected BuilderFactory builderFactory;
@@ -246,7 +261,7 @@
      * @param options The array of option names and values.
      * @throws DocletAbortException
      */
-    public abstract void setSpecificDocletOptions(String[][] options);
+    public abstract void setSpecificDocletOptions(String[][] options) throws Fault;
 
     /**
      * Return the doclet specific {@link MessageRetriever}
@@ -356,15 +371,26 @@
      *
      * @param options the two dimensional array of options.
      */
-    public void setOptions(String[][] options) {
+    public void setOptions(String[][] options) throws Fault {
         LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<String[]>();
+
+        // Some options, specifically -link and -linkoffline, require that
+        // the output directory has already been created: so do that first.
         for (int oi = 0; oi < options.length; ++oi) {
             String[] os = options[oi];
             String opt = os[0].toLowerCase();
             if (opt.equals("-d")) {
                 destDirName = addTrailingFileSep(os[1]);
                 docFileDestDirName = destDirName;
-            } else if (opt.equals("-docfilessubdirs")) {
+                ensureOutputDirExists();
+                break;
+            }
+        }
+
+        for (int oi = 0; oi < options.length; ++oi) {
+            String[] os = options[oi];
+            String opt = os[0].toLowerCase();
+            if (opt.equals("-docfilessubdirs")) {
                 copydocfilesubdirs = true;
             } else if (opt.equals("-docencoding")) {
                 docencoding = os[1];
@@ -442,12 +468,29 @@
      *
      * @throws DocletAbortException
      */
-    public void setOptions() {
+    public void setOptions() throws Fault {
         initPackageArray();
         setOptions(root.options());
         setSpecificDocletOptions(root.options());
     }
 
+    private void ensureOutputDirExists() throws Fault {
+        File destDir = new File(destDirName);
+        if (!destDir.exists()) {
+            //Create the output directory (in case it doesn't exist yet)
+            root.printNotice(getText("doclet.dest_dir_create", destDirName));
+            destDir.mkdirs();
+        } else if (!destDir.isDirectory()) {
+            throw new Fault(getText(
+                "doclet.destination_directory_not_directory_0",
+                destDir.getPath()));
+        } else if (!destDir.canWrite()) {
+            throw new Fault(getText(
+                "doclet.destination_directory_not_writable_0",
+                destDir.getPath()));
+        }
+    }
+
 
     /**
      * Initialize the taglet manager.  The strings to initialize the simple custom tags should
@@ -539,26 +582,7 @@
         for (int oi = 0; oi < options.length; oi++) {
             String[] os = options[oi];
             String opt = os[0].toLowerCase();
-            if (opt.equals("-d")) {
-                String destdirname = addTrailingFileSep(os[1]);
-                File destDir = new File(destdirname);
-                if (!destDir.exists()) {
-                    //Create the output directory (in case it doesn't exist yet)
-                    reporter.printNotice(getText("doclet.dest_dir_create",
-                        destdirname));
-                    (new File(destdirname)).mkdirs();
-                } else if (!destDir.isDirectory()) {
-                    reporter.printError(getText(
-                        "doclet.destination_directory_not_directory_0",
-                        destDir.getPath()));
-                    return false;
-                } else if (!destDir.canWrite()) {
-                    reporter.printError(getText(
-                        "doclet.destination_directory_not_writable_0",
-                        destDir.getPath()));
-                    return false;
-                }
-            } else if (opt.equals("-docencoding")) {
+            if (opt.equals("-docencoding")) {
                 docencodingfound = true;
                 if (!checkOutputFileEncoding(os[1], reporter)) {
                     return false;
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -137,6 +137,6 @@
      *
      * @param contentTree content tree which should be printed
      */
-    public abstract void printDocument(Content contentTree);
+    public abstract void printDocument(Content contentTree) throws IOException;
 
 }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Sun May 21 11:12:40 2017 -0700
@@ -25,6 +25,10 @@
 
 package com.sun.tools.doclets.internal.toolkit;
 
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
@@ -39,10 +43,16 @@
      *
      * @return string representation of the content
      */
+    @Override
     public String toString() {
-        StringBuilder contentBuilder = new StringBuilder();
-        write(contentBuilder);
-        return contentBuilder.toString();
+        StringWriter out = new StringWriter();
+        try {
+            write(out, true);
+        } catch (IOException e) {
+            // cannot happen from StringWriter
+            throw new DocletAbortException(e);
+        }
+        return out.toString();
     }
 
     /**
@@ -60,10 +70,10 @@
     public abstract void addContent(String stringContent);
 
     /**
-     * Writes content to a StringBuilder.
+     * Writes content to a writer.
      *
      */
-    public abstract void write(StringBuilder contentBuilder);
+    public abstract boolean write(Writer writer, boolean atNewline) throws IOException ;
 
     /**
      * Returns true if the content is empty.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -113,7 +113,7 @@
      *
      * @param contentTree the content tree that will be printed
      */
-    public abstract void printDocument(Content contentTree);
+    public abstract void printDocument(Content contentTree) throws IOException;
 
     /**
      * Close the writer.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -150,7 +150,7 @@
      *
      * @param serializedTree the content tree that will be printed
      */
-    public abstract void printDocument(Content serializedTree);
+    public abstract void printDocument(Content serializedTree) throws IOException;
 
     /**
      * Write the serialized form for a given field.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,15 +106,22 @@
         } catch (NoSuchMethodException e) {
             e.printStackTrace();
             configuration.root.printError("Unknown element: " + component);
-            throw new DocletAbortException();
+            throw new DocletAbortException(e);
         } catch (InvocationTargetException e) {
-            e.getCause().printStackTrace();
+            Throwable cause = e.getCause();
+            if (cause instanceof FatalError) {
+                throw (FatalError) cause;
+            } else if (cause instanceof DocletAbortException) {
+                throw (DocletAbortException) cause;
+            } else {
+                throw new DocletAbortException(cause);
+            }
         } catch (Exception e) {
             e.printStackTrace();
             configuration.root.printError("Exception " +
                     e.getClass().getName() +
                     " thrown while processing element: " + component);
-            throw new DocletAbortException();
+            throw new DocletAbortException(e);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@
      */
     public void build() throws DocletAbortException {
         //You may not call the build method in a subbuilder.
-        throw new DocletAbortException();
+        throw new DocletAbortException("not supported");
     }
 
 
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
             return xmlElementsMap.get(root);
         } catch (Throwable t) {
             t.printStackTrace();
-            throw new DocletAbortException();
+            throw new DocletAbortException(t);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
                 return;
             }
         } catch (Exception e) {
-            throw new DocletAbortException();
+            throw new DocletAbortException(e);
         }
         build(LayoutParser.getInstance(configuration).parseXML(NAME), contentTree);
         writer.close();
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Sun May 21 11:12:40 2017 -0700
@@ -30,6 +30,8 @@
 doclet.Building_Tree=Building tree for all the packages and classes...
 doclet.Building_Index=Building index for all the packages and classes...
 doclet.Building_Index_For_All_Classes=Building index for all classes...
+doclet.JavaScript_in_option=Argument for {0} contains JavaScript.\n\
+Use --allow-script-in-comments to allow use of JavaScript.
 doclet.sourcetab_warning=The argument for -sourcetab must be an integer greater than 0.
 doclet.Packages=Packages
 doclet.Other_Packages=Other Packages
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties	Sun May 21 11:12:40 2017 -0700
@@ -28,6 +28,7 @@
 doclet.Building_Tree=\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u3068\u30AF\u30E9\u30B9\u306E\u968E\u5C64\u30C4\u30EA\u30FC\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
 doclet.Building_Index=\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u3068\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
 doclet.Building_Index_For_All_Classes=\u5168\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
+doclet.JavaScript_in_option={0}\u306E\u5F15\u6570\u306BJavaScript\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\n--allow-script-in-comments\u3092\u4F7F\u7528\u3057\u3066\u3001JavaScript\u306E\u4F7F\u7528\u3092\u8A31\u53EF\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 doclet.sourcetab_warning=-sourcetab\u306E\u5F15\u6570\u306F0\u3088\u308A\u5927\u304D\u3044\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
 doclet.Packages=\u30D1\u30C3\u30B1\u30FC\u30B8
 doclet.Other_Packages=\u305D\u306E\u4ED6\u306E\u30D1\u30C3\u30B1\u30FC\u30B8
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties	Sun May 21 11:12:40 2017 -0700
@@ -28,6 +28,7 @@
 doclet.Building_Tree=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7A0B\u5E8F\u5305\u548C\u7C7B\u7684\u6811...
 doclet.Building_Index=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7A0B\u5E8F\u5305\u548C\u7C7B\u7684\u7D22\u5F15...
 doclet.Building_Index_For_All_Classes=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7C7B\u7684\u7D22\u5F15...
+doclet.JavaScript_in_option={0} \u7684\u53C2\u6570\u5305\u542B JavaScript\u3002\n\u4F7F\u7528 --allow-script-in-comments \u53EF\u5141\u8BB8\u4F7F\u7528 JavaScript\u3002
 doclet.sourcetab_warning=-sourcetab \u7684\u53C2\u6570\u5FC5\u987B\u662F\u5927\u4E8E 0 \u7684\u6574\u6570\u3002
 doclet.Packages=\u7A0B\u5E8F\u5305
 doclet.Other_Packages=\u5176\u4ED6\u7A0B\u5E8F\u5305
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Sun May 21 11:12:40 2017 -0700
@@ -123,7 +123,7 @@
                 return (FieldDoc) tag.holder();
             } else {
                 //This should never ever happen.
-                throw new DocletAbortException();
+                throw new DocletAbortException("should not happen");
             }
         }
         StringTokenizer st = new StringTokenizer(name, "#");
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -450,7 +450,7 @@
         } else if (doc instanceof Parameter) {
             annotations = ((Parameter) doc).annotations();
         } else {
-            throw new DocletAbortException();
+            throw new DocletAbortException("should not happen");
         }
         for (int i = 0; i < annotations.length; i++) {
             AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java	Sun May 21 11:12:40 2017 -0700
@@ -278,7 +278,7 @@
             } else {
                 configuration.message.error(
                        "doclet.Unable_to_create_directory_0", path);
-                throw new DocletAbortException();
+                throw new DocletAbortException("Unable to create directory");
             }
         }
     }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,11 @@
 public class DocletAbortException extends RuntimeException {
     private static final long serialVersionUID = -9131058909576418984L;
 
-    public DocletAbortException() {
+    public DocletAbortException(String message) {
+        super(message);
+    }
+
+    public DocletAbortException(Throwable cause) {
+        super(cause);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/FatalError.java	Sun May 21 11:12:40 2017 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.internal.toolkit.util;
+
+/**
+ *  <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>
+ */
+@Deprecated
+public class FatalError extends Error {
+    private static final long serialVersionUID = -9131058909576418984L;
+
+    public FatalError() { }
+}
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,7 @@
         } catch (IOException exc) {
             configuration.message.error("doclet.exception_encountered",
                 exc.toString(), DocletConstants.PACKAGE_LIST_FILE_NAME);
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Sun May 21 11:12:40 2017 -0700
@@ -281,9 +281,9 @@
                 }
             }
         } catch (SecurityException exc) {
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         } catch (IOException exc) {
-            throw new DocletAbortException();
+            throw new DocletAbortException(exc);
         }
     }
 
@@ -396,7 +396,7 @@
             }
         } catch (IOException ie) {
             ie.printStackTrace(System.err);
-            throw new DocletAbortException();
+            throw new DocletAbortException(ie);
         }
     }
 
@@ -646,18 +646,51 @@
             String path, String filename,
             String docencoding)
         throws IOException, UnsupportedEncodingException {
-        FileOutputStream fos;
+        return genWriter(genWriterFile(configuration, path, filename), docencoding);
+    }
+
+    /**
+     * Create the directory path for the file to be generated.
+     *
+     * @param path The directory path to be created for this file.
+     * @param filename File Name to which the PrintWriter will do the Output.
+     * @exception IOException Exception raised by the FileWriter is passed on
+     * to next level.
+     * @exception UnsupportedEncodingException Exception raised by the
+     * OutputStreamWriter is passed on to next level.
+     * @return the file getting generated.
+     */
+    public static File genWriterFile(Configuration configuration,
+                                     String path, String filename) {
         if (path != null) {
             DirectoryManager.createDirectory(configuration, path);
-            fos = new FileOutputStream(((path.length() > 0)?
-                                                  path + File.separator: "") + filename);
+            return new File(((path.length() > 0)? path + File.separator: "") + filename);
         } else {
-            fos = new FileOutputStream(filename);
+            return new File(filename);
         }
+    }
+
+    /**
+     * Constructs FileOutputStream and OutputStreamWriter,
+     * depending upon docencoding.
+     *
+     * @param file file to which the PrintWriter will do the Output.
+     * @param docencoding Encoding to be used for this file.
+     * @exception IOException Exception raised by the FileWriter is passed on
+     * to next level.
+     * @exception UnsupportedEncodingException Exception raised by the
+     * OutputStreamWriter is passed on to next level.
+     * @return Writer Writer for the file getting generated.
+     * @see java.io.FileOutputStream
+     * @see java.io.OutputStreamWriter
+     */
+    public static Writer genWriter(File file, String docencoding)
+        throws IOException, UnsupportedEncodingException {
+        FileOutputStream fos = new FileOutputStream(file);
         if (docencoding == null) {
-            return new OutputStreamWriter(fos);
+            return new BufferedWriter(new OutputStreamWriter(fos));
         } else {
-            return new OutputStreamWriter(fos, docencoding);
+            return new BufferedWriter(new OutputStreamWriter(fos, docencoding));
         }
     }
 
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -434,7 +434,7 @@
     /**
      * Ident = IDENTIFIER
      */
-    Name ident() {
+    public Name ident() {
         if (S.token() == IDENTIFIER) {
             Name name = S.name();
             S.nextToken();
--- a/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
 javac.opt.classpath=\u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304A\u3088\u3073\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.sourcepath=\u5165\u529B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.bootclasspath=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
-javac.opt.Xbootclasspath.p=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u4ED8\u52A0\u3059\u308B
+javac.opt.Xbootclasspath.p=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u5148\u982D\u306B\u4ED8\u52A0\u3059\u308B
 javac.opt.Xbootclasspath.a=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u8FFD\u52A0\u3059\u308B
 javac.opt.endorseddirs=\u63A8\u5968\u898F\u683C\u30D1\u30B9\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
 javac.opt.extdirs=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u6E08\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
@@ -115,7 +115,7 @@
 
 javac.msg.usage.nonstandard.footer=\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002
 
-javac.msg.bug=\u30B3\u30F3\u30D1\u30A4\u30E9\u3067\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002Bug Parade\u3067\u91CD\u8907\u304C\u306A\u3044\u304B\u3092\u3054\u78BA\u8A8D\u306E\u3046\u3048\u3001Java Developer Connection (http://java.sun.com/webapps/bugreport)\u3067bug\u306E\u767B\u9332\u3092\u304A\u9858\u3044\u3044\u305F\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306B\u306F\u3001\u305D\u306E\u30D7\u30ED\u30B0\u30E9\u30E0\u3068\u4E0B\u8A18\u306E\u8A3A\u65AD\u5185\u5BB9\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u3054\u5354\u529B\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\u3002
+javac.msg.bug=\u30B3\u30F3\u30D1\u30A4\u30E9\u3067\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002Bug Database (http://bugs.java.com)\u3067\u91CD\u8907\u304C\u306A\u3044\u304B\u3092\u3054\u78BA\u8A8D\u306E\u3046\u3048\u3001Java bug\u30EC\u30DD\u30FC\u30C8\u30FB\u30DA\u30FC\u30B8(http://bugreport.java.com)\u3067Java\u30B3\u30F3\u30D1\u30A4\u30E9\u306B\u5BFE\u3059\u308Bbug\u306E\u767B\u9332\u3092\u304A\u9858\u3044\u3044\u305F\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306B\u306F\u3001\u305D\u306E\u30D7\u30ED\u30B0\u30E9\u30E0\u3068\u4E0B\u8A18\u306E\u8A3A\u65AD\u5185\u5BB9\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u3054\u5354\u529B\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\u3002
 
 javac.msg.io=\n\n\u5165\u51FA\u529B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
 
--- a/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -115,7 +115,7 @@
 
 javac.msg.usage.nonstandard.footer=\u8FD9\u4E9B\u9009\u9879\u90FD\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002
 
-javac.msg.bug=\u7F16\u8BD1\u5668 ({0}) \u4E2D\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\u3002 \u5982\u679C\u5728 Bug Parade \u4E2D\u6CA1\u6709\u627E\u5230\u8BE5\u9519\u8BEF, \u8BF7\u5728 Java Developer Connection (http://java.sun.com/webapps/bugreport) \u4E2D\u5EFA\u7ACB Bug\u3002\u8BF7\u5728\u62A5\u544A\u4E2D\u9644\u4E0A\u60A8\u7684\u7A0B\u5E8F\u548C\u4EE5\u4E0B\u8BCA\u65AD\u4FE1\u606F\u3002\u8C22\u8C22\u3002
+javac.msg.bug=\u7F16\u8BD1\u5668 ({0}) \u4E2D\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\u3002\u5982\u679C\u5728 Bug Database (http://bugs.java.com) \u4E2D\u6CA1\u6709\u627E\u5230\u8BE5\u9519\u8BEF, \u8BF7\u901A\u8FC7 Java Bug \u62A5\u544A\u9875 (http://bugreport.java.com) \u5EFA\u7ACB\u8BE5 Java \u7F16\u8BD1\u5668 Bug\u3002\u8BF7\u5728\u62A5\u544A\u4E2D\u9644\u4E0A\u60A8\u7684\u7A0B\u5E8F\u548C\u4EE5\u4E0B\u8BCA\u65AD\u4FE1\u606F\u3002\u8C22\u8C22\u3002
 
 javac.msg.io=\n\n\u53D1\u751F\u8F93\u5165/\u8F93\u51FA\u9519\u8BEF\u3002\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605\u4EE5\u4E0B\u5806\u6808\u8DDF\u8E2A\u3002\n
 
--- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
     JavadocEnter enter;
 
     /** The name table. */
-    Names names;
+    private final Names names;
 
     /** The encoding name. */
     private String encoding;
@@ -97,6 +97,7 @@
     Check chk;
     Types types;
     JavaFileManager fileManager;
+    JavaScriptScanner javaScriptScanner;
 
     /** Allow documenting from class files? */
     boolean docClasses = false;
@@ -767,4 +768,14 @@
             result |= Modifier.VOLATILE;
         return result;
     }
+
+    JavaScriptScanner initJavaScriptScanner(boolean allowScriptInComments) {
+        if (allowScriptInComments) {
+            javaScriptScanner = null;
+        } else {
+            javaScriptScanner = new JavaScriptScanner();
+        }
+        return javaScriptScanner;
+    }
+
 }
--- a/src/share/classes/com/sun/tools/javadoc/DocImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/DocImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 import javax.tools.FileObject;
 
 import com.sun.javadoc.*;
-
+import com.sun.tools.doclets.internal.toolkit.util.FatalError;
 import com.sun.tools.javac.util.Position;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -102,7 +102,17 @@
      */
     Comment comment() {
         if (comment == null) {
-            comment = new Comment(this, documentation());
+            String d = documentation();
+            if (env.javaScriptScanner != null) {
+                env.javaScriptScanner.parse(d, new JavaScriptScanner.Reporter() {
+                    @Override
+                    public void report() {
+                        env.error(DocImpl.this, "javadoc.JavaScript_in_comment");
+                        throw new FatalError();
+                    }
+                });
+            }
+            comment = new Comment(this, d);
         }
         return comment;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javadoc/JavaScriptScanner.java	Sun May 21 11:12:40 2017 -0700
@@ -0,0 +1,1103 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javadoc;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import com.sun.tools.javadoc.JavaScriptScanner.TagParser.Kind;
+
+import static com.sun.tools.javac.util.LayoutCharacters.EOI;
+
+/**
+ * Parser to detect use of JavaScript in documentation comments.
+ */
+@Deprecated
+public class JavaScriptScanner {
+    public static interface Reporter {
+        void report();
+    }
+
+    static class ParseException extends Exception {
+        private static final long serialVersionUID = 0;
+        ParseException(String key) {
+            super(key);
+        }
+    }
+
+    private Reporter reporter;
+
+    /** The input buffer, index of most recent character read,
+     *  index of one past last character in buffer.
+     */
+    protected char[] buf;
+    protected int bp;
+    protected int buflen;
+
+    /** The current character.
+     */
+    protected char ch;
+
+    private boolean newline = true;
+
+    Map<String, TagParser> tagParsers;
+    Set<String> eventAttrs;
+    Set<String> uriAttrs;
+
+    public JavaScriptScanner() {
+        initTagParsers();
+        initEventAttrs();
+        initURIAttrs();
+    }
+
+    public void parse(String comment, Reporter r) {
+        reporter = r;
+        String c = comment;
+        buf = new char[c.length() + 1];
+        c.getChars(0, c.length(), buf, 0);
+        buf[buf.length - 1] = EOI;
+        buflen = buf.length - 1;
+        bp = -1;
+        newline = true;
+        nextChar();
+
+        blockContent();
+        blockTags();
+    }
+
+    private void checkHtmlTag(String tag) {
+        if (tag.equalsIgnoreCase("script")) {
+            reporter.report();
+        }
+    }
+
+    private void checkHtmlAttr(String name, String value) {
+        String n = name.toLowerCase(Locale.ENGLISH);
+        if (eventAttrs.contains(n)
+                || uriAttrs.contains(n)
+                    && value != null && value.toLowerCase(Locale.ENGLISH).trim().startsWith("javascript:")) {
+            reporter.report();
+        }
+    }
+
+    void nextChar() {
+        ch = buf[bp < buflen ? ++bp : buflen];
+        switch (ch) {
+            case '\f': case '\n': case '\r':
+                newline = true;
+        }
+    }
+
+    /**
+     * Read block content, consisting of text, html and inline tags.
+     * Terminated by the end of input, or the beginning of the next block tag:
+     * i.e. @ as the first non-whitespace character on a line.
+     */
+    @SuppressWarnings("fallthrough")
+    protected void blockContent() {
+
+        loop:
+        while (bp < buflen) {
+            switch (ch) {
+                case '\n': case '\r': case '\f':
+                    newline = true;
+                    // fallthrough
+
+                case ' ': case '\t':
+                    nextChar();
+                    break;
+
+                case '&':
+                    entity(null);
+                    break;
+
+                case '<':
+                    html();
+                    break;
+
+                case '>':
+                    newline = false;
+                    nextChar();
+                    break;
+
+                case '{':
+                    inlineTag(null);
+                    break;
+
+                case '@':
+                    if (newline) {
+                        break loop;
+                    }
+                    // fallthrough
+
+                default:
+                    newline = false;
+                    nextChar();
+            }
+        }
+    }
+
+    /**
+     * Read a series of block tags, including their content.
+     * Standard tags parse their content appropriately.
+     * Non-standard tags are represented by {@link UnknownBlockTag}.
+     */
+    protected void blockTags() {
+        while (ch == '@')
+            blockTag();
+    }
+
+    /**
+     * Read a single block tag, including its content.
+     * Standard tags parse their content appropriately.
+     * Non-standard tags are represented by {@link UnknownBlockTag}.
+     */
+    protected void blockTag() {
+        int p = bp;
+        try {
+            nextChar();
+            if (isIdentifierStart(ch)) {
+                String name = readTagName();
+                TagParser tp = tagParsers.get(name);
+                if (tp == null) {
+                    blockContent();
+                } else {
+                    switch (tp.getKind()) {
+                        case BLOCK:
+                            tp.parse(p);
+                            return;
+                        case INLINE:
+                            return;
+                    }
+                }
+            }
+            blockContent();
+        } catch (ParseException e) {
+            blockContent();
+        }
+    }
+
+    protected void inlineTag(Void list) {
+        newline = false;
+        nextChar();
+        if (ch == '@') {
+            inlineTag();
+        }
+    }
+
+    /**
+     * Read a single inline tag, including its content.
+     * Standard tags parse their content appropriately.
+     * Non-standard tags are represented by {@link UnknownBlockTag}.
+     * Malformed tags may be returned as {@link Erroneous}.
+     */
+    protected void inlineTag() {
+        int p = bp - 1;
+        try {
+            nextChar();
+            if (isIdentifierStart(ch)) {
+                String name = readTagName();
+                TagParser tp = tagParsers.get(name);
+
+                if (tp == null) {
+                    skipWhitespace();
+                    inlineText(WhitespaceRetentionPolicy.REMOVE_ALL);
+                    nextChar();
+                } else {
+                    skipWhitespace();
+                    if (tp.getKind() == TagParser.Kind.INLINE) {
+                        tp.parse(p);
+                    } else { // handle block tags (ex: @see) in inline content
+                        inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip content
+                        nextChar();
+                    }
+                }
+            }
+        } catch (ParseException e) {
+        }
+    }
+
+    private static enum WhitespaceRetentionPolicy {
+        RETAIN_ALL,
+        REMOVE_FIRST_SPACE,
+        REMOVE_ALL
+    }
+
+    /**
+     * Read plain text content of an inline tag.
+     * Matching pairs of { } are skipped; the text is terminated by the first
+     * unmatched }. It is an error if the beginning of the next tag is detected.
+     */
+    private void inlineText(WhitespaceRetentionPolicy whitespacePolicy) throws ParseException {
+        switch (whitespacePolicy) {
+            case REMOVE_ALL:
+                skipWhitespace();
+                break;
+            case REMOVE_FIRST_SPACE:
+                if (ch == ' ')
+                    nextChar();
+                break;
+            case RETAIN_ALL:
+            default:
+                // do nothing
+                break;
+
+        }
+        int pos = bp;
+        int depth = 1;
+
+        loop:
+        while (bp < buflen) {
+            switch (ch) {
+                case '\n': case '\r': case '\f':
+                    newline = true;
+                    break;
+
+                case ' ': case '\t':
+                    break;
+
+                case '{':
+                    newline = false;
+                    depth++;
+                    break;
+
+                case '}':
+                    if (--depth == 0) {
+                        return;
+                    }
+                    newline = false;
+                    break;
+
+                case '@':
+                    if (newline)
+                        break loop;
+                    newline = false;
+                    break;
+
+                default:
+                    newline = false;
+                    break;
+            }
+            nextChar();
+        }
+        throw new ParseException("dc.unterminated.inline.tag");
+    }
+
+    /**
+     * Read Java class name, possibly followed by member
+     * Matching pairs of {@literal < >} are skipped. The text is terminated by the first
+     * unmatched }. It is an error if the beginning of the next tag is detected.
+     */
+    // TODO: boolean allowMember should be enum FORBID, ALLOW, REQUIRE
+    // TODO: improve quality of parse to forbid bad constructions.
+    // TODO: update to use ReferenceParser
+    @SuppressWarnings("fallthrough")
+    protected void reference(boolean allowMember) throws ParseException {
+        int pos = bp;
+        int depth = 0;
+
+        // scan to find the end of the signature, by looking for the first
+        // whitespace not enclosed in () or <>, or the end of the tag
+        loop:
+        while (bp < buflen) {
+            switch (ch) {
+                case '\n': case '\r': case '\f':
+                    newline = true;
+                    // fallthrough
+
+                case ' ': case '\t':
+                    if (depth == 0)
+                        break loop;
+                    break;
+
+                case '(':
+                case '<':
+                    newline = false;
+                    depth++;
+                    break;
+
+                case ')':
+                case '>':
+                    newline = false;
+                    --depth;
+                    break;
+
+                case '}':
+                    if (bp == pos)
+                        return;
+                    newline = false;
+                    break loop;
+
+                case '@':
+                    if (newline)
+                        break loop;
+                    // fallthrough
+
+                default:
+                    newline = false;
+
+            }
+            nextChar();
+        }
+
+        if (depth != 0)
+            throw new ParseException("dc.unterminated.signature");
+    }
+
+    /**
+     * Read Java identifier
+     * Matching pairs of { } are skipped; the text is terminated by the first
+     * unmatched }. It is an error if the beginning of the next tag is detected.
+     */
+    @SuppressWarnings("fallthrough")
+    protected void identifier() throws ParseException {
+        skipWhitespace();
+        int pos = bp;
+
+        if (isJavaIdentifierStart(ch)) {
+            readJavaIdentifier();
+            return;
+        }
+
+        throw new ParseException("dc.identifier.expected");
+    }
+
+    /**
+     * Read a quoted string.
+     * It is an error if the beginning of the next tag is detected.
+     */
+    @SuppressWarnings("fallthrough")
+    protected void quotedString() {
+        int pos = bp;
+        nextChar();
+
+        loop:
+        while (bp < buflen) {
+            switch (ch) {
+                case '\n': case '\r': case '\f':
+                    newline = true;
+                    break;
+
+                case ' ': case '\t':
+                    break;
+
+                case '"':
+                    nextChar();
+                    // trim trailing white-space?
+                    return;
+
+                case '@':
+                    if (newline)
+                        break loop;
+
+            }
+            nextChar();
+        }
+    }
+
+    /**
+     * Read a term ie. one word.
+     * It is an error if the beginning of the next tag is detected.
+     */
+    @SuppressWarnings("fallthrough")
+    protected void inlineWord() {
+        int pos = bp;
+        int depth = 0;
+        loop:
+        while (bp < buflen) {
+            switch (ch) {
+                case '\n':
+                    newline = true;
+                    // fallthrough
+
+                case '\r': case '\f': case ' ': case '\t':
+                    return;
+
+                case '@':
+                    if (newline)
+                        break loop;
+
+                case '{':
+                    depth++;
+                    break;
+
+                case '}':
+                    if (depth == 0 || --depth == 0)
+                        return;
+                    break;
+            }
+            newline = false;
+            nextChar();
+        }
+    }
+
+    /**
+     * Read general text content of an inline tag, including HTML entities and elements.
+     * Matching pairs of { } are skipped; the text is terminated by the first
+     * unmatched }. It is an error if the beginning of the next tag is detected.
+     */
+    @SuppressWarnings("fallthrough")
+    private void inlineContent() {
+
+        skipWhitespace();
+        int pos = bp;
+        int depth = 1;
+
+        loop:
+        while (bp < buflen) {
+
+            switch (ch) {
+                case '\n': case '\r': case '\f':
+                    newline = true;
+                    // fall through
+
+                case ' ': case '\t':
+                    nextChar();
+                    break;
+
+                case '&':
+                    entity(null);
+                    break;
+
+                case '<':
+                    newline = false;
+                    html();
+                    break;
+
+                case '{':
+                    newline = false;
+                    depth++;
+                    nextChar();
+                    break;
+
+                case '}':
+                    newline = false;
+                    if (--depth == 0) {
+                        nextChar();
+                        return;
+                    }
+                    nextChar();
+                    break;
+
+                case '@':
+                    if (newline)
+                        break loop;
+                    // fallthrough
+
+                default:
+                    nextChar();
+                    break;
+            }
+        }
+
+    }
+
+    protected void entity(Void list) {
+        newline = false;
+        entity();
+    }
+
+    /**
+     * Read an HTML entity.
+     * {@literal &identifier; } or {@literal &#digits; } or {@literal &#xhex-digits; }
+     */
+    protected void entity() {
+        nextChar();
+        String name = null;
+        if (ch == '#') {
+            int namep = bp;
+            nextChar();
+            if (isDecimalDigit(ch)) {
+                nextChar();
+                while (isDecimalDigit(ch))
+                    nextChar();
+                name = new String(buf, namep, bp - namep);
+            } else if (ch == 'x' || ch == 'X') {
+                nextChar();
+                if (isHexDigit(ch)) {
+                    nextChar();
+                    while (isHexDigit(ch))
+                        nextChar();
+                    name = new String(buf, namep, bp - namep);
+                }
+            }
+        } else if (isIdentifierStart(ch)) {
+            name = readIdentifier();
+        }
+
+        if (name != null) {
+            if (ch != ';')
+                return;
+            nextChar();
+        }
+    }
+
+    /**
+     * Read the start or end of an HTML tag, or an HTML comment
+     * {@literal <identifier attrs> } or {@literal </identifier> }
+     */
+    protected void html() {
+        int p = bp;
+        nextChar();
+        if (isIdentifierStart(ch)) {
+            String name = readIdentifier();
+            checkHtmlTag(name);
+            htmlAttrs();
+            if (ch == '/') {
+                nextChar();
+            }
+            if (ch == '>') {
+                nextChar();
+                return;
+            }
+        } else if (ch == '/') {
+            nextChar();
+            if (isIdentifierStart(ch)) {
+                readIdentifier();
+                skipWhitespace();
+                if (ch == '>') {
+                    nextChar();
+                    return;
+                }
+            }
+        } else if (ch == '!') {
+            nextChar();
+            if (ch == '-') {
+                nextChar();
+                if (ch == '-') {
+                    nextChar();
+                    while (bp < buflen) {
+                        int dash = 0;
+                        while (ch == '-') {
+                            dash++;
+                            nextChar();
+                        }
+                        // Strictly speaking, a comment should not contain "--"
+                        // so dash > 2 is an error, dash == 2 implies ch == '>'
+                        // See http://www.w3.org/TR/html-markup/syntax.html#syntax-comments
+                        // for more details.
+                        if (dash >= 2 && ch == '>') {
+                            nextChar();
+                            return;
+                        }
+
+                        nextChar();
+                    }
+                }
+            }
+        }
+
+        bp = p + 1;
+        ch = buf[bp];
+    }
+
+    /**
+     * Read a series of HTML attributes, terminated by {@literal > }.
+     * Each attribute is of the form {@literal identifier[=value] }.
+     * "value" may be unquoted, single-quoted, or double-quoted.
+     */
+    protected void htmlAttrs() {
+        skipWhitespace();
+
+        loop:
+        while (isIdentifierStart(ch)) {
+            int namePos = bp;
+            String name = readAttributeName();
+            skipWhitespace();
+            StringBuilder value = new StringBuilder();
+            if (ch == '=') {
+                nextChar();
+                skipWhitespace();
+                if (ch == '\'' || ch == '"') {
+                    char quote = ch;
+                    nextChar();
+                    while (bp < buflen && ch != quote) {
+                        if (newline && ch == '@') {
+                            // No point trying to read more.
+                            // In fact, all attrs get discarded by the caller
+                            // and superseded by a malformed.html node because
+                            // the html tag itself is not terminated correctly.
+                            break loop;
+                        }
+                        value.append(ch);
+                        nextChar();
+                    }
+                    nextChar();
+                } else {
+                    while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
+                        value.append(ch);
+                        nextChar();
+                    }
+                }
+                skipWhitespace();
+            }
+            checkHtmlAttr(name, value.toString());
+        }
+    }
+
+    protected void attrValueChar(Void list) {
+        switch (ch) {
+            case '&':
+                entity(list);
+                break;
+
+            case '{':
+                inlineTag(list);
+                break;
+
+            default:
+                nextChar();
+        }
+    }
+
+    protected boolean isIdentifierStart(char ch) {
+        return Character.isUnicodeIdentifierStart(ch);
+    }
+
+    protected String readIdentifier() {
+        int start = bp;
+        nextChar();
+        while (bp < buflen && Character.isUnicodeIdentifierPart(ch))
+            nextChar();
+        return new String(buf, start, bp - start);
+    }
+
+    protected String readAttributeName() {
+        int start = bp;
+        nextChar();
+        while (bp < buflen && (Character.isUnicodeIdentifierPart(ch) || ch == '-'))
+            nextChar();
+        return new String(buf, start, bp - start);
+    }
+
+    protected String readTagName() {
+        int start = bp;
+        nextChar();
+        while (bp < buflen
+                && (Character.isUnicodeIdentifierPart(ch) || ch == '.'
+                || ch == '-' || ch == ':')) {
+            nextChar();
+        }
+        return new String(buf, start, bp - start);
+    }
+
+    protected boolean isJavaIdentifierStart(char ch) {
+        return Character.isJavaIdentifierStart(ch);
+    }
+
+    protected String readJavaIdentifier() {
+        int start = bp;
+        nextChar();
+        while (bp < buflen && Character.isJavaIdentifierPart(ch))
+            nextChar();
+        return new String(buf, start, bp - start);
+    }
+
+    protected boolean isDecimalDigit(char ch) {
+        return ('0' <= ch && ch <= '9');
+    }
+
+    protected boolean isHexDigit(char ch) {
+        return ('0' <= ch && ch <= '9')
+                || ('a' <= ch && ch <= 'f')
+                || ('A' <= ch && ch <= 'F');
+    }
+
+    protected boolean isUnquotedAttrValueTerminator(char ch) {
+        switch (ch) {
+            case '\f': case '\n': case '\r': case '\t':
+            case ' ':
+            case '"': case '\'': case '`':
+            case '=': case '<': case '>':
+                return true;
+            default:
+                return false;
+        }
+    }
+
+    protected boolean isWhitespace(char ch) {
+        return Character.isWhitespace(ch);
+    }
+
+    protected void skipWhitespace() {
+        while (isWhitespace(ch)) {
+            nextChar();
+        }
+    }
+
+    /**
+     * @param start position of first character of string
+     * @param end position of character beyond last character to be included
+     */
+    String newString(int start, int end) {
+        return new String(buf, start, end - start);
+    }
+
+    static abstract class TagParser {
+        enum Kind { INLINE, BLOCK }
+
+        final Kind kind;
+        final String name;
+
+
+        TagParser(Kind k, String tk) {
+            kind = k;
+            name = tk;
+        }
+
+        TagParser(Kind k, String tk, boolean retainWhiteSpace) {
+            this(k, tk);
+        }
+
+        Kind getKind() {
+            return kind;
+        }
+
+        String getName() {
+            return name;
+        }
+
+        abstract void parse(int pos) throws ParseException;
+    }
+
+    /**
+     * @see <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javadoc.html#javadoctags">Javadoc Tags</a>
+     */
+    @SuppressWarnings("deprecation")
+    private void initTagParsers() {
+        TagParser[] parsers = {
+            // @author name-text
+            new TagParser(Kind.BLOCK, "author") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+
+            // {@code text}
+            new TagParser(Kind.INLINE, "code", true) {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
+                    nextChar();
+                }
+            },
+
+            // @deprecated deprecated-text
+            new TagParser(Kind.BLOCK, "deprecated") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+
+            // {@docRoot}
+            new TagParser(Kind.INLINE, "docRoot") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    if (ch == '}') {
+                        nextChar();
+                        return;
+                    }
+                    inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
+                    nextChar();
+                    throw new ParseException("dc.unexpected.content");
+                }
+            },
+
+            // @exception class-name description
+            new TagParser(Kind.BLOCK, "exception") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    reference(false);
+                    blockContent();
+                }
+            },
+
+            // @hidden hidden-text
+            new TagParser(Kind.BLOCK, "hidden") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+
+            // @index search-term options-description
+            new TagParser(Kind.INLINE, "index") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    if (ch == '}') {
+                        throw new ParseException("dc.no.content");
+                    }
+                    if (ch == '"') quotedString(); else inlineWord();
+                    skipWhitespace();
+                    if (ch != '}') {
+                        inlineContent();
+                    } else {
+                        nextChar();
+                    }
+                }
+            },
+
+            // {@inheritDoc}
+            new TagParser(Kind.INLINE, "inheritDoc") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    if (ch == '}') {
+                        nextChar();
+                        return;
+                    }
+                    inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
+                    nextChar();
+                    throw new ParseException("dc.unexpected.content");
+                }
+            },
+
+            // {@link package.class#member label}
+            new TagParser(Kind.INLINE, "link") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    reference(true);
+                    inlineContent();
+                }
+            },
+
+            // {@linkplain package.class#member label}
+            new TagParser(Kind.INLINE, "linkplain") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    reference(true);
+                    inlineContent();
+                }
+            },
+
+            // {@literal text}
+            new TagParser(Kind.INLINE, "literal", true) {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
+                    nextChar();
+                }
+            },
+
+            // @param parameter-name description
+            new TagParser(Kind.BLOCK, "param") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    skipWhitespace();
+
+                    boolean typaram = false;
+                    if (ch == '<') {
+                        typaram = true;
+                        nextChar();
+                    }
+
+                    identifier();
+
+                    if (typaram) {
+                        if (ch != '>')
+                            throw new ParseException("dc.gt.expected");
+                        nextChar();
+                    }
+
+                    skipWhitespace();
+                    blockContent();
+                }
+            },
+
+            // @return description
+            new TagParser(Kind.BLOCK, "return") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+
+            // @see reference | quoted-string | HTML
+            new TagParser(Kind.BLOCK, "see") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    switch (ch) {
+                        case '"':
+                            quotedString();
+                            skipWhitespace();
+                            if (ch == '@'
+                                    || ch == EOI && bp == buf.length - 1) {
+                                return;
+                            }
+                            break;
+
+                        case '<':
+                            blockContent();
+                            return;
+
+                        case '@':
+                            if (newline)
+                                throw new ParseException("dc.no.content");
+                            break;
+
+                        case EOI:
+                            if (bp == buf.length - 1)
+                                throw new ParseException("dc.no.content");
+                            break;
+
+                        default:
+                            if (isJavaIdentifierStart(ch) || ch == '#') {
+                                reference(true);
+                                blockContent();
+                            }
+                    }
+                    throw new ParseException("dc.unexpected.content");
+                }
+            },
+
+            // @serialData data-description
+            new TagParser(Kind.BLOCK, "@serialData") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+
+            // @serialField field-name field-type description
+            new TagParser(Kind.BLOCK, "serialField") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    identifier();
+                    skipWhitespace();
+                    reference(false);
+                    if (isWhitespace(ch)) {
+                        skipWhitespace();
+                        blockContent();
+                    }
+                }
+            },
+
+            // @serial field-description | include | exclude
+            new TagParser(Kind.BLOCK, "serial") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+
+            // @since since-text
+            new TagParser(Kind.BLOCK, "since") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+
+            // @throws class-name description
+            new TagParser(Kind.BLOCK, "throws") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    reference(false);
+                    blockContent();
+                }
+            },
+
+            // {@value package.class#field}
+            new TagParser(Kind.INLINE, "value") {
+                @Override
+                public void parse(int pos) throws ParseException {
+                    reference(true);
+                    skipWhitespace();
+                    if (ch == '}') {
+                        nextChar();
+                        return;
+                    }
+                    nextChar();
+                    throw new ParseException("dc.unexpected.content");
+                }
+            },
+
+            // @version version-text
+            new TagParser(Kind.BLOCK, "version") {
+                @Override
+                public void parse(int pos) {
+                    blockContent();
+                }
+            },
+        };
+
+        tagParsers = new HashMap<String, TagParser>();
+        for (TagParser p: parsers)
+            tagParsers.put(p.getName(), p);
+
+    }
+
+    private void initEventAttrs() {
+        eventAttrs = new HashSet<String>(Arrays.asList(
+            // See https://www.w3.org/TR/html-markup/global-attributes.html#common.attrs.event-handler
+            "onabort",  "onblur",  "oncanplay",  "oncanplaythrough",
+            "onchange",  "onclick",  "oncontextmenu",  "ondblclick",
+            "ondrag",  "ondragend",  "ondragenter",  "ondragleave",
+            "ondragover",  "ondragstart",  "ondrop",  "ondurationchange",
+            "onemptied",  "onended",  "onerror",  "onfocus",  "oninput",
+            "oninvalid",  "onkeydown",  "onkeypress",  "onkeyup",
+            "onload",  "onloadeddata",  "onloadedmetadata",  "onloadstart",
+            "onmousedown",  "onmousemove",  "onmouseout",  "onmouseover",
+            "onmouseup",  "onmousewheel",  "onpause",  "onplay",
+            "onplaying",  "onprogress",  "onratechange",  "onreadystatechange",
+            "onreset",  "onscroll",  "onseeked",  "onseeking",
+            "onselect",  "onshow",  "onstalled",  "onsubmit",  "onsuspend",
+            "ontimeupdate",  "onvolumechange",  "onwaiting",
+
+            // See https://www.w3.org/TR/html4/sgml/dtd.html
+            // Most of the attributes that take a %Script are also defined as event handlers
+            // in HTML 5. The one exception is onunload.
+            // "onchange",  "onclick",   "ondblclick",  "onfocus",
+            // "onkeydown",  "onkeypress",  "onkeyup",  "onload",
+            // "onmousedown",  "onmousemove",  "onmouseout",  "onmouseover",
+            // "onmouseup",  "onreset",  "onselect",  "onsubmit",
+            "onunload"
+        ));
+    }
+
+    private void initURIAttrs() {
+        uriAttrs = new HashSet<String>(Arrays.asList(
+            // See https://www.w3.org/TR/html4/sgml/dtd.html
+            //     https://www.w3.org/TR/html5/
+            // These are all the attributes that take a %URI or a valid URL potentially surrounded
+            // by spaces
+            "action",  "cite",  "classid",  "codebase",  "data",
+            "datasrc",  "for",  "href",  "longdesc",  "profile",
+            "src",  "usemap"
+        ));
+    }
+
+}
--- a/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -363,4 +363,9 @@
     public Locale getLocale() {
         return env.doclocale.locale;
     }
+
+    public JavaScriptScanner initJavaScriptScanner(boolean allowScriptInComments) {
+        return env.initJavaScriptScanner(allowScriptInComments);
+    }
+
 }
--- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -107,6 +107,8 @@
 javadoc.Body_missing_from_html_file=Body tag missing from HTML file
 javadoc.End_body_missing_from_html_file=Close body tag missing from HTML file
 javadoc.Multiple_package_comments=Multiple sources of package comments found for package "{0}"
+javadoc.JavaScript_in_comment=JavaScript found in documentation comment.\n\
+    Use --allow-script-in-comments to allow use of JavaScript.
 javadoc.class_not_found=Class {0} not found.
 javadoc.error=error
 javadoc.warning=warning
--- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -78,6 +78,7 @@
 javadoc.Body_missing_from_html_file=HTML\u306Bbody\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
 javadoc.End_body_missing_from_html_file=HTML\u30D5\u30A1\u30A4\u30EB\u306Bbody\u306E\u9589\u3058\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
 javadoc.Multiple_package_comments=\u30D1\u30C3\u30B1\u30FC\u30B8"{0}"\u306B\u8907\u6570\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30B3\u30E1\u30F3\u30C8\u306E\u30BD\u30FC\u30B9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F
+javadoc.JavaScript_in_comment=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30B3\u30E1\u30F3\u30C8\u306BJavaScript\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002\n--allow-script-in-comments\u3092\u4F7F\u7528\u3057\u3066\u3001JavaScript\u306E\u4F7F\u7528\u3092\u8A31\u53EF\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 javadoc.class_not_found=\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
 javadoc.error=\u30A8\u30E9\u30FC
 javadoc.warning=\u8B66\u544A
--- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Sat Aug 20 11:56:22 2016 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -78,6 +78,7 @@
 javadoc.Body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u6807\u8BB0
 javadoc.End_body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u7ED3\u675F\u6807\u8BB0
 javadoc.Multiple_package_comments=\u627E\u5230\u7A0B\u5E8F\u5305 "{0}" \u7684\u591A\u4E2A\u7A0B\u5E8F\u5305\u6CE8\u91CA\u6E90
+javadoc.JavaScript_in_comment=\u6587\u6863\u6CE8\u91CA\u4E2D\u53D1\u73B0 JavaScript\u3002\n\u4F7F\u7528 --allow-script-in-comments \u53EF\u5141\u8BB8\u4F7F\u7528 JavaScript\u3002
 javadoc.class_not_found=\u627E\u4E0D\u5230\u7C7B{0}\u3002
 javadoc.error=\u9519\u8BEF
 javadoc.warning=\u8B66\u544A
--- a/test/Makefile	Sat Aug 20 11:56:22 2016 -0700
+++ b/test/Makefile	Sun May 21 11:12:40 2017 -0700
@@ -33,6 +33,9 @@
   ifeq ($(ARCH), i386)
     ARCH=i586
   endif
+  ifeq ($(ARCH), ppc64le)
+    ARCH=ppc64
+  endif
 endif
 ifeq ($(OSNAME), Darwin)
   PLATFORM = bsd
--- a/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4645058 4747738 4855054
+ * @bug 4645058 4747738 4855054 8024756
  * @summary  Javascript IE load error when linked by -linkoffline
  *           Window title shouldn't change when loading left frames (javascript)
  * @author dkramer
@@ -115,9 +115,13 @@
 
             // Test that win title javascript is followed by NOSCRIPT code.
             {"<script type=\"text/javascript\"><!--" + LS +
-                     "    if (location.href.indexOf('is-external=true') == -1) {" + LS +
-                     "        parent.document.title=\"C (Window Title)\";" + LS +
-                     "    }" + LS + "//-->" + LS + "</script>",
+            "    try {" + LS +
+            "        if (location.href.indexOf('is-external=true') == -1) {" + LS +
+            "            parent.document.title=\"C (Window Title)\";" + LS +
+            "        }" + LS +
+            "    }" + LS +
+            "    catch(err) {" + LS +
+            "    }" + LS + "//-->" + LS + "</script>",
              TMPDEST_DIR1 + FS + "p1" + FS + "C.html"
             }
 
--- a/test/com/sun/javadoc/VersionNumber/VersionNumber.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/test/com/sun/javadoc/VersionNumber/VersionNumber.java	Sun May 21 11:12:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -84,7 +84,7 @@
 
             // Test the proper DOCTYPE element is present:
             {
-                 "<!-- Generated by javadoc (version",
+                 "<!-- Generated by javadoc (",
                      TMPDEST_DIR1 + "p1" + FS + "C.html"  },
 
         };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testDocFiles/TestDocFiles.java	Sun May 21 11:12:40 2017 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8008949
+ * @summary verify that doc-files get copied
+ * @library ../lib/
+ * @build JavadocTester
+ * @build TestDocFiles
+ * @run main TestDocFiles
+ */
+
+public class TestDocFiles extends JavadocTester {
+
+    private static final String BUG_ID = "8008949";
+    private static final String[][] TEST = {
+        {"tmp" + FS + "pkg" + FS + "doc-files" + FS + "test.txt", "test file"}};
+
+    private static final String[] ARGS =
+        new String[] {
+            "-d", "tmp", "-sourcepath", SRC_DIR, "pkg"};
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestDocFiles tester = new TestDocFiles();
+        run(tester, ARGS, TEST, NO_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testDocFiles/pkg/Test.java	Sun May 21 11:12:40 2017 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class Test { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testDocFiles/pkg/doc-files/test.txt	Sun May 21 11:12:40 2017 -0700
@@ -0,0 +1,2 @@
+this is a test file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java	Sun May 21 11:12:40 2017 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8000418
+ * @summary Verify that files use a common Generated By string
+ * @library ../lib/
+ * @build JavadocTester TestGeneratedBy
+ * @run main TestGeneratedBy
+ */
+
+public class TestGeneratedBy extends JavadocTester {
+
+    private static final String OUTPUT_DIR = "tmp";
+
+    private static final String[] FILES = {
+        "pkg/MyClass.html",
+        "pkg/package-summary.html",
+        "pkg/package-frame.html",
+        "pkg/package-tree.html",
+        "allclasses-noframe.html",
+        "constant-values.html",
+        "allclasses-frame.html",
+        "overview-tree.html",
+        "deprecated-list.html",
+        "serialized-form.html",
+        "help-doc.html",
+        "index-all.html",
+        "index.html"
+    };
+
+    private static final String[] ARGS =
+        new String[] {
+            "-d", OUTPUT_DIR,
+            "-sourcepath", SRC_DIR,
+            "pkg"
+        };
+    private static final String BUG_ID = "8000418";
+
+    private static String[][] getTests() {
+        String version = System.getProperty("java.version");
+        String[][] tests = new String[FILES.length][];
+        for (int i = 0; i < FILES.length; i++) {
+            tests[i] = new String[] {
+                OUTPUT_DIR + FS + FILES[i],
+                "Generated by javadoc (" + version + ") on "
+            };
+        }
+        return tests;
+    }
+
+    private static String[][] getNegatedTests() {
+        String[][] tests = new String[FILES.length][];
+        for (int i = 0; i < FILES.length; i++) {
+            tests[i] = new String[] {
+                OUTPUT_DIR + FS + FILES[i],
+                "Generated by javadoc (version",
+                "Generated by javadoc on"
+            };
+        }
+        return tests;
+    }
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestGeneratedBy tester = new TestGeneratedBy();
+        int exitCode = run(tester, ARGS, getTests(), getNegatedTests());
+        tester.printSummary();
+        if (exitCode != 0) {
+            throw new Error("Error found while executing Javadoc");
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testGeneratedBy/pkg/MyClass.java	Sun May 21 11:12:40 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+import java.io.Serializable;
+
+public class MyClass implements Serializable {
+}
--- a/test/com/sun/javadoc/testJavascript/TestJavascript.java	Sat Aug 20 11:56:22 2016 -0700
+++ b/test/com/sun/javadoc/testJavascript/TestJavascript.java	Sun May 21 11:12:40 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876 7025314 8012375 8015998 8016328
+ * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756 8151921
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib/
@@ -50,11 +50,12 @@
             "<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>"},
         {BUG_ID + FS + "index.html",
             "<script type=\"text/javascript\">" + NL +
-                        "    targetPage = \"\" + window.location.search;" + NL +
-            "    if (targetPage != \"\" && targetPage != \"undefined\")" + NL +
-            "        targetPage = targetPage.substring(1);" + NL +
-            "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL +
-            "        targetPage = \"undefined\";" + NL +
+            "    tmpTargetPage = \"\" + window.location.search;" + NL +
+            "    if (tmpTargetPage != \"\" && tmpTargetPage != \"undefined\")" + NL +
+            "        tmpTargetPage = tmpTargetPage.substring(1);" + NL +
+            "    if (tmpTargetPage.indexOf(\":\") != -1 || (tmpTargetPage != \"\" && !validURL(tmpTargetPage)))" + NL +
+            "        tmpTargetPage = \"undefined\";" + NL +
+            "    targetPage = tmpTargetPage;" + NL +
             "    function validURL(url) {" + NL +
             "        try {" + NL +
             "            url = decodeURIComponent(url);" + NL +
@@ -104,9 +105,13 @@
 
         //Make sure title javascript only runs if is-external is not true
         {BUG_ID + FS + "pkg" + FS + "C.html",
-                "    if (location.href.indexOf('is-external=true') == -1) {" + NL +
-                "        parent.document.title=\"C\";" + NL +
-                        "    }"},
+            "    try {" + NL +
+            "        if (location.href.indexOf('is-external=true') == -1) {" + NL +
+            "            parent.document.title=\"C\";" + NL +
+            "        }" + NL +
+            "    }" + NL +
+            "    catch(err) {" + NL +
+            "    }"},
     };
 
     private static final String[][] NEGATED_TEST = NO_TEST;