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

Javadoc generates too much whitespace when annotations are present

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Tested on OSX :
      Darwin K3459 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

      Java:
      java version "1.8.0_181"
      Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

      and:

      openjdk 11 2018-09-25
      OpenJDK Runtime Environment 18.9 (build 11+28)
      OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      Running javadoc against a class that contains a long "@Generated" annotation creates extra white space before fields, causing them to flow off of the visible page.

      For example:
      ```
      @Generated(value="SomeGeneratedClassName",
                 date="a date",
                 comments="some really long comment to help demonstrate the issue")
      void doSomething(java.lang.String one,
                                                                                                                                                                          java.lang.String two,
                                                                                                                                                                          java.lang.String three)

      ```

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a Java interface: JavadocAnnotationIssue.java
      contents:

      ```
      public interface JavadocAnnotationIssue {

        /**
        * Reproduces the formatting error when there is a long @Generated annotation.
        * @param one first
        * @param two second
        * @param three third
        */
        @javax.annotation.Generated(
                  value = "SomeGeneratedClassName",
                  date = "a date",
                  comments = "some really long comment to help demonstrate the issue")
        public void doSomething(String one, String two, String three);
      }
      ```

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      <pre>@Generated(value="SomeGeneratedClassName",
                 date="a date",
                 comments="some really long comment to help demonstrate the issue")
      void&nbsp;doSomething(java.lang.String&nbsp;one,
                       java.lang.String&nbsp;two,
                       java.lang.String&nbsp;three)</pre>
      ACTUAL -
      <pre>@Generated(value="SomeGeneratedClassName",
                 date="a date",
                 comments="some really long comment to help demonstrate the issue")
      void&nbsp;doSomething(java.lang.String&nbsp;one,
                                                                                                                                                                          java.lang.String&nbsp;two,
                                                                                                                                                                          java.lang.String&nbsp;three)</pre>

      ---------- BEGIN SOURCE ----------
      public interface JavadocAnnotationIssue {

        /**
        * Reproduces the formatting error when there is a long @Generated annotation.
        * @param one first
        * @param two second
        * @param three third
        */
        @javax.annotation.Generated(
                  value = "SomeGeneratedClassName",
                  date = "a date",
                  comments = "some really long comment to help demonstrate the issue")
        public void doSomething(String one, String two, String three);
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hannesw Hannes Wallnoefer
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: