diff options
-rw-r--r-- | src/core/lombok/core/configuration/ConfigurationKeysLoader.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/lombok/core/configuration/ConfigurationKeysLoader.java b/src/core/lombok/core/configuration/ConfigurationKeysLoader.java index 7fdbb4da..4e6e4fb1 100644 --- a/src/core/lombok/core/configuration/ConfigurationKeysLoader.java +++ b/src/core/lombok/core/configuration/ConfigurationKeysLoader.java @@ -23,18 +23,23 @@ package lombok.core.configuration; import java.io.IOException; import java.util.Iterator; +import java.util.concurrent.atomic.AtomicBoolean; import lombok.ConfigurationKeys; import lombok.core.SpiLoadUtil; public interface ConfigurationKeysLoader { public class LoaderLoader { + private static final AtomicBoolean alreadyLoaded = new AtomicBoolean(false); private LoaderLoader() {} public static void loadAllConfigurationKeys() { + if (alreadyLoaded.get()) return; + try { Class.forName(ConfigurationKeys.class.getName()); } catch (Throwable ignore) {} + try { Iterator<ConfigurationKeysLoader> iterator = SpiLoadUtil.findServices(ConfigurationKeysLoader.class, ConfigurationKeysLoader.class.getClassLoader()).iterator(); while (iterator.hasNext()) { @@ -44,6 +49,8 @@ public interface ConfigurationKeysLoader { } } catch (IOException e) { throw new RuntimeException("Can't load config keys; services file issue.", e); + } finally { + alreadyLoaded.set(true); } } } |