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

javadoc fails to document static final fields in annotation types

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 7u17, 8
    • tools
    • None
    • b110
    • Verified

    Description

      FULL PRODUCT VERSION :
      java version " 1.7.0_17 "
      Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      OS X 10.8.3

      A DESCRIPTION OF THE PROBLEM :
      It's not commonly used, but the JLS allows @interface (i.e., annotation) types to contain public static final fields just like normal interfaces.

      However, the javadoc tool fails to document these fields in the HTML it generates. It simply omits them altogether.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and javadocument this class:

      public @interface Foo {

          /**
           * Default value for {@link #name}.
           */
          String DEFAULT_NAME = " fred " ;

          /**
           * Mr. Foo's name.
           */
          String name() default DEFAULT_NAME;
      }

      It compiles and javadoc's fine, but DEFAULT_NAME is not present in the javadoc output.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      DEFAULT_NAME to be present in the javadoc output.

      ACTUAL -
      DEFAULT_NAME is not present in the javadoc output.



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public @interface Foo {

          /**
           * Default value for {@link #name}.
           */
          String DEFAULT_NAME = " fred " ;

          /**
           * Mr. Foo's name.
           */
          String name() default DEFAULT_NAME;
      }

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

      Attachments

        Activity

          People

            bpatel Bhavesh Patel (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: