Skip to content

Commit 9e21d2f

Browse files
committed
TypeDescriptor equals implementation accepts annotations in any order (SPR-9084)
1 parent 9470323 commit 9e21d2f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,12 @@ public boolean equals(Object obj) {
547547
if (!ObjectUtils.nullSafeEquals(getType(), other.getType())) {
548548
return false;
549549
}
550-
Annotation[] ann = getAnnotations();
551-
Annotation[] otherAnn = other.getAnnotations();
552-
if (ann.length != otherAnn.length) {
550+
Annotation[] annotations = getAnnotations();
551+
if (annotations.length != other.getAnnotations().length) {
553552
return false;
554553
}
555-
for (int i = 0; i < ann.length; i++) {
556-
if (!ann[i].annotationType().equals(otherAnn[i].annotationType())) {
554+
for (Annotation ann : annotations) {
555+
if (other.getAnnotation(ann.annotationType()) == null) {
557556
return false;
558557
}
559558
}

0 commit comments

Comments
 (0)