mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
#6256: Do not create new Set/Map
This commit is contained in:
parent
76c9d38f57
commit
f86529bbb9
2 changed files with 26 additions and 11 deletions
|
|
@ -112,11 +112,11 @@ public abstract class Watcher implements Serializable {
|
|||
|
||||
field.setAccessible(true);
|
||||
if (field.getType() == Set.class) {
|
||||
field.set(watcher, new HashSet<>());
|
||||
((Set) field.get(watcher)).clear();
|
||||
((Set) field.get(watcher)).addAll((Set) field.get(this));
|
||||
} else if (field.getType() == Map.class) {
|
||||
HashMap<Object, Object> target = new HashMap<>();
|
||||
field.set(watcher, target);
|
||||
Map target = ((Map) field.get(watcher));
|
||||
target.clear();
|
||||
Map source = (Map) field.get(this);
|
||||
|
||||
ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue