fix Error Prone's & FindBugs errors
authorMichael Vorburger <mike@vorburger.ch>
Wed, 23 May 2018 22:52:25 +0000 (00:52 +0200)
committerMichael Vorburger <mike@vorburger.ch>
Wed, 1 Jul 2020 23:31:01 +0000 (01:31 +0200)
Signed-off-by: Michael Vorburger <mike@vorburger.ch>
src/main/java/org/opendaylight/infrautils/karaf/GuiceManagerImpl.java
src/main/java/org/opendaylight/infrautils/simple/ShellMain.java

index 3b8abd146cbe3d90848f492ade9fc6c87007961c..493d74c3d06b0a60d09abb345b66175d71d2f820 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.infrautils.karaf;
 
+import com.google.errorprone.annotations.Var;
 import com.google.inject.Injector;
 import org.apache.karaf.shell.api.console.Registry;
 import org.apache.karaf.shell.impl.action.command.ManagerImpl;
@@ -40,7 +41,7 @@ public class GuiceManagerImpl extends ManagerImpl {
 
         @Override
         public <T> T getService(Class<T> clazz) {
-            T service = super.getService(clazz);
+            @Var T service = super.getService(clazz);
             if (service == null) {
                 service = guiceInjector.getInstance(clazz);
             }
index 20361de671a5bddd2288106528c8f788654244b5..fcc2573b9674969f819d527044a6067a56618d8d 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.infrautils.simple;
 
 import com.google.inject.Module;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Set;
 import javax.inject.Inject;
 import org.apache.karaf.shell.api.action.Action;
@@ -28,6 +29,7 @@ public class ShellMain extends Main {
 
     private Set<Action> actions;
 
+    @SuppressFBWarnings("UR_UNINIT_READ") // injectMembers() DI magic is beyond FB
     public ShellMain(Module mainModule) {
         super(mainModule);
         injector.injectMembers(this);