performance: improved CPU/memory usage with copy of cost's targets (related to #11285), added runtime check for wrong targets usage

This commit is contained in:
Oleg Agafonov 2023-11-07 02:47:48 +04:00
parent d6c858ecaf
commit ddc1ec8ef8
32 changed files with 173 additions and 107 deletions

View file

@ -914,7 +914,7 @@ public abstract class AbilityImpl implements Ability {
if (getModes().getMode() != null) {
return getModes().getMode().getTargets();
}
return new Targets();
return new Targets().withReadOnly();
}
@Override
@ -926,7 +926,7 @@ public abstract class AbilityImpl implements Ability {
res.addAll(mode.getTargets());
}
}
return res;
return res.withReadOnly();
}
@Override