From 949c3d450c35b676b82a4a56ada997cf9a552f1d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 13 Apr 2022 00:24:06 +0200 Subject: [PATCH] Align plain accessor check --- .../beans/CachedIntrospectionResults.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java index 2929509d234..8332045197d 100644 --- a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java +++ b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java @@ -367,7 +367,7 @@ public final class CachedIntrospectionResults { for (Method method : beanClass.getMethods()) { if (!this.propertyDescriptors.containsKey(method.getName()) && - !readMethodNames.contains((method.getName())) && isPlainAccessor(method)) { + !readMethodNames.contains(method.getName()) && isPlainAccessor(method)) { this.propertyDescriptors.put(method.getName(), new GenericTypeAwarePropertyDescriptor(beanClass, method.getName(), method, null, null)); readMethodNames.add(method.getName()); @@ -376,8 +376,11 @@ public final class CachedIntrospectionResults { } private boolean isPlainAccessor(Method method) { - if (method.getParameterCount() > 0 || method.getReturnType() == void.class || - method.getDeclaringClass() == Object.class || Modifier.isStatic(method.getModifiers())) { + if (Modifier.isStatic(method.getModifiers()) || + method.getDeclaringClass() == Object.class || method.getDeclaringClass() == Class.class || + method.getParameterCount() > 0 || method.getReturnType() == void.class || + ClassLoader.class.isAssignableFrom(method.getReturnType()) || + ProtectionDomain.class.isAssignableFrom(method.getReturnType())) { return false; } try {