X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fparser%2Fspi%2Fmeta%2FStmtContextUtils.java;h=90d7311c3adf34c08ccabf12be5406e9672387f2;hb=932b5cf8b25c1a95d563d588726f1fc263fe8387;hp=8aaad4478c78a9ba81d70d04fb717b69ed4c9b8b;hpb=e1da13e62ad602fe8407822918ee57daebe581a5;p=yangtools.git diff --git a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContextUtils.java b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContextUtils.java index 8aaad4478c..90d7311c3a 100644 --- a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContextUtils.java +++ b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContextUtils.java @@ -388,11 +388,13 @@ public final class StmtContextUtils { * * @param stmt EffectiveStmtCtx to be checked * @param parentType type of parent to check - * @return true if the parent of StmtContext is of specified type, otherwise false + * @return true if the parent statement of {@code stmt} is of specified type, otherwise false + * @throws NullPointerException if any argument is {@code null} */ - public static boolean hasParentOfType(final EffectiveStmtCtx.Current stmt, - final StatementDefinition parentType) { - return hasParentOfType(stmt.caerbannog(), parentType); + public static boolean hasParentOfType(final EffectiveStmtCtx stmt, final StatementDefinition parentType) { + requireNonNull(parentType); + final Parent parent = stmt.effectiveParent(); + return parent != null && parentType.equals(parent.publicDefinition()); } /**