Deprecate util.Immutables for removal 62/97162/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 27 Sep 2021 13:46:34 +0000 (15:46 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 27 Sep 2021 15:18:20 +0000 (15:18 +0000)
This class is rather incompete in its mission and it is not used
anywhere. Deprecate it for removal.

JIRA: YANGTOOLS-1330
Change-Id: I54ad2666e1b7660e5d93d90ff924de1e640df754
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1dc00960a5ccc7434d06688f1140e59ca010192c)

common/util/src/main/java/org/opendaylight/yangtools/util/Immutables.java

index f8639de7f825def3772cb1f18b67a5efb5a2c7f9..ebf4136abe179a23713a4351bc9873985256b73c 100644 (file)
@@ -15,6 +15,7 @@ import java.math.BigInteger;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.concepts.Mutable;
 
+@Deprecated(since = "7.0.9", forRemoval = true)
 public final class Immutables {
     private static final ImmutableSet<Class<?>> KNOWN_IMMUTABLES = ImmutableSet.of(
             Integer.class, Short.class, BigDecimal.class, BigInteger.class, Byte.class, Character.class, Double.class,
@@ -30,19 +31,14 @@ public final class Immutables {
      * <p>Note: This method may return false to immutable objects which
      * immutability is not known, was defined not using concepts term.
      *
-     * @param obj
-     *            Reference to check
+     * @param obj Reference to check
      * @return true if object is known to be immutable false otherwise.
      */
     public static boolean isImmutable(final Object obj) {
         checkArgument(obj != null,"Object should not be null");
         if (obj instanceof Mutable) {
             return false;
-        } else if (obj instanceof Immutable) {
-            return true;
-        } else if (obj instanceof String) {
-            return true;
-        } else if (KNOWN_IMMUTABLES.contains(obj.getClass())) {
+        } else if (obj instanceof Immutable || obj instanceof String || KNOWN_IMMUTABLES.contains(obj.getClass())) {
             return true;
         }
         return false;