/*
 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  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.parser.rfc7950.namespace;

import static com.google.common.base.Verify.verify;

import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.common.YangNamespaceContext;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;

@Beta
public interface YangNamespaceContextNamespace extends IdentifierNamespace<Empty, YangNamespaceContext> {
    NamespaceBehaviour<Empty, YangNamespaceContext, @NonNull YangNamespaceContextNamespace> BEHAVIOUR =
            NamespaceBehaviour.rootStatementLocal(YangNamespaceContextNamespace.class);

    static @NonNull YangNamespaceContext computeIfAbsent(final StmtContext<?, ?, ?> ctx) {
        final StmtContext<?, ?, ?> root = ctx.getRoot();
        YangNamespaceContext ret = root.getFromNamespace(YangNamespaceContextNamespace.class, Empty.getInstance());
        if (ret == null) {
            verify(ctx instanceof Mutable, "Cannot populate namespace context to %s", ctx);
            ret = new StmtNamespaceContext(ctx);
            ((Mutable<?, ?, ?>)ctx).addToNs(YangNamespaceContextNamespace.class, Empty.getInstance(), ret);
        }
        return ret;
    }
}

@@ -513,61 +513,8 @@
 ll;%0A
-import org.opendaylight.yangtools.yang.common.Empty;%0A
 impo
@@ -569,32 +569,32 @@
 mespaceContext;%0A
+
 import org.opend
@@ -953,21 +953,36 @@
 mespace%3C
-Empty
+StmtContext%3C?, ?, ?%3E
 , YangNa
@@ -1022,21 +1022,36 @@
 haviour%3C
-Empty
+StmtContext%3C?, ?, ?%3E
 , YangNa
@@ -1153,24 +1153,12 @@
 our.
-rootStatementLoc
+glob
 al(Y
@@ -1378,20 +1378,19 @@
 t ret = 
-root
+ctx
 .getFrom
@@ -1436,35 +1436,20 @@
 .class, 
-Empty.getInstance()
+root
 );%0A     
@@ -1605,19 +1605,20 @@
 Context(
-ctx
+root
 );%0A     
@@ -1697,27 +1697,12 @@
 ss, 
-Empty.getInstance()
+root
 , re

Make YangNamespaceContextNamespace global