|
@@ -25,7 +25,6 @@ import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
import static java.util.function.Function.identity;
|
|
|
-import static java.util.stream.Collectors.toCollection;
|
|
|
import static java.util.stream.Collectors.toMap;
|
|
|
|
|
|
/**
|
|
@@ -232,7 +231,11 @@ public class ReflectionKit {
|
|
|
*/
|
|
|
public static Map<String, Field> excludeOverrideSuperField(Field[] fields, List<Field> superFieldList) {
|
|
|
// 子类属性
|
|
|
- Map<String, Field> fieldMap = Stream.of(fields).collect(toMap(Field::getName, identity()));
|
|
|
+ Map<String, Field> fieldMap = Stream.of(fields).collect(toMap(Field::getName, identity(),
|
|
|
+ (u, v) -> {
|
|
|
+ throw new IllegalStateException(String.format("Duplicate key %s", u));
|
|
|
+ },
|
|
|
+ LinkedHashMap::new));
|
|
|
superFieldList.stream().filter(field -> !fieldMap.containsKey(field.getName()))
|
|
|
.forEach(f -> fieldMap.put(f.getName(), f));
|
|
|
return fieldMap;
|