diff --git a/CHANGELOG.md b/CHANGELOG.md
index 075c4607e..7855bc953 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@
-------------------------------------------------------------------------------------------------------------
-# 5.4.2 (2020-09-03)
+# 5.4.2 (2020-09-05)
### 新特性
* 【core 】 lock放在try外边(pr#1050@Github)
@@ -14,11 +14,13 @@
* 【poi 】 RowUtil增加插入和删除行(pr#1060@Github)
* 【extra 】 SpringUtil增加注册bean(pr#174@Gitee)
* 【core 】 修改NetUtil.getMacAddress避免空指针(issue#1057@Github)
-* 【core 】 增加EnumItem接口,枚举扩展转换,增加SPI自定义转换(pr#173@Gitee)
+* 【core 】 增加EnumItem接口,枚举扩展转换,增加SPI自定义转换(pr#173@Github)
+* 【core 】 TypeUtil增加getActualTypeMap方法
-### Bug修复#
+### Bug修复
* 【core 】 重新整理农历节假日,解决一个pr过来的玩笑导致的问题
* 【poi 】 修复ExcelFileUtil.isXls判断问题(pr#1055@Github)
+* 【poi 】 修复CglibUtil.copyList参数错误导致的问题
-------------------------------------------------------------------------------------------------------------
@@ -40,7 +42,6 @@
* 【core 】 EnumUtil.getEnumAt负数返回null(pr#167@Gitee)
* 【core 】 ChineseDate增加天干地支和转换为公历方法(pr#169@Gitee)
* 【core 】 Img增加stroke描边方法(issue#1033@Github)
-* 【core 】 TypeUtil增加getActualTypeMap方法
### Bug修复#
* 【poi 】 修复ExcelBase.isXlsx方法判断问题(issue#I1S502@Gitee)
diff --git a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java
index 4ba886fff..eadf66cbf 100644
--- a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java
+++ b/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java
@@ -12,12 +12,12 @@ import java.lang.reflect.WildcardType;
/**
* 针对 {@link Type} 的工具类封装
* 最主要功能包括:
- *
+ *
*
* 1. 获取方法的参数和返回值类型(包括Type和Class) * 2. 获取泛型参数类型(包括对象的泛型参数或集合元素的泛型类型) *- * + * * @author Looly * @since 3.0.8 */ @@ -25,7 +25,7 @@ public class TypeUtil { /** * 获得Type对应的原始类 - * + * * @param type {@link Type} * @return 原始类,如果无法获取原始类,返回{@code null} */ @@ -50,7 +50,7 @@ public class TypeUtil { /** * 获取字段对应的Type类型
* class A<T> * class B extends A<String> *- * + *
* 通过此方法,传入B.class即可得到String
- *
+ *
* @param type 指定类型
* @return 所有泛型参数类型
*/
@@ -235,14 +249,14 @@ public class TypeUtil {
* 将{@link Type} 转换为{@link ParameterizedType}
* {@link ParameterizedType}用于获取当前类或父类中泛型参数化后的类型
* 一般用于获取泛型参数具体的参数类型,例如:
- *
+ *
*
* class A<T> * class B extends A<String> *- * + *
* 通过此方法,传入B.class即可得到B{@link ParameterizedType},从而获取到String
- *
+ *
* @param type {@link Type}
* @return {@link ParameterizedType}
* @since 4.5.2
@@ -254,10 +268,10 @@ public class TypeUtil {
} else if (type instanceof Class) {
final Class> clazz = (Class>) type;
Type genericSuper = clazz.getGenericSuperclass();
- if(null == genericSuper || Object.class.equals(genericSuper)){
+ if (null == genericSuper || Object.class.equals(genericSuper)) {
// 如果类没有父类,而是实现一些定义好的泛型接口,则取接口的Type
final Type[] genericInterfaces = clazz.getGenericInterfaces();
- if(ArrayUtil.isNotEmpty(genericInterfaces)){
+ if (ArrayUtil.isNotEmpty(genericInterfaces)) {
// 默认取第一个实现接口的泛型Type
genericSuper = genericInterfaces[0];
}
@@ -276,8 +290,7 @@ public class TypeUtil {
* 1. typeDefineClass必须是clazz的父类或者clazz实现的接口
*
*
- *
- * @param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型
+ * @param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型
* @param typeDefineClass 泛型变量声明所在类或接口,此类中定义了泛型类型
* @return 给定泛型参数对应的实际类型,如果无对应类型,返回null
* @since 5.4.1
@@ -289,32 +302,31 @@ public class TypeUtil {
// 泛型参数标识符列表
final TypeVariable>[] typeVars = typeDefineClass.getTypeParameters();
- if(ArrayUtil.isEmpty(typeVars)) {
+ if (ArrayUtil.isEmpty(typeVars)) {
return new TableMap<>(0);
}
// 实际类型列表
final Type[] actualTypeArguments = TypeUtil.getTypeArguments(actualType);
- if(ArrayUtil.isEmpty(actualTypeArguments)) {
+ if (ArrayUtil.isEmpty(actualTypeArguments)) {
return new TableMap<>(0);
}
return new TableMap<>(typeVars, actualTypeArguments);
}
-
+
/**
* 获取指定泛型变量对应的真实类型
* 由于子类中泛型参数实现和父类(接口)中泛型定义位置是一一对应的,因此可以通过对应关系找到泛型实现类型
* 使用此方法注意:
- *
+ *
*
* 1. superClass必须是clazz的父类或者clazz实现的接口 * 2. typeVariable必须在superClass中声明 *- * - * - * @param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型 + * + * @param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型 * @param typeDefineClass 泛型变量声明所在类或接口,此类中定义了泛型类型 - * @param typeVariables 泛型变量,需要的实际类型对应的泛型参数 + * @param typeVariables 泛型变量,需要的实际类型对应的泛型参数 * @return 给定泛型参数对应的实际类型,如果无对应类型,返回null * @since 4.5.7 */ @@ -323,33 +335,32 @@ public class TypeUtil { // 查找方法定义所在类或接口中此泛型参数的位置 final Type[] result = new Type[typeVariables.length]; - for(int i = 0; i < typeVariables.length; i++) { + for (int i = 0; i < typeVariables.length; i++) { //noinspection SuspiciousMethodCalls result[i] = (typeVariables[i] instanceof TypeVariable) ? tableMap.get(typeVariables[i]) : typeVariables[i]; } return result; } - + /** * 获取指定泛型变量对应的真实类型
* 1. superClass必须是clazz的父类或者clazz实现的接口 * 2. typeVariable必须在superClass中声明 *- * - * - * @param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型 + * + * @param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型 * @param typeDefineClass 泛型变量声明所在类或接口,此类中定义了泛型类型 - * @param typeVariable 泛型变量,需要的实际类型对应的泛型参数 + * @param typeVariable 泛型变量,需要的实际类型对应的泛型参数 * @return 给定泛型参数对应的实际类型 * @since 4.5.2 */ public static Type getActualType(Type actualType, Class> typeDefineClass, Type typeVariable) { Type[] types = getActualTypes(actualType, typeDefineClass, typeVariable); - if(ArrayUtil.isNotEmpty(types)) { + if (ArrayUtil.isNotEmpty(types)) { return types[0]; } return null; @@ -358,7 +369,7 @@ public class TypeUtil { /** * 是否未知类型