RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v3]
Joe Darcy
darcy at openjdk.java.net
Fri Feb 11 20:42:09 UTC 2022
On Fri, 11 Feb 2022 20:34:43 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> 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
>
> Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>
> - Respond to more review feedback.
> - Merge branch 'master' into JDK-8281462
> - Respond to review feedback.
> - JDK-8281462: Annotation toString output for enum not reusable for source input
PS I checked and the implementation of printing annotation in javac for annotation processing uses enum constant names (rather than toString values) and uses canonical rather than binary names for nested types.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7418
More information about the core-libs-dev
mailing list