Improve UnresolvedQNameReferent 94/98094/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 23 Oct 2021 22:33:39 +0000 (00:33 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 23 Oct 2021 22:38:32 +0000 (00:38 +0200)
We now have UnresolvedQName, use it to mark that the required return
type. Since the two specializations now clash on return type, the two
interfaces cannot be implemented even without QNameReferentBehavior
magic.

Change-Id: I1da5a8df89c5dfe64c815a1cd5158d2f60c0b1da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/QNameReferentBehavior.java [deleted file]
xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/ResolvedQNameReferent.java
xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/UnresolvedQNameReferent.java
xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangLocationPath.java
xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangQNameExpr.java

diff --git a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/QNameReferentBehavior.java b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/QNameReferentBehavior.java
deleted file mode 100644 (file)
index 94fed8f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2019 PANTHEON.tech, s.r.o.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.xpath.api;
-
-/**
- * Common interface for {@link ResolvedQNameReferent} and {@link UnresolvedQNameReferent}, ensuring that only one of
- * them is implemented by any class.
- *
- * @param <T> {@link QNameReferent} behavior subclass
- */
-interface QNameReferentBehavior<T extends QNameReferentBehavior<T>> extends QNameReferent {
-
-}
index b17046fcd2c8f7e1b8ec90bda6bae9af80321cf1..92b454aa0b0dc55f392a07595afa5a3d663463d4 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.yangtools.yang.common.QName;
  * @author Robert Varga
  */
 @Beta
-public interface ResolvedQNameReferent extends QNameReferentBehavior<ResolvedQNameReferent> {
+public interface ResolvedQNameReferent extends QNameReferent {
     /**
      * Return the referenced QName.
      *
index 5d6a6c0e16b2e4522d16a117650bb3a1d2da2b2d..c9e74dfb711df40e496fe0ae6436a27524800b84 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.xpath.api;
 
 import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.common.UnresolvedQName;
 
 /**
  * A {@link QNameReferent} referencing an unresolved QName.
@@ -15,7 +16,7 @@ import com.google.common.annotations.Beta;
  * @author Robert Varga
  */
 @Beta
-public interface UnresolvedQNameReferent<T extends ResolvedQNameReferent> extends
-        QNameReferentBehavior<UnresolvedQNameReferent<T>> {
-
+public interface UnresolvedQNameReferent extends QNameReferent {
+    @Override
+    UnresolvedQName getQName();
 }
index b4134d7ce8fb284e14fc83f986b831e78cc5191d..4cbd35c55e74e04104c5acc9a8992276d5ee29bd 100644 (file)
@@ -243,7 +243,7 @@ public abstract class YangLocationPath implements YangExpr {
     }
 
     public static class UnresolvedQNameStep extends AbstractQNameStep<UnresolvedQName>
-            implements UnresolvedQNameReferent<ResolvedQNameStep> {
+            implements UnresolvedQNameReferent {
         private static final long serialVersionUID = 1L;
 
         UnresolvedQNameStep(final YangXPathAxis axis, final UnresolvedQName qname) {
index e8e35f5195f69d372000c228bd2c67110aeb4347..4735055164b2f9c023391a628d844b4839709317 100644 (file)
@@ -57,7 +57,7 @@ public abstract class YangQNameExpr implements YangExpr, QNameReferent {
         }
     }
 
-    public static final class Unresolved extends YangQNameExpr implements UnresolvedQNameReferent<Resolved> {
+    public static final class Unresolved extends YangQNameExpr implements UnresolvedQNameReferent {
         private static final long serialVersionUID = 1L;
 
         private final UnresolvedQName qname;