changeset 60005:1878e7d5527a

Merge
author jwilhelm
date Tue, 30 Jun 2020 20:59:15 +0200
parents a4585ab8c15f 81b7aca0a0fc
children edeb0d435a35
files src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java test/langtools/jdk/javadoc/doclet/testGeneratedBy/TestGeneratedBy.java
diffstat 8 files changed, 17 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/Versions.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/Versions.java	Tue Jun 30 20:59:15 2020 +0200
@@ -26,6 +26,7 @@
 package jdk.javadoc.internal;
 
 import java.util.ResourceBundle;
+import java.util.stream.Collectors;
 
 import static java.util.ResourceBundle.getBundle;
 
@@ -77,15 +78,18 @@
     /**
      * Returns a short string representation of the provided version.
      *
-     * <p> Examples of strings returned from this method are: "15" and
-     * "15-internal".
+     * <p> The string contains the dotted representation of the version number,
+     * followed by the prerelease info, if any.
+     * For example, "15", "15.1", "15.0.1", "15-internal".
      *
      * @return a short string representation of the provided version
      *
      * @throws NullPointerException if {@code v == null}
      */
     public static String shortVersionStringOf(Runtime.Version v) {
-        String svstr = String.valueOf(v.feature());
+        String svstr = v.version().stream()
+                .map(Object::toString)
+                .collect(Collectors.joining("."));
         if (v.pre().isPresent()) {
             svstr += "-" + v.pre().get();
         }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java	Tue Jun 30 20:59:15 2020 +0200
@@ -160,11 +160,6 @@
     }
 
     @Override
-    public String getDocletVersionString() {
-        return Versions.shortVersionStringOf(docletVersion);
-    }
-
-    @Override
     public Resources getDocResources() {
         return docResources;
     }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue Jun 30 20:59:15 2020 +0200
@@ -431,7 +431,7 @@
         Content htmlComment = contents.newPage;
         List<DocPath> additionalStylesheets = configuration.getAdditionalStylesheets();
         additionalStylesheets.addAll(localStylesheets);
-        Head head = new Head(path, configuration.getDocletVersionString(), configuration.startTime)
+        Head head = new Head(path, configuration.getDocletVersion(), configuration.startTime)
                 .setTimestamp(!options.noTimestamp())
                 .setDescription(description)
                 .setGenerator(getGenerator(getClass()))
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java	Tue Jun 30 20:59:15 2020 +0200
@@ -75,7 +75,7 @@
      */
     private void generateIndexFile() throws DocFileIOException {
         Content htmlComment = contents.newPage;
-        Head head = new Head(path, configuration.getDocletVersionString(), configuration.startTime)
+        Head head = new Head(path, configuration.getDocletVersion(), configuration.startTime)
                 .setTimestamp(!options.noTimestamp())
                 .setDescription("index redirect")
                 .setGenerator(getGenerator(getClass()))
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Tue Jun 30 20:59:15 2020 +0200
@@ -235,7 +235,7 @@
      * @param path the path for the file.
      */
     private void writeToFile(Content body, DocPath path, TypeElement te) throws DocFileIOException {
-        Head head = new Head(path, configuration.getDocletVersionString(), configuration.startTime)
+        Head head = new Head(path, configuration.getDocletVersion(), configuration.startTime)
 //                .setTimestamp(!options.notimestamp) // temporary: compatibility!
                 .setTitle(resources.getText("doclet.Window_Source_title"))
 //                .setCharset(options.charset) // temporary: compatibility!
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java	Tue Jun 30 20:59:15 2020 +0200
@@ -49,7 +49,7 @@
  *  deletion without notice.</b>
  */
 public class Head extends Content {
-    private final String docletVersion;
+    private final Runtime.Version docletVersion;
     private final Date generatedDate;
     private final DocPath pathToRoot;
     private String title;
@@ -74,9 +74,9 @@
      * recording the time the file was created.
      * The doclet version should also be provided for recording in the file.
      * @param path the path for the file that will include this HEAD element
-     * @param docletVersion a string identifying the doclet version
+     * @param docletVersion the doclet version
      */
-    public Head(DocPath path, String docletVersion, Date generatedDate) {
+    public Head(DocPath path, Runtime.Version docletVersion, Date generatedDate) {
         this.docletVersion = docletVersion;
         this.generatedDate = generatedDate;
         pathToRoot = path.parent().invert();
@@ -294,9 +294,8 @@
 
     private Comment getGeneratedBy(boolean timestamp, Date now) {
         String text = "Generated by javadoc"; // marker string, deliberately not localized
-        text += " (" + docletVersion + ")";
         if (timestamp) {
-            text += " on " + now;
+            text += " ("+ docletVersion.feature() + ") on " + now;
         }
         return new Comment(text);
     }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java	Tue Jun 30 20:59:15 2020 +0200
@@ -158,14 +158,6 @@
     public abstract Runtime.Version getDocletVersion();
 
     /**
-     * Returns a short string representation of the version returned by
-     * {@linkplain #getDocletVersion()}.
-     *
-     * @return a short string representation of the version
-     */
-    public abstract String getDocletVersionString();
-
-    /**
      * This method should be defined in all those doclets (configurations),
      * which want to derive themselves from this BaseConfiguration. This method
      * can be used to finish up the options setup.
--- a/test/langtools/jdk/javadoc/doclet/testGeneratedBy/TestGeneratedBy.java	Tue Jun 30 15:24:01 2020 -0400
+++ b/test/langtools/jdk/javadoc/doclet/testGeneratedBy/TestGeneratedBy.java	Tue Jun 30 20:59:15 2020 +0200
@@ -79,9 +79,9 @@
     }
 
     void checkTimestamps(boolean timestamp, String... files) {
-        String version = System.getProperty("java.version");
-        String genBy = "Generated by javadoc (" + version + ")";
-        if (timestamp) genBy += " on ";
+        String version = System.getProperty("java.specification.version");
+        String genBy = "Generated by javadoc";
+        if (timestamp) genBy += " (" + version + ") on ";
 
         for (String file: files) {
             // genBy is the current standard "Generated by" text