提交 dba7bf7e 编写于 作者: J Juergen Hoeller

Avoid unnecessary setAccessible call in AttributeMethods

Closes gh-23829
上级 422c2683
......@@ -25,6 +25,7 @@ import java.util.Map;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ConcurrentReferenceHashMap;
import org.springframework.util.ReflectionUtils;
/**
* Provides a quick way to access the attribute methods of an {@link Annotation}
......@@ -73,15 +74,11 @@ final class AttributeMethods {
if (method.getDefaultValue() != null) {
foundDefaultValueMethod = true;
}
if (type.isAnnotation() ||
(type.isArray() && type.getComponentType().isAnnotation())) {
if (type.isAnnotation() || (type.isArray() && type.getComponentType().isAnnotation())) {
foundNestedAnnotation = true;
}
method.setAccessible(true);
this.canThrowTypeNotPresentException[i] =
type == Class.class ||
type == Class[].class ||
type.isEnum();
ReflectionUtils.makeAccessible(method);
this.canThrowTypeNotPresentException[i] = (type == Class.class || type == Class[].class || type.isEnum());
}
this.hasDefaultValueMethod = foundDefaultValueMethod;
this.hasNestedAnnotation = foundNestedAnnotation;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册