Avoid unnecessary setAccessible call in AttributeMethods
Closes gh-23829
This commit is contained in:
parent
422c26832b
commit
dba7bf7ec1
|
@ -25,6 +25,7 @@ import java.util.Map;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ConcurrentReferenceHashMap;
|
import org.springframework.util.ConcurrentReferenceHashMap;
|
||||||
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a quick way to access the attribute methods of an {@link Annotation}
|
* Provides a quick way to access the attribute methods of an {@link Annotation}
|
||||||
|
@ -73,15 +74,11 @@ final class AttributeMethods {
|
||||||
if (method.getDefaultValue() != null) {
|
if (method.getDefaultValue() != null) {
|
||||||
foundDefaultValueMethod = true;
|
foundDefaultValueMethod = true;
|
||||||
}
|
}
|
||||||
if (type.isAnnotation() ||
|
if (type.isAnnotation() || (type.isArray() && type.getComponentType().isAnnotation())) {
|
||||||
(type.isArray() && type.getComponentType().isAnnotation())) {
|
|
||||||
foundNestedAnnotation = true;
|
foundNestedAnnotation = true;
|
||||||
}
|
}
|
||||||
method.setAccessible(true);
|
ReflectionUtils.makeAccessible(method);
|
||||||
this.canThrowTypeNotPresentException[i] =
|
this.canThrowTypeNotPresentException[i] = (type == Class.class || type == Class[].class || type.isEnum());
|
||||||
type == Class.class ||
|
|
||||||
type == Class[].class ||
|
|
||||||
type.isEnum();
|
|
||||||
}
|
}
|
||||||
this.hasDefaultValueMethod = foundDefaultValueMethod;
|
this.hasDefaultValueMethod = foundDefaultValueMethod;
|
||||||
this.hasNestedAnnotation = foundNestedAnnotation;
|
this.hasNestedAnnotation = foundNestedAnnotation;
|
||||||
|
|
Loading…
Reference in New Issue