Fixup SchemaNodeIdentifier design
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / deviation / DeviationStatementSupport.java
index bd4e994aadb82dc39ad48b607a8a0f18b20abd62..0f1e78393fe5772410411cde44e862a7795fb8ce 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.deviation;
 
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@@ -51,7 +52,8 @@ public final class DeviationStatementSupport
             final Mutable<SchemaNodeIdentifier, DeviationStatement, DeviationEffectiveStatement> ctx) {
         final QNameModule currentModule = ctx.getFromNamespace(ModuleCtxToModuleQName.class,
                 ctx.getRoot());
-        final QNameModule targetModule = ctx.coerceStatementArgument().getLastComponent().getModule();
+        final QNameModule targetModule = Iterables.getLast(ctx.coerceStatementArgument().getNodeIdentifiers())
+                .getModule();
 
         if (currentModule.equals(targetModule)) {
             throw new InferenceException(ctx.getStatementSourceReference(),