EnumConverter变更规则,当用户自定义方法返回null时,调用默认valueOf(pr#4258@Github)

This commit is contained in:
Looly
2026-05-27 09:15:43 +08:00
parent 9e6cccaf08
commit 3a8ee86f3b
2 changed files with 3 additions and 1 deletions

View File

@@ -1,8 +1,9 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.47(2026-05-25)
# 5.8.47(2026-05-27)
### 🐣新特性
* 【core 】 `EnumConverter`变更规则当用户自定义方法返回null时调用默认valueOfpr#4258@Github
### 🐞Bug修复
# 5.8.46(2026-05-25)

View File

@@ -97,6 +97,7 @@ public class EnumConverter extends AbstractConverter<Object> {
for (Map.Entry<Class<?>, Method> entry : methodMap.entrySet()) {
if (ClassUtil.isAssignable(entry.getKey(), valueClass)) {
final Object result = ReflectUtil.invokeStatic(entry.getValue(), value);
// issue#4257 执行结果返回空时尝试使用valueOf方法转换
if (null != result) {
return (Enum) result;
}