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

(cherry picked from commit 42a4f28)
  • Loading branch information
sbrannen committed Mar 18, 2024
1 parent d21100f commit f6205d4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,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 @@ -763,7 +763,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 f6205d4

Please sign in to comment.