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

Javadoc generated for enums could be misleading

XMLWordPrintable

    • b49
    • generic
    • generic


      ###@###.### 2004-03-08

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b40)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b40, mixed mode)

      Does this problem occur on J2SE 1.3.x or 1.4.x? Yes / No (pick one)
        No

      Bug Description:

      The Javadoc standard doclet generates documentation which, for classes
      and interfaces, includes something which looks like a fragment of a type
      declaration equivalent to that used in the actual source code :

          public final class String
          extends Object
          implements Serializable, Comparable<String>, CharSequence

      In particular, it is a fragment of legal Java code which, with the
      addition of some imports and an appropriate body, could compile to the
      type documented. However this is not the case for enums, which are
      displayed as:

          public static enum RoundingMode
          extends Enum<RoundingMode>

      Given that enums are a new language feature with certain unique rules
      regarding modifiers and inheritance, displaying an illegal fragment of
      something which looks like the enum's declaration could cause confusion
      as to what is and is not allowed when declaring enums. For example, it
      could be inferred (consciously or otherwise) from reading this that :

      1) The static modifier is permitted on top level enum declarations
      2) Distinct concepts of static and non-static enums exist and are
      available to the programmer via the inclusion or omission of the static
      modifier
      3) The extends clause is permitted on enum declarations
      4) The exact type which the enum extends may be specified by the programmer

      None of which are true to the best of my knowledge. Therefore I suggest
      that the standard doclet be changed such that:

      1) The static modifier is not shown, at least for top level enums.
      2) If RFE 5009540 is implemented as suggested, the extends clause should
      be omitted also, as this information would be present in the class
      hierarchy displayed at the top of the same page.

            jhosunw Jamie Ho (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: