Avoid unnecessary Annotation array cloning in TypeDescriptor
Closes gh-32476
This commit is contained in:
parent
521d4f24d0
commit
42a4f28962
|
@ -759,7 +759,7 @@ public class TypeDescriptor implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
|
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
|
||||||
for (Annotation annotation : getAnnotations()) {
|
for (Annotation annotation : this.annotations) {
|
||||||
if (annotation.annotationType() == annotationClass) {
|
if (annotation.annotationType() == annotationClass) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@ public class TypeDescriptor implements Serializable {
|
||||||
@Nullable
|
@Nullable
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
|
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
|
||||||
for (Annotation annotation : getAnnotations()) {
|
for (Annotation annotation : this.annotations) {
|
||||||
if (annotation.annotationType() == annotationClass) {
|
if (annotation.annotationType() == annotationClass) {
|
||||||
return (T) annotation;
|
return (T) annotation;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue