From a5ff861c56bd331485f9fc3fd6bf5afa02fc7627 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 27 Sep 2021 17:11:40 +0200 Subject: [PATCH] Deprecate IllegalArgumentCodec for removal As previously noted, this interface encourages bad patterns. All downstream users are better served with their domain-specific interfaces. Deprecate it with the intent to remove. JIRA: YANGTOOLS-1334 Change-Id: If0e56b2ff575d101dbd090112f22e80565e5e6bb Signed-off-by: Robert Varga --- .../yangtools/concepts/AbstractIllegalArgumentCodec.java | 3 +++ .../yangtools/concepts/IllegalArgumentCodec.java | 6 ++++++ .../concepts/AbstractIllegalArgumentCodecTest.java | 1 + 3 files changed, 10 insertions(+) diff --git a/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodec.java b/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodec.java index 6be4f95a37..011a921f72 100644 --- a/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodec.java +++ b/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodec.java @@ -19,8 +19,11 @@ import org.eclipse.jdt.annotation.Nullable; * * @param Serializied (external) type * @param Deserialized (internal) type + * @deprecated This is a base class for implementing IllegalArgumentCodec, without further use. It will be removed with + * IllegalArgumentCodec. */ @Beta +@Deprecated(since = "8.0.0", forRemoval = true) public abstract class AbstractIllegalArgumentCodec implements IllegalArgumentCodec { @Override public final D deserialize(final S input) { diff --git a/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/IllegalArgumentCodec.java b/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/IllegalArgumentCodec.java index 87b69b936b..dcbd6b0a6b 100644 --- a/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/IllegalArgumentCodec.java +++ b/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/IllegalArgumentCodec.java @@ -16,8 +16,14 @@ import org.eclipse.jdt.annotation.NonNull; * * @param Serialized (external) type * @param Deserialized (internal) type + * @deprecated This interface ignores a number of complications when dealing with external forms. For one, it assumes + * a serdes operation does not have further context than the input -- and this is seldom the case. The other + * failing is that it actively discourages use of checked exceptions to deal with errors at the appropriate + * level. Based on these, this interface is deprecated for removal without a replacement. Users are + * encouraged to define similar interface fitting their needs. */ @Beta +@Deprecated(since = "8.0.0", forRemoval = true) public interface IllegalArgumentCodec { /** * Produce an internal object based on an external object. diff --git a/common/concepts/src/test/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodecTest.java b/common/concepts/src/test/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodecTest.java index fe11a9b484..b645e3051c 100644 --- a/common/concepts/src/test/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodecTest.java +++ b/common/concepts/src/test/java/org/opendaylight/yangtools/concepts/AbstractIllegalArgumentCodecTest.java @@ -11,6 +11,7 @@ import static org.junit.Assert.assertThrows; import org.junit.Test; +@Deprecated(since = "8.0.0", forRemoval = true) public class AbstractIllegalArgumentCodecTest { private static final class TestCodec extends AbstractIllegalArgumentCodec { @Override -- 2.36.6