X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDatastoreContextIntrospector.java;h=93aee0d245d17d57454155ddbcfa89ba38fa1713;hb=422ac9fbe65c02f942c1fed41ff4aa96545f4224;hp=c0ed1294e4851c8119e4c72623db91b08b871e4e;hpb=70cd4b01dd47a66c5591e6f8151430bb9c274a09;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospector.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospector.java index c0ed1294e4..93aee0d245 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospector.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospector.java @@ -7,7 +7,8 @@ */ package org.opendaylight.controller.cluster.datastore; -import com.google.common.base.Preconditions; +import static com.google.common.base.Preconditions.checkArgument; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.primitives.Primitives; @@ -23,15 +24,14 @@ import java.lang.reflect.Method; import java.util.AbstractMap.SimpleImmutableEntry; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import javax.annotation.concurrent.GuardedBy; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.WordUtils; +import org.checkerframework.checker.lock.qual.GuardedBy; import org.opendaylight.controller.cluster.datastore.DatastoreContext.Builder; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections; @@ -133,10 +133,11 @@ public class DatastoreContextIntrospector { * Processes a property defined on the DataStoreProperties interface. */ @SuppressWarnings("checkstyle:IllegalCatch") - private static void processDataStoreProperty(final String name, final Class propertyType, Method readMethod) { - Preconditions.checkArgument(BUILDER_SETTERS.containsKey(name), String.format( + private static void processDataStoreProperty(final String name, final Class propertyType, + final Method readMethod) { + checkArgument(BUILDER_SETTERS.containsKey(name), "DataStoreProperties property \"%s\" does not have corresponding setter in DatastoreContext.Builder", - name)); + name); try { processPropertyType(propertyType); DATA_STORE_PROP_INFO.put(name, new SimpleImmutableEntry<>(propertyType, readMethod)); @@ -168,7 +169,7 @@ public class DatastoreContextIntrospector { // constructors but the one we want has the bean ConstructorProperties annotation. for (final Constructor ctor: propertyType.getConstructors()) { final ConstructorProperties ctorPropsAnnotation = ctor.getAnnotation(ConstructorProperties.class); - if (ctor.getParameterTypes().length == 1 && ctorPropsAnnotation != null) { + if (ctor.getParameterCount() == 1 && ctorPropsAnnotation != null) { findYangTypeGetter(propertyType, ctorPropsAnnotation.value()[0]); CONSTRUCTORS.put(propertyType, ctor); break; @@ -311,8 +312,8 @@ public class DatastoreContextIntrospector { // Sort the property keys by putting the names prefixed with the data store type last. This // is done so data store specific settings are applied after global settings. final ArrayList keys = new ArrayList<>(inKeys); - Collections.sort(keys, (key1, key2) -> key1.startsWith(dataStoreTypePrefix) ? 1 : - key2.startsWith(dataStoreTypePrefix) ? -1 : key1.compareTo(key2)); + keys.sort((key1, key2) -> key1.startsWith(dataStoreTypePrefix) ? 1 : + key2.startsWith(dataStoreTypePrefix) ? -1 : key1.compareTo(key2)); return keys; }