Skip to content

Commit 949c3d4

Browse files
committed
Align plain accessor check
1 parent 3b4ae7b commit 949c3d4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ private void introspectPlainAccessors(Class<?> beanClass, Set<String> readMethod
367367

368368
for (Method method : beanClass.getMethods()) {
369369
if (!this.propertyDescriptors.containsKey(method.getName()) &&
370-
!readMethodNames.contains((method.getName())) && isPlainAccessor(method)) {
370+
!readMethodNames.contains(method.getName()) && isPlainAccessor(method)) {
371371
this.propertyDescriptors.put(method.getName(),
372372
new GenericTypeAwarePropertyDescriptor(beanClass, method.getName(), method, null, null));
373373
readMethodNames.add(method.getName());
@@ -376,8 +376,11 @@ private void introspectPlainAccessors(Class<?> beanClass, Set<String> readMethod
376376
}
377377

378378
private boolean isPlainAccessor(Method method) {
379-
if (method.getParameterCount() > 0 || method.getReturnType() == void.class ||
380-
method.getDeclaringClass() == Object.class || Modifier.isStatic(method.getModifiers())) {
379+
if (Modifier.isStatic(method.getModifiers()) ||
380+
method.getDeclaringClass() == Object.class || method.getDeclaringClass() == Class.class ||
381+
method.getParameterCount() > 0 || method.getReturnType() == void.class ||
382+
ClassLoader.class.isAssignableFrom(method.getReturnType()) ||
383+
ProtectionDomain.class.isAssignableFrom(method.getReturnType())) {
381384
return false;
382385
}
383386
try {

0 commit comments

Comments
 (0)