Clean up mdsal-singleton-dom-impl
[mdsal.git] / singleton-service / mdsal-singleton-dom-impl / src / main / java / org / opendaylight / mdsal / singleton / dom / impl / ServiceInfo.java
index 1b6db564c3fe8ca3139067944ed53e4b2b158855..081e5646be680b09a08acbafa5faaf0b0757096a 100644 (file)
@@ -12,42 +12,35 @@ import static com.google.common.base.Verify.verifyNotNull;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.util.concurrent.ListenableFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.mdsal.singleton.dom.impl.ClusterSingletonServiceGroupImpl.ServiceState;
 
-@NonNullByDefault
-@SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL", justification = "SpotBugs does not grok @Nullable field")
 final class ServiceInfo {
-    private static final ServiceInfo STARTED = new ServiceInfo(ServiceState.STARTED, null);
+    static final @NonNull ServiceInfo STARTED = new ServiceInfo(ServiceState.STARTED, null);
 
     private final @Nullable ListenableFuture<?> future;
-    private final ServiceState state;
+    private final @NonNull ServiceState state;
 
     private ServiceInfo(final ServiceState state, final @Nullable ListenableFuture<?> future) {
         this.state = requireNonNull(state);
         this.future = future;
     }
 
-    static ServiceInfo started() {
-        return STARTED;
-    }
-
-    ServiceState getState() {
+    @NonNull ServiceState getState() {
         return state;
     }
 
-    ListenableFuture<?> getFuture() {
+    @NonNull ListenableFuture<?> getFuture() {
         return verifyNotNull(future);
     }
 
-    ServiceInfo toState(final ServiceState newState) {
+    @NonNull ServiceInfo toState(final @NonNull ServiceState newState) {
         verify(state != newState, "Attempted to re-transition into %s", state);
         return new ServiceInfo(newState, null);
     }
 
-    ServiceInfo toState(final ServiceState newState, final ListenableFuture<?> newFuture) {
+    @NonNull ServiceInfo toState(final @NonNull ServiceState newState, final @NonNull ListenableFuture<?> newFuture) {
         verify(state != newState, "Attempted to re-transition into %s", state);
         return new ServiceInfo(newState, requireNonNull(newFuture));
     }