针对issue#I4WUWR修复

This commit is contained in:
jiazhengquan
2022-03-09 11:25:52 +08:00
parent 2cfb33af9e
commit 1aeb56564f

View File

@@ -663,34 +663,34 @@ public class ReflectUtil {
Assert.notNull(beanClass);
Method[] allMethods = null;
Class<?>[] searchInterfaces = null, parentInterfaces = null;
Class<?> searchType = beanClass;
Class<?>[] tempInterfaceType, interfaceType;
Method[] declaredMethods;
while (searchType != null || searchInterfaces != null) {
if (searchType != null) {
if (searchType.isInterface()) {
allMethods = searchType.getDeclaredMethods();
interfaceType = searchType.getInterfaces();
while (ArrayUtil.isNotEmpty(interfaceType)) {
tempInterfaceType = interfaceType;
for (int i = 0; i < tempInterfaceType.length; i++) {
Class<?> temp = tempInterfaceType[i];
allMethods = ArrayUtil.append(allMethods, temp.getDeclaredMethods());
if (i == 0 || ArrayUtil.isEmpty(interfaceType)) {
interfaceType = temp.getInterfaces();
} else {
interfaceType = ArrayUtil.append(interfaceType, temp.getInterfaces());
}
}
}
} else {
while (searchType != null) {
declaredMethods = searchType.getDeclaredMethods();
if (null == allMethods) {
allMethods = declaredMethods;
} else {
allMethods = ArrayUtil.append(allMethods, declaredMethods);
}
Class<?>[] interfaces = searchType.getInterfaces();
for (Class<?> element : interfaces) {
allMethods = ArrayUtil.append(allMethods, element.getDeclaredMethods());
parentInterfaces = ArrayUtil.addAll(element.getInterfaces());
}
searchInterfaces = parentInterfaces;
Class<?>[] classes = searchInterfaces.length == 0 ? null : searchInterfaces;
searchInterfaces = withSuperClassMethods ? classes : null;
searchType = withSuperClassMethods ? searchType.getSuperclass() : null;
}
if (searchInterfaces != null) {
for (Class<?> searchInterface : searchInterfaces) {
allMethods = ArrayUtil.append(allMethods, searchInterface.getDeclaredMethods());
parentInterfaces = ArrayUtil.addAll(searchInterface.getInterfaces());
}
searchInterfaces = parentInterfaces.length == 0 ? null : parentInterfaces;
}
}
return allMethods;
}