Skip to content

Commit 2b56ca0

Browse files
committed
Restore canonical name representation for 6.2
See gh-32405
1 parent b89cf2b commit 2b56ca0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ public int hashCode() {
545545
public String toString() {
546546
StringBuilder builder = new StringBuilder();
547547
for (Annotation ann : getAnnotations()) {
548-
builder.append('@').append(ann.annotationType().getName()).append(' ');
548+
builder.append('@').append(getName(ann.annotationType())).append(' ');
549549
}
550550
builder.append(getResolvableType());
551551
return builder.toString();
@@ -733,6 +733,11 @@ public static TypeDescriptor nested(Property property, int nestingLevel) {
733733
return new TypeDescriptor(property).nested(nestingLevel);
734734
}
735735

736+
private static String getName(Class<?> clazz) {
737+
String canonicalName = clazz.getCanonicalName();
738+
return (canonicalName != null ? canonicalName : clazz.getName());
739+
}
740+
736741

737742
/**
738743
* Adapter class for exposing a {@code TypeDescriptor}'s annotations as an

0 commit comments

Comments
 (0)