mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix bug
This commit is contained in:
parent
fbb97f0c9a
commit
27d67c4d84
@ -166,8 +166,12 @@ public class PropDesc {
|
|||||||
*/
|
*/
|
||||||
public Object getValue(final Object bean) {
|
public Object getValue(final Object bean) {
|
||||||
if (null != this.getter) {
|
if (null != this.getter) {
|
||||||
//return MethodUtil.invoke(bean, this.getter);
|
try{
|
||||||
return LambdaUtil.buildGetter(this.getter).apply(bean);
|
return LambdaUtil.buildGetter(this.getter).apply(bean);
|
||||||
|
} catch (final Exception ignore){
|
||||||
|
// issue#I96JIP,在jdk14+多模块项目中,存在权限问题,使用传统反射
|
||||||
|
return MethodUtil.invoke(bean, this.getter);
|
||||||
|
}
|
||||||
} else if (ModifierUtil.isPublic(this.field)) {
|
} else if (ModifierUtil.isPublic(this.field)) {
|
||||||
return FieldUtil.getFieldValue(bean, this.field);
|
return FieldUtil.getFieldValue(bean, this.field);
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,8 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 以类似反射的方式动态创建Lambda,在性能上有一定优势,同时避免每次调用Lambda时创建匿名内部类
|
* 以类似反射的方式动态创建Lambda,在性能上有一定优势,同时避免每次调用Lambda时创建匿名内部类
|
||||||
* TODO JDK9+存在兼容问题,当参数为原始类型时报错
|
|
||||||
*
|
*
|
||||||
* @author nasodaengineer
|
* @author nasodaengineer
|
||||||
*/
|
*/
|
||||||
public class LambdaFactory {
|
public class LambdaFactory {
|
||||||
|
|
||||||
@ -108,6 +107,10 @@ public class LambdaFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过Lambda函数代理方法或构造
|
* 通过Lambda函数代理方法或构造
|
||||||
|
* <p>
|
||||||
|
* TODO 在多模块项目中,使用module-info.java声明的模块项目,使用此方法获取的Lookup对象存在权限不足问题<br>
|
||||||
|
* 见:https://gitee.com/dromara/hutool/issues/I96JIP
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param funcType 函数类型
|
* @param funcType 函数类型
|
||||||
* @param funcMethod 函数执行的方法
|
* @param funcMethod 函数执行的方法
|
||||||
|
Loading…
x
Reference in New Issue
Block a user