JDK-8281568 : Annotation toString output for enum not reusable for source input
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 19
  • Submitted: 2022-02-10
  • Updated: 2022-02-12
  • Resolved: 2022-02-11
Related Reports
CSR :  
Description
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.


Comments
Moving to Approved.
11-02-2022