mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
7139a877f4
Since the introduction of synthesized annotation support in Spring Framework 4.2 (a.k.a., merged annotations), the toString() implementation attempted to align with the formatting used by the JDK itself. However, Class annotation attributes were formatted using Class#getName in Spring; whereas, the JDK used Class#toString up until JDK 9. In addition, JDK 9 introduced new formatting for toString() for annotations, apparently intended to align with the syntax used in the source code declaration of the annotation. However, JDK 9+ formats enum annotation attributes using Enum#toString instead of Enum#name, which can lead to issues if toString() is overridden in an enum. This commit updates the formatting used for synthesized annotations by ensuring that toString() generates a string that is compatible with the syntax of the originating source code, going beyond the changes made in JDK 9 by using Enum#name instead of Enum#toString. Closes gh-28015