Skip to content

Commit

Permalink
fix: 修复反射工具类的获取非静态字段名列表,在调整为返回不可变列表后,导致 BaseServiceImpl 查询树列表报错的问题
Browse files Browse the repository at this point in the history
恢复反射工具类的获取非静态字段名列表返回结构
  • Loading branch information
Charles7c committed Jan 27, 2024
1 parent 868d731 commit ef0e99d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
* 反射工具类
Expand All @@ -44,7 +45,7 @@ private ReflectUtils() {
*/
public static List<String> getNonStaticFieldsName(Class<?> beanClass) throws SecurityException {
List<Field> nonStaticFields = getNonStaticFields(beanClass);
return nonStaticFields.stream().map(Field::getName).toList();
return nonStaticFields.stream().map(Field::getName).collect(Collectors.toList());
}

/**
Expand All @@ -57,6 +58,6 @@ public static List<String> getNonStaticFieldsName(Class<?> beanClass) throws Sec
*/
public static List<Field> getNonStaticFields(Class<?> beanClass) throws SecurityException {
Field[] fields = ReflectUtil.getFields(beanClass);
return Arrays.stream(fields).filter(f -> !Modifier.isStatic(f.getModifiers())).toList();
return Arrays.stream(fields).filter(f -> !Modifier.isStatic(f.getModifiers())).collect(Collectors.toList());
}
}

0 comments on commit ef0e99d

Please sign in to comment.