mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
ignore bridge
This commit is contained in:
parent
30515f0351
commit
99763a32b3
@ -24,6 +24,7 @@
|
|||||||
* 【core 】 DateUtil.toIntSecond标记为弃用(issue#I4JHPR@Gitee)
|
* 【core 】 DateUtil.toIntSecond标记为弃用(issue#I4JHPR@Gitee)
|
||||||
* 【db 】 Db.executeBatch标记一个重载为弃用(issue#I4JIPH@Gitee)
|
* 【db 】 Db.executeBatch标记一个重载为弃用(issue#I4JIPH@Gitee)
|
||||||
* 【core 】 增加CharSequenceUtil.subPreGbk重载(issue#I4JO2E@Gitee)
|
* 【core 】 增加CharSequenceUtil.subPreGbk重载(issue#I4JO2E@Gitee)
|
||||||
|
* 【core 】 ReflectUtil.getMethod排除桥接方法(pr#1965@Github)
|
||||||
*
|
*
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复FileResource构造fileName参数无效问题(issue#1942@Github)
|
* 【core 】 修复FileResource构造fileName参数无效问题(issue#1942@Github)
|
||||||
|
@ -2551,7 +2551,12 @@ public class CharSequenceUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 比较两个字符串是否相等。
|
* 比较两个字符串是否相等,规则如下
|
||||||
|
* <ul>
|
||||||
|
* <li>str1和str2都为{@code null}</li>
|
||||||
|
* <li>忽略大小写使用{@link String#equalsIgnoreCase(String)}判断相等</li>
|
||||||
|
* <li>不忽略大小写使用{@link String#contentEquals(CharSequence)}判断相等</li>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param str1 要比较的字符串1
|
* @param str1 要比较的字符串1
|
||||||
* @param str2 要比较的字符串2
|
* @param str2 要比较的字符串2
|
||||||
|
@ -84,7 +84,7 @@ public class ReflectUtil {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> Constructor<T>[] getConstructors(Class<T> beanClass) throws SecurityException {
|
public static <T> Constructor<T>[] getConstructors(Class<T> beanClass) throws SecurityException {
|
||||||
Assert.notNull(beanClass);
|
Assert.notNull(beanClass);
|
||||||
return (Constructor<T>[]) CONSTRUCTORS_CACHE.get(beanClass, ()->getConstructorsDirectly(beanClass));
|
return (Constructor<T>[]) CONSTRUCTORS_CACHE.get(beanClass, () -> getConstructorsDirectly(beanClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,7 +173,7 @@ public class ReflectUtil {
|
|||||||
*/
|
*/
|
||||||
public static Field[] getFields(Class<?> beanClass) throws SecurityException {
|
public static Field[] getFields(Class<?> beanClass) throws SecurityException {
|
||||||
Assert.notNull(beanClass);
|
Assert.notNull(beanClass);
|
||||||
return FIELDS_CACHE.get(beanClass, ()->getFieldsDirectly(beanClass, true));
|
return FIELDS_CACHE.get(beanClass, () -> getFieldsDirectly(beanClass, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -498,11 +498,9 @@ public class ReflectUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找指定方法 如果找不到对应的方法则返回{@code null}
|
* 查找指定方法 如果找不到对应的方法则返回{@code null}<br>
|
||||||
*
|
* 此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回{@code null}。<br>
|
||||||
* <p>
|
* 如果查找的方法有多个同参数类型重载,查找第一个找到的方法
|
||||||
* 此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回{@code null}。
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param clazz 类,如果为{@code null}返回{@code null}
|
* @param clazz 类,如果为{@code null}返回{@code null}
|
||||||
* @param ignoreCase 是否忽略大小写
|
* @param ignoreCase 是否忽略大小写
|
||||||
@ -520,10 +518,11 @@ public class ReflectUtil {
|
|||||||
final Method[] methods = getMethods(clazz);
|
final Method[] methods = getMethods(clazz);
|
||||||
if (ArrayUtil.isNotEmpty(methods)) {
|
if (ArrayUtil.isNotEmpty(methods)) {
|
||||||
for (Method method : methods) {
|
for (Method method : methods) {
|
||||||
if (StrUtil.equals(methodName, method.getName(), ignoreCase)) {
|
if (StrUtil.equals(methodName, method.getName(), ignoreCase)
|
||||||
if (ClassUtil.isAllAssignableFrom(method.getParameterTypes(), paramTypes)) {
|
&& ClassUtil.isAllAssignableFrom(method.getParameterTypes(), paramTypes)
|
||||||
return method;
|
//排除桥接方法,pr#1965@Github
|
||||||
}
|
&& false == method.isBridge()) {
|
||||||
|
return method;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -586,7 +585,9 @@ public class ReflectUtil {
|
|||||||
final Method[] methods = getMethods(clazz);
|
final Method[] methods = getMethods(clazz);
|
||||||
if (ArrayUtil.isNotEmpty(methods)) {
|
if (ArrayUtil.isNotEmpty(methods)) {
|
||||||
for (Method method : methods) {
|
for (Method method : methods) {
|
||||||
if (StrUtil.equals(methodName, method.getName(), ignoreCase)) {
|
if (StrUtil.equals(methodName, method.getName(), ignoreCase)
|
||||||
|
// 排除桥接方法
|
||||||
|
&& false == method.isBridge()) {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -635,7 +636,7 @@ public class ReflectUtil {
|
|||||||
*/
|
*/
|
||||||
public static Method[] getMethods(Class<?> beanClass) throws SecurityException {
|
public static Method[] getMethods(Class<?> beanClass) throws SecurityException {
|
||||||
Assert.notNull(beanClass);
|
Assert.notNull(beanClass);
|
||||||
return METHODS_CACHE.get(beanClass, ()-> getMethodsDirectly(beanClass, true));
|
return METHODS_CACHE.get(beanClass, () -> getMethodsDirectly(beanClass, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user