Skip to content

Commit f6205d4

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

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

752752
@Override
753753
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
754-
for (Annotation annotation : getAnnotations()) {
754+
for (Annotation annotation : this.annotations) {
755755
if (annotation.annotationType() == annotationClass) {
756756
return true;
757757
}
@@ -763,7 +763,7 @@ public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
763763
@Nullable
764764
@SuppressWarnings("unchecked")
765765
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
766-
for (Annotation annotation : getAnnotations()) {
766+
for (Annotation annotation : this.annotations) {
767767
if (annotation.annotationType() == annotationClass) {
768768
return (T) annotation;
769769
}

0 commit comments

Comments
 (0)