Do not use RestUtil.resolveBaseTypeFrom() 57/100557/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 12 Apr 2022 16:06:10 +0000 (18:06 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 12 Apr 2022 16:08:46 +0000 (18:08 +0200)
Derived types have been using their proper type for a long time now
and there is essentially cannot be a semantic difference between a
derived/restricted type which would make any difference during
resolution. Ditch the base type lookup and just use the type at hand.

JIRA: NETCONF-837
Change-Id: I21afc3ac15c954358f62070065531e75ff360924
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializer.java

index ca4c28db7b70f596ae552f8dd93f1619b13c40c1..9f73482f41aa55cc19fa14d575e6b422a1e61283 100644 (file)
@@ -17,7 +17,6 @@ import java.util.ArrayList;
 import java.util.List;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.restconf.common.util.RestUtil;
 import org.opendaylight.restconf.nb.rfc8040.ApiPath;
 import org.opendaylight.restconf.nb.rfc8040.ApiPath.ListInstance;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
@@ -261,9 +260,8 @@ public final class YangInstanceIdentifierDeserializer {
         } else {
             typedef = ((LeafSchemaNode) schemaNode).getType();
         }
-        final TypeDefinition<?> baseType = RestUtil.resolveBaseTypeFrom(typedef);
-        if (baseType instanceof LeafrefTypeDefinition) {
-            typedef = stack.resolveLeafref((LeafrefTypeDefinition) baseType);
+        if (typedef instanceof LeafrefTypeDefinition) {
+            typedef = stack.resolveLeafref((LeafrefTypeDefinition) typedef);
         }
 
         if (typedef instanceof IdentityrefTypeDefinition) {