BUG-8159: add payload debugs
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DelayedListenerRegistration.java
index ac132721c5dcc9954a152f0fcc5d1a94787e0fe5..8d73bc6155d2c664ba6448a1085bbf85850d9606 100644 (file)
@@ -39,8 +39,13 @@ abstract class DelayedListenerRegistration<L extends EventListener, M> implement
 
     @Override
     public L getInstance() {
-        final ListenerRegistration<L> d = delegate;
-        return d == null ? null : (L)d.getInstance();
+        // ObjectRegistration annotates this method as @Nonnull but we could return null if the delegate is not set yet.
+        // In reality, we do not and should not ever call this method on DelayedListenerRegistration instances anyway
+        // but, since we have to provide an implementation to satisfy the interface, we throw
+        // UnsupportedOperationException to honor the API contract of not returning null and to avoid a FindBugs error
+        // for possibly returning null.
+        throw new UnsupportedOperationException(
+                "getInstance should not be called on this instance since it could be null");
     }
 
     @Override