mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
修复JsonUtil.toBean
泛型数组类型丢失问题(pr#3876@Github)
This commit is contained in:
parent
1c3e8634c8
commit
2046809264
@ -59,6 +59,14 @@ public class ActualTypeMapperPool {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得泛型变量对应的泛型实际类型,如果此变量没有对应的实际类型,返回null
|
||||
*
|
||||
* @param type 类
|
||||
* @param genericArrayType 泛型数组类型
|
||||
* @return 实际类型,可能为Class等
|
||||
* @since 5.8.37
|
||||
*/
|
||||
public static Type getActualType(Type type, GenericArrayType genericArrayType) {
|
||||
final Map<Type, Type> typeTypeMap = get(type);
|
||||
Type actualType = typeTypeMap.get(genericArrayType);
|
||||
|
@ -408,7 +408,11 @@ public class TypeUtil {
|
||||
return ActualTypeMapperPool.getActualType(type, (TypeVariable<?>) typeVariable);
|
||||
}
|
||||
if (typeVariable instanceof GenericArrayType) {
|
||||
return ActualTypeMapperPool.getActualType(type, (GenericArrayType) typeVariable);
|
||||
//return ActualTypeMapperPool.getActualType(type, (GenericArrayType) typeVariable);
|
||||
final Type actualType = ActualTypeMapperPool.getActualType(type, (GenericArrayType) typeVariable);
|
||||
if(null != actualType){
|
||||
return actualType;
|
||||
}
|
||||
}
|
||||
|
||||
// 没有需要替换的泛型变量,原样输出
|
||||
|
Loading…
x
Reference in New Issue
Block a user