Make DefaultDOMRpcResult usable with DOMRpcResult redefinition 71/75271/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 17 Aug 2018 13:44:31 +0000 (15:44 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 17 Aug 2018 13:44:31 +0000 (15:44 +0200)
Since DOMRpcResult can now return a proper collection, users need
the ability to use that return to instantiate a DefaultDOMRpcResult,
but the constructor mismatch prevents that. Fix it.

Change-Id: Id1720a3b429f27aea6d971529687766090090ddf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/DefaultDOMRpcResult.java

index eb2c8ee8cb19088359a7f344dab333763ce2d376..d7277ca14070bbc42dde3487e467089a414fbc2c 100644 (file)
@@ -30,8 +30,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 @NonNullByDefault
 public final class DefaultDOMRpcResult implements DOMRpcResult, Immutable, Serializable {
     private static final long serialVersionUID = 1L;
+
     private final @Nullable NormalizedNode<?, ?> result;
-    private final Collection<RpcError> errors;
+    private final Collection<? extends RpcError> errors;
 
     public DefaultDOMRpcResult(final NormalizedNode<?, ?> result, final RpcError... errors) {
         this(result, asCollection(errors));
@@ -45,7 +46,8 @@ public final class DefaultDOMRpcResult implements DOMRpcResult, Immutable, Seria
         this(result, Collections.emptyList());
     }
 
-    public DefaultDOMRpcResult(final @Nullable NormalizedNode<?, ?> result, final Collection<RpcError> errors) {
+    public DefaultDOMRpcResult(final @Nullable NormalizedNode<?, ?> result,
+            final Collection<? extends RpcError> errors) {
         this.result = result;
         this.errors = requireNonNull(errors);
     }
@@ -59,7 +61,7 @@ public final class DefaultDOMRpcResult implements DOMRpcResult, Immutable, Seria
     }
 
     @Override
-    public Collection<RpcError> getErrors() {
+    public Collection<? extends RpcError> getErrors() {
         return errors;
     }