OpenJDK / jdk / jdk
changeset 60004:81b7aca0a0fc
8248409: some jdk/javadoc/doclet tests fail (JDK 15)
Reviewed-by: prappo
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/Versions.java Tue Jun 30 18:52:59 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/Versions.java Tue Jun 30 11:36:02 2020 -0700 @@ -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 18:52:59 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Jun 30 11:36:02 2020 -0700 @@ -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 18:52:59 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Jun 30 11:36:02 2020 -0700 @@ -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 18:52:59 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java Tue Jun 30 11:36:02 2020 -0700 @@ -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 18:52:59 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java Tue Jun 30 11:36:02 2020 -0700 @@ -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 18:52:59 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java Tue Jun 30 11:36:02 2020 -0700 @@ -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(); @@ -295,7 +295,7 @@ private Comment getGeneratedBy(boolean timestamp, Date now) { String text = "Generated by javadoc"; // marker string, deliberately not localized if (timestamp) { - text += " ("+ docletVersion + ") 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 18:52:59 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java Tue Jun 30 11:36:02 2020 -0700 @@ -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 18:52:59 2020 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testGeneratedBy/TestGeneratedBy.java Tue Jun 30 11:36:02 2020 -0700 @@ -79,7 +79,7 @@ } void checkTimestamps(boolean timestamp, String... files) { - String version = System.getProperty("java.version"); + String version = System.getProperty("java.specification.version"); String genBy = "Generated by javadoc"; if (timestamp) genBy += " (" + version + ") on ";