RFR: JDK-8281462: Annotation toString output for enum not reusable for source input

Joe Darcy darcy at openjdk.java.net
Thu Feb 10 05:57:21 UTC 2022


Two changes to the toString output for annotations to give better source fidelity:

1) For enum constants, call their name method rather than their toString method. An enum class can override the toString method to print something other than the name.

2) Switch from using binary names (names with "$" for nested types) to canonical names (names with "." with nested types)

Various existing regression tests are updated to accommodate the changes.

Please also review the CSR:
https://bugs.openjdk.java.net/browse/JDK-8281568

-------------

Commit messages:
 - JDK-8281462: Annotation toString output for enum not reusable for source input

Changes: https://git.openjdk.java.net/jdk/pull/7418/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7418&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8281462
  Stats: 76 lines in 8 files changed: 29 ins; 0 del; 47 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7418.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7418/head:pull/7418

PR: https://git.openjdk.java.net/jdk/pull/7418


More information about the core-libs-dev mailing list