Bump upstreams
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / impl / AugmentableCodecDataObject.java
index f6f9f7852e3ebc978d5273694ca204df3b8db4fe..6a74a24661bd80ba433b8f13ea1305ff893f67b2 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.mdsal.binding.dom.codec.impl;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.collect.ImmutableMap;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.Map;
@@ -42,6 +43,7 @@ public abstract class AugmentableCodecDataObject<T extends DataObject & Augmenta
 
     // Used via VarHandle
     @SuppressWarnings("unused")
+    @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "https://github.com/spotbugs/spotbugs/issues/2749")
     private volatile ImmutableMap<Class<? extends Augmentation<T>>, Augmentation<T>> cachedAugmentations;
 
     protected AugmentableCodecDataObject(final AbstractDataObjectCodecContext<T, ?> context,
@@ -61,17 +63,15 @@ public abstract class AugmentableCodecDataObject<T extends DataObject & Augmenta
 
         @SuppressWarnings("rawtypes")
         final var augCtx = (AugmentationCodecContext<A>) codecContext().streamChild((Class) augmentationType);
-        if (augCtx != null) {
-            // Due to binding specification not representing grouping instantiations we can end up having the same
-            // augmentation applied to a grouping multiple times. While these augmentations have the same shape, they
-            // are still represented by distinct binding classes and therefore we need to make sure the result matches
-            // the augmentation the user is requesting -- otherwise a strict receiver would end up with a cryptic
-            // ClassCastException.
-            if (augmentationType.isAssignableFrom(augCtx.getBindingClass())) {
-                final var augObj = augCtx.filterFrom(codecData());
-                if (augObj != null) {
-                    return augObj;
-                }
+        // Due to binding specification not representing grouping instantiations we can end up having the same
+        // augmentation applied to a grouping multiple times. While these augmentations have the same shape, they are
+        // still represented by distinct binding classes and therefore we need to make sure the result matches
+        // the augmentation the user is requesting -- otherwise a strict receiver would end up with a cryptic
+        // ClassCastException.
+        if (augCtx != null && augmentationType.isAssignableFrom(augCtx.getBindingClass())) {
+            final var augObj = augCtx.filterFrom(codecData());
+            if (augObj != null) {
+                return augObj;
             }
         }
         return null;