diff options
author | Roel Spilker <r.spilker@gmail.com> | 2014-01-20 05:39:52 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2014-01-20 05:39:52 +0100 |
commit | ff0157486440f74c28f96e3708ed9e958086d65b (patch) | |
tree | 240b305db57da25b4e137fa6a458923946edf6bb /src | |
parent | e8059d4e9e4ada081363978df1ed937c2b782788 (diff) | |
download | lombok-ff0157486440f74c28f96e3708ed9e958086d65b.tar.gz lombok-ff0157486440f74c28f96e3708ed9e958086d65b.tar.bz2 lombok-ff0157486440f74c28f96e3708ed9e958086d65b.zip |
[configuration] Copy less lists during resolving
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/core/configuration/BubblingConfigurationResolver.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java index 3bcc331c..623c6cc0 100644 --- a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java +++ b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java @@ -40,16 +40,15 @@ public class BubblingConfigurationResolver implements ConfigurationResolver { @Override public <T> T resolve(ConfigurationKey<T> key) { boolean isList = key.getType().isList(); - List<ListModification> listModifications = null; + List<List<ListModification>> listModificationsList = null; for (ConfigurationSource source : sources) { Result result = source.resolve(key); if (result == null) continue; if (isList) { - if (listModifications == null) { - listModifications = new ArrayList<ListModification>((List<ListModification>)result.getValue()); - } else { - listModifications.addAll(0, (List<ListModification>)result.getValue()); + if (listModificationsList == null) { + listModificationsList = new ArrayList<List<ListModification>>(); } + listModificationsList.add((List<ListModification>)result.getValue()); } if (result.isAuthoritative()) { if (isList) { @@ -61,14 +60,17 @@ public class BubblingConfigurationResolver implements ConfigurationResolver { if (!isList) { return null; } - if (listModifications == null) { + if (listModificationsList == null) { return (T) Collections.emptyList(); } List<Object> listValues = new ArrayList<Object>(); - for (ListModification modification : listModifications) { - listValues.remove(modification.getValue()); - if (modification.isAdded()) { - listValues.add(modification.getValue()); + Collections.reverse(listModificationsList); + for (List<ListModification> listModifications : listModificationsList) { + for (ListModification modification : listModifications) { + listValues.remove(modification.getValue()); + if (modification.isAdded()) { + listValues.add(modification.getValue()); + } } } return (T) listValues; |