Remove setFoo(List) compatibility setters 29/91429/6
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 19 Jul 2020 12:00:58 +0000 (14:00 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 5 Feb 2021 16:26:40 +0000 (17:26 +0100)
A migration setter was present to eash downstream users'
migration from List<Foo> to Map<FooKey, Foo>. This is no longer
necessary, remove the setter.

JIRA: MDSAL-540
Change-Id: I587ff1eaf81fca912cdb0c1370d1fd7ecd248d7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Illia <illia.ihushev@pantheon.tech>
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/CodeHelpers.java

index 5481e01c6e806bc49ae06a7317080000e2bd4994..0b361e000a6f09c82ec80bca8b5d631b7be94ef6 100644 (file)
@@ -353,18 +353,15 @@ class BuilderTemplate extends AbstractBuilderTemplate {
 
     '''
 
-    // FIXME: MDSAL-540: remove the migration setter
     def private generateMapSetter(GeneratedProperty field, Type actualType) '''
         «val restrictions = restrictionsForSetter(actualType)»
-        «val actualTypeRef = actualType.importedName»
-        «val setterName = "set" + field.name.toFirstUpper»
         «IF restrictions !== null»
             «generateCheckers(field, restrictions, actualType)»
         «ENDIF»
-        public «type.getName» «setterName»(final «field.returnType.importedName» values) {
+        public «type.getName» set«field.name.toFirstUpper»(final «field.returnType.importedName» values) {
         «IF restrictions !== null»
             if (values != null) {
-               for («actualTypeRef» value : values.values()) {
+               for («actualType.importedName» value : values.values()) {
                    «checkArgument(field, restrictions, actualType, "value")»
                }
             }
@@ -372,24 +369,6 @@ class BuilderTemplate extends AbstractBuilderTemplate {
             this.«field.fieldName» = values;
             return this;
         }
-
-        /**
-          * Utility migration setter.
-          *
-          * <b>IMPORTANT NOTE</b>: This method does not completely match previous mechanics, as the list is processed as
-          *                        during this method's execution. Any future modifications of the list are <b>NOT</b>
-          *                        reflected in this builder nor its products.
-          *
-          * @param values Legacy List of values
-          * @return this builder
-          * @throws IllegalArgumentException if the list contains entries with the same key
-          * @throws NullPointerException if the list contains a null entry
-          * @deprecated Use {@link #«setterName»(«JU_MAP.importedName»)} instead.
-          */
-        @«DEPRECATED.importedName»(forRemoval = true)
-        public «type.getName» «setterName»(final «JU_LIST.importedName»<«actualTypeRef»> values) {
-            return «setterName»(«CODEHELPERS.importedName».compatMap(values));
-        }
     '''
 
     def private generateSimpleSetter(GeneratedProperty field, Type actualType) '''
index 50c77d9134dcc287b021488cb1c7c8ccdbdf6f42..55334e12be68965dce78dc0edbc7a0acc0586301 100644 (file)
@@ -15,7 +15,6 @@ import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.base.VerifyException;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
 import java.math.BigInteger;
 import java.util.Arrays;
 import java.util.List;
@@ -293,24 +292,6 @@ public final class CodeHelpers {
         return input != null && input.isEmpty() ? null : input;
     }
 
-    /**
-     * Compatibility utility for turning a List of identifiable objects to an indexed map.
-     *
-     * @param <K> key type
-     * @param <V> identifiable type
-     * @param list legacy list
-     * @return Indexed map
-     * @throws IllegalArgumentException if the list contains entries with the same key
-     * @throws NullPointerException if the list contains a null entry
-     * @deprecated This method is a transitional helper used only in methods deprecated themselves.
-     */
-    // FIXME: MDSAL-540: remove this method
-    @Deprecated
-    public static <K extends Identifier<V>, V extends Identifiable<K>> @Nullable Map<K, V> compatMap(
-            final @Nullable List<V> list) {
-        return list == null || list.isEmpty() ? null : Maps.uniqueIndex(list, Identifiable::key);
-    }
-
     /**
      * Return hash code of a single-property wrapper class. Since the wrapper is not null, we really want to discern
      * this object being present, hence {@link Objects#hashCode()} is not really useful we would end up with {@code 0}