Skip to content

Commit

Permalink
Avoid unnecessary Annotation array cloning in TypeDescriptor
Browse files Browse the repository at this point in the history
Closes gh-32476
  • Loading branch information
sbrannen committed Mar 18, 2024
1 parent 521d4f2 commit 42a4f28
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ private static AnnotatedElementAdapter from(@Nullable Annotation[] annotations)

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
for (Annotation annotation : getAnnotations()) {
for (Annotation annotation : this.annotations) {
if (annotation.annotationType() == annotationClass) {
return true;
}
Expand All @@ -771,7 +771,7 @@ public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
@Nullable
@SuppressWarnings("unchecked")
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
for (Annotation annotation : getAnnotations()) {
for (Annotation annotation : this.annotations) {
if (annotation.annotationType() == annotationClass) {
return (T) annotation;
}
Expand Down

0 comments on commit 42a4f28

Please sign in to comment.