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

Annotation toString output for enum not reusable for source input

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • core-libs
    • None
    • behavioral
    • low
    • Programs parsing the output may need to be updated.
    • Java API
    • Implementation

      Summary

      Change the string output for annotations so that enum constants have their name method rather than their toString method called. Also, switch from using binary names to canonical names for class and interface names.

      Problem

      Using an enum constant's toString output isn't necessary the source-usable textual representation of the constant. For class and interface names, canonical names rather than binary names are used in source.

      Solution

      Change the implementation as summarized above. This also matches 'javac`'s behavior in the analagous cases.

      Specification

      No specification changes; the exact textual output is not specified, by design.

            darcy Joe Darcy
            sbrannen Sam Brannen
            Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: