Restore canonical name representation for 6.2

See gh-32405
This commit is contained in:
Juergen Hoeller
2024-03-17 21:03:02 +01:00
parent b89cf2b16a
commit 2b56ca08d4

View File

@@ -545,7 +545,7 @@ public class TypeDescriptor implements Serializable {
public String toString() {
StringBuilder builder = new StringBuilder();
for (Annotation ann : getAnnotations()) {
builder.append('@').append(ann.annotationType().getName()).append(' ');
builder.append('@').append(getName(ann.annotationType())).append(' ');
}
builder.append(getResolvableType());
return builder.toString();
@@ -733,6 +733,11 @@ public class TypeDescriptor implements Serializable {
return new TypeDescriptor(property).nested(nestingLevel);
}
private static String getName(Class<?> clazz) {
String canonicalName = clazz.getCanonicalName();
return (canonicalName != null ? canonicalName : clazz.getName());
}
/**
* Adapter class for exposing a {@code TypeDescriptor}'s annotations as an