Skip to content

Commit 42a4f28

Browse files
committed
Avoid unnecessary Annotation array cloning in TypeDescriptor
Closes gh-32476
1 parent 521d4f2 commit 42a4f28

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
@@ -759,7 +759,7 @@ private static AnnotatedElementAdapter from(@Nullable Annotation[] annotations)
759759

760760
@Override
761761
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
762-
for (Annotation annotation : getAnnotations()) {
762+
for (Annotation annotation : this.annotations) {
763763
if (annotation.annotationType() == annotationClass) {
764764
return true;
765765
}
@@ -771,7 +771,7 @@ public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
771771
@Nullable
772772
@SuppressWarnings("unchecked")
773773
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
774-
for (Annotation annotation : getAnnotations()) {
774+
for (Annotation annotation : this.annotations) {
775775
if (annotation.annotationType() == annotationClass) {
776776
return (T) annotation;
777777
}

0 commit comments

Comments
 (0)