Skip to content

Commit

Permalink
Align plain accessor check
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Apr 12, 2022
1 parent 3b4ae7b commit 949c3d4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ private void introspectPlainAccessors(Class<?> beanClass, Set<String> readMethod

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());
Expand All @@ -376,8 +376,11 @@ private void introspectPlainAccessors(Class<?> beanClass, Set<String> readMethod
}

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 {
Expand Down

0 comments on commit 949c3d4

Please sign in to comment.