Skip to content

Commit ed6c25f

Browse files
committed
Avoid unnecessary Annotation array cloning in TypeDescriptor
Closes gh-32476 (cherry picked from commit 42a4f28)
1 parent 8460a2d commit ed6c25f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ private static AnnotatedElementAdapter from(@Nullable Annotation[] annotations)
750750

751751
@Override
752752
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
753-
for (Annotation annotation : getAnnotations()) {
753+
for (Annotation annotation : this.annotations) {
754754
if (annotation.annotationType() == annotationClass) {
755755
return true;
756756
}
@@ -762,7 +762,7 @@ public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
762762
@Nullable
763763
@SuppressWarnings("unchecked")
764764
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
765-
for (Annotation annotation : getAnnotations()) {
765+
for (Annotation annotation : this.annotations) {
766766
if (annotation.annotationType() == annotationClass) {
767767
return (T) annotation;
768768
}

0 commit comments

Comments
 (0)