mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-23 21:30:26 +00:00
8000418: javadoc should used a standard "generated by javadoc" string
Reviewed-by: bpatel
This commit is contained in:
parent
9551f94d32
commit
8b895ea856
@ -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("<!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.
|
||||
*
|
||||
@ -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) {
|
||||
|
||||
@ -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.
|
||||
*
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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:
|
||||
{
|
||||
"<!-- Generated by javadoc (version",
|
||||
"<!-- Generated by javadoc (",
|
||||
TMPDEST_DIR1 + "p1" + FS + "C.html" },
|
||||
|
||||
};
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user