OnStartStop: Remove unused config member variable The config is not actually used. It's only injected in the OnStartStop lifecycle listener so that the config is loaded at startup rather than when it's first needed. Remove the unused member variable and its initialisation in the class's constructor, suppress the 'unused' warning on the constructor argument, and expand the comment in the constructor to explain why the config is unused. Change-Id: I24cf032d1183ae46294670605dffb87211f6aca9
diff --git a/src/main/java/com/googlesource/gerrit/plugins/motd/OnStartStop.java b/src/main/java/com/googlesource/gerrit/plugins/motd/OnStartStop.java index 8581180..f4c354b 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/motd/OnStartStop.java +++ b/src/main/java/com/googlesource/gerrit/plugins/motd/OnStartStop.java
@@ -18,21 +18,21 @@ import com.google.inject.Inject; class OnStartStop implements LifecycleListener { - private final MotdConfig config; - @Inject - OnStartStop(MotdConfig config) { - // Set up a config so we load the config at startup. - this.config = config; + OnStartStop(@SuppressWarnings("unused") MotdConfig config) { + // Do nothing. + // The config is unused. We only need to get it injected so it's + // loaded on startup rather than lazily when it's referenced for + // the first time. } @Override public void start() { - /* do nothing */ + // Do nothing. } @Override public void stop() { - /* do nothing */ + // Do nothing. } }