diff options
author | Roel Spilker <r.spilker@gmail.com> | 2014-01-19 02:25:23 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2014-01-19 02:25:23 +0100 |
commit | 2f0d7614d47d0828eeefcce727f02826fdb9f80b (patch) | |
tree | 306dbafc59d35d7cf1ae1bd39c2933a5ea33e4ac | |
parent | 34152213226d6407fd922127408a1a44456fe657 (diff) | |
download | lombok-2f0d7614d47d0828eeefcce727f02826fdb9f80b.tar.gz lombok-2f0d7614d47d0828eeefcce727f02826fdb9f80b.tar.bz2 lombok-2f0d7614d47d0828eeefcce727f02826fdb9f80b.zip |
[configuration] Move the responsibility to stop bubbling to the iterator
-rw-r--r-- | src/core/lombok/core/configuration/BubblingConfigurationResolver.java | 4 | ||||
-rw-r--r-- | src/core/lombok/core/configuration/FileSystemSourceCache.java | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java index 2e7a76dc..3bcc331c 100644 --- a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java +++ b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java @@ -30,8 +30,6 @@ import lombok.core.configuration.ConfigurationSource.Result; public class BubblingConfigurationResolver implements ConfigurationResolver { - private static final ConfigurationKey<Boolean> STOP_BUBBLING = new ConfigurationKey<Boolean>("stop-bubbling") {}; - private final Iterable<ConfigurationSource> sources; public BubblingConfigurationResolver(Iterable<ConfigurationSource> sources) { @@ -59,8 +57,6 @@ public class BubblingConfigurationResolver implements ConfigurationResolver { } return (T) result.getValue(); } - Result stop = source.resolve(STOP_BUBBLING); - if (stop != null && Boolean.TRUE.equals(stop.getValue())) break; } if (!isList) { return null; diff --git a/src/core/lombok/core/configuration/FileSystemSourceCache.java b/src/core/lombok/core/configuration/FileSystemSourceCache.java index 3c51fbff..61e060ed 100644 --- a/src/core/lombok/core/configuration/FileSystemSourceCache.java +++ b/src/core/lombok/core/configuration/FileSystemSourceCache.java @@ -32,6 +32,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; +import lombok.ConfigurationKeys; +import lombok.core.configuration.ConfigurationSource.Result; + public class FileSystemSourceCache { private static String LOMBOK_CONFIG_FILENAME = "lombok.config"; @@ -49,10 +52,12 @@ public class FileSystemSourceCache { return new Iterator<ConfigurationSource>() { File currentDirectory = directory; ConfigurationSource next; + boolean stopBubbling = false; @Override public boolean hasNext() { if (next != null) return true; + if (stopBubbling) return false; next = findNext(); return next != null; } @@ -70,6 +75,10 @@ public class FileSystemSourceCache { next = getSourceForDirectory(currentDirectory, reporterFactory); currentDirectory = currentDirectory.getParentFile(); } + if (next != null) { + Result stop = next.resolve(ConfigurationKeys.STOP_BUBBLING); + stopBubbling = (stop != null && Boolean.TRUE.equals(stop.getValue())); + } return next; } |