show warning when registry value requested before Registry is initialized

GitOrigin-RevId: c162d876ff9967bb6772ed2ebd16f87b1027a9e1
This commit is contained in:
Konstantin Bulenkov
2020-01-07 10:21:21 +01:00
committed by intellij-monorepo-bot
parent 4591f890b2
commit 12924fa8e7
2 changed files with 11 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ public final class Registry {
private final THashMap<String, RegistryKeyDescriptor> myContributedKeys = new THashMap<>();
private static final Registry ourInstance = new Registry();
private volatile boolean myLoaded = false;
@NotNull
public static RegistryValue get(@NotNull String key) {
@@ -151,6 +152,11 @@ public final class Registry {
}
}
}
myLoaded = true;
}
public boolean isLoaded() {
return myLoaded;
}
@NotNull

View File

@@ -170,6 +170,11 @@ public class RegistryValue {
if (systemProperty != null) {
return systemProperty;
}
if (!myRegistry.isLoaded()) {
LOG.warn("The registry key '" + key + "' accessed, but not loaded yet");
}
final String bundleValue = Registry.getInstance().getBundleValue(key, mustExistInBundle);
if (bundleValue != null) {
return bundleValue;