8243113: Always identify version of javadoc used to generate docs

Reviewed-by: prappo
This commit is contained in:
Jonathan Gibbons 2020-06-17 09:24:28 -07:00
parent 44d4e37ccb
commit 1d87958ead
3 changed files with 11 additions and 11 deletions
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup
test/langtools/jdk/javadoc/doclet
testGeneratedBy
testHeadTag

@ -294,8 +294,9 @@ public class Head extends Content {
private Comment getGeneratedBy(boolean timestamp, Date now) {
String text = "Generated by javadoc"; // marker string, deliberately not localized
text += " (" + docletVersion + ")";
if (timestamp) {
text += " ("+ docletVersion + ") on " + now;
text += " on " + now;
}
return new Comment(text);
}

@ -23,7 +23,7 @@
/*
* @test
* @bug 8000418 8024288 8196202
* @bug 8000418 8024288 8196202 8243113
* @summary Verify that files use a common Generated By string
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -80,8 +80,8 @@ public class TestGeneratedBy extends JavadocTester {
void checkTimestamps(boolean timestamp, String... files) {
String version = System.getProperty("java.version");
String genBy = "Generated by javadoc";
if (timestamp) genBy += " (" + version + ") on ";
String genBy = "Generated by javadoc (" + version + ")";
if (timestamp) genBy += " on ";
for (String file: files) {
// genBy is the current standard "Generated by" text
@ -89,10 +89,8 @@ public class TestGeneratedBy extends JavadocTester {
// These are older versions of the "Generated by" text
checkOutput(file, false,
(timestamp
? "Generated by javadoc (version"
: "Generated by javadoc ("),
"Generated by javadoc on");
"Generated by javadoc (version",
"Generated by javadoc on");
}
}
}

@ -23,7 +23,7 @@
/*
* @test
* @bug 8203792
* @bug 8203792 8243113
* @summary Remove "compatibility" features from Head.java
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -44,6 +44,7 @@ import javadoc.tester.JavadocTester;
public class TestHeadTag extends JavadocTester {
final ToolBox tb;
final String version = System.getProperty("java.version");
public static void main(String... args) throws Exception {
TestHeadTag tester = new TestHeadTag();
@ -67,7 +68,7 @@ public class TestHeadTag extends JavadocTester {
checkExit(Exit.OK);
checkOrder("pkg/A.html",
"Generated by javadoc",
"Generated by javadoc (" + version + ")",
"<meta name=\"dc.created\"");
}
@ -85,7 +86,7 @@ public class TestHeadTag extends JavadocTester {
checkExit(Exit.OK);
checkOutput("pkg/A.html", true,
"<!-- Generated by javadoc -->");
"<!-- Generated by javadoc (" + version + ") -->");
checkOutput("pkg/A.html", false,
"<meta name=\"dc.created\"");
}