mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
针对issue#I4WUWR修复
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user