Bump odlparent to 10.0.0
[yangtools.git] / codec / yang-data-codec-gson / src / main / java / org / opendaylight / yangtools / yang / data / codec / gson / JSONCodecFactorySupplier.java
index abe389fd0827230688e45bda87b8147cff43c93a..8e0667158575be11ee32a713f8c7561662b3aaa7 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.base.Stopwatch;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Optional;
 import java.util.function.BiFunction;
 import org.eclipse.jdt.annotation.NonNull;
@@ -111,16 +112,18 @@ public enum JSONCodecFactorySupplier {
     private final LoadingCache<EffectiveModelContext, JSONCodecFactory> precomputed;
 
     // Weak keys to retire the entry when SchemaContext goes away and to force identity-based lookup
-    private final LoadingCache<EffectiveModelContext, JSONCodecFactory> shared;
-
-    JSONCodecFactorySupplier() {
-        precomputed = CacheBuilder.newBuilder().weakKeys().build(new EagerCacheLoader(this::createFactory));
-        shared = CacheBuilder.newBuilder().weakKeys().build(new CacheLoader<EffectiveModelContext, JSONCodecFactory>() {
+    private final LoadingCache<EffectiveModelContext, JSONCodecFactory> shared = CacheBuilder.newBuilder()
+        .weakKeys().build(new CacheLoader<EffectiveModelContext, JSONCodecFactory>() {
             @Override
             public JSONCodecFactory load(final EffectiveModelContext key) {
                 return createFactory(key, new SharedCodecCache<>());
             }
         });
+
+    @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+        justification = "https://github.com/spotbugs/spotbugs/issues/1867")
+    JSONCodecFactorySupplier() {
+        precomputed = CacheBuilder.newBuilder().weakKeys().build(new EagerCacheLoader(this::createFactory));
     }
 
     /**