Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8326483

"javadoc -notimestamp" still adds javadoc doclet version to comment

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      As a Java developer interested in reproducible build artifacts, I wish to generate my javadocs in such a way that they look the same as much as possible across OS and Java version used to genrate those docs, so the commit diffs for my documentation website are as small as possible, only reflecting actual javadoc changes.

      What happens instead on JDK 16+, is that despite "-notimestamp", the doclet version is contained in HTML comments like "Generated by javadoc (21)", making my javadoc build sensitive to the JDK I run the build on, leading to back-and-forth diffs in javadocs, depending on which developer happens to build them on which JDK.

      Historical background:
        -- In JDKs 8 to 9, the javadoc version was not added to the comment string at all, see com.sun.tools.doclets.formats.html.markup.HtmlDocWriter::getGeneratedBy.
        -- In JDKs 10 to 15, the version number was suppressed together with the timestamp in '-notimestamp' mode, see jdk.javadoc.internal.doclets.formats.html.markup.Head::getGeneratedBy.
        -- Since JDK 16, the version is generated into the comment string without regard of the timestamp setting.

      The corresponding change was https://github.com/openjdk/jdk/commit/579ed706298be8339faf33e768f84c9b3795cf1a. There is no real explanation in the commit comment, Jonathan Gibbons only wrote: "8248417: some jdk/javadoc/doclet tests fail (JDK 16)".

      See also https://bugs.openjdk.org/browse/JDK-8248417.

      Maybe those failing tests should have fixed in another way than applying a breaking change to the way this particular HTML comment is generated.

      I think, the change should be reverted. Alternatively, users need another way to suppress the javadoc version number in the comment, i.e. a new command line option similar to "-notimestamp". But would that be worth a new option? I do suggest to revert the change and reinstate the pre-JDK-16 behaviour. The devil is in the details in reproducible builds, and javadoc JARs are a build artifact e.g. required by Maven Central when deploying new library versions.

      REGRESSION : Last worked in version 16

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javadoc -notimestamp Demo.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The HTML comment is "Generated by javadoc" in all HTML files, e.g. Demo.html.
      ACTUAL -
      The HTML comment is "Generated by javadoc ([docletVersion])" in all HTML files, e.g. Demo.html.

      ---------- BEGIN SOURCE ----------
      /**
       * My description
       */
      public class Demo {}

      ---------- END SOURCE ----------

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: