From a23eee2f2fba8e517bd2b3fc671807dd830d07d6 Mon Sep 17 00:00:00 2001 From: jjg Date: Wed, 10 Oct 2012 18:34:46 -0700 Subject: [PATCH] 8000418: javadoc should used a standard "generated by javadoc" string Reviewed-by: bpatel --- .../formats/html/HtmlDocletWriter.java | 63 +--------- .../html/SerializedFormWriterImpl.java | 17 --- .../formats/html/markup/HtmlDocWriter.java | 16 +-- .../javadoc/VersionNumber/VersionNumber.java | 4 +- .../testGeneratedBy/TestGeneratedBy.java | 112 ++++++++++++++++++ .../javadoc/testGeneratedBy/pkg/MyClass.java | 29 +++++ 6 files changed, 149 insertions(+), 92 deletions(-) create mode 100644 test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java create mode 100644 test/com/sun/javadoc/testGeneratedBy/pkg/MyClass.java diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java index aa6d77bc..90bc3502 100644 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java @@ -350,66 +350,6 @@ public class HtmlDocletWriter extends HtmlDocWriter { return getHyperLink(pathString(pd, "package-summary.html"), "", label, "", target); } - /** - * Print the html file header. Also print Html page title and stylesheet - * default properties. - * - * @param title String window title to go in the <TITLE> 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(""); - println(""); - html(); - head(); - if (! configuration.notimestamp) { - print(""); - } - if (configuration.charset.length() > 0) { - println(""); - } - 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(""); - } - if ( metakeywords != null ) { - for ( int i=0; i < metakeywords.length; i++ ) { - println(""); - } - } - 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. * @@ -426,8 +366,7 @@ public class HtmlDocletWriter extends HtmlDocWriter { 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) { diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java index f6dc9a06..bd6ed513 100644 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java @@ -54,23 +54,6 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter super(ConfigurationImpl.getInstance(), FILE_NAME); } - /** - * 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. * diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java index 9870e26e..4456c2e9 100644 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java @@ -29,6 +29,7 @@ import java.io.*; import java.util.*; import com.sun.javadoc.*; +import com.sun.tools.doclets.formats.html.ConfigurationImpl; import com.sun.tools.doclets.internal.toolkit.*; @@ -329,7 +330,7 @@ public abstract class HtmlDocWriter extends HtmlWriter { 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) { @@ -391,16 +392,9 @@ public abstract class HtmlDocWriter extends HtmlWriter { print("          "); } - /** - * 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; } } diff --git a/test/com/sun/javadoc/VersionNumber/VersionNumber.java b/test/com/sun/javadoc/VersionNumber/VersionNumber.java index eadf1ca5..e4cb0107 100644 --- a/test/com/sun/javadoc/VersionNumber/VersionNumber.java +++ b/test/com/sun/javadoc/VersionNumber/VersionNumber.java @@ -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 @@ public class VersionNumber { // Test the proper DOCTYPE element is present: { - "