Cache QNameModules during instantiation
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / SubmoduleEffectiveStatementImpl.java
index 64b0bcbf8048a64eb3ad4e0064054a437ef051c9..7c185e7ac60045b6fc447e2f5603a83e9ba0de35 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import static org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils.firstAttributeOf;
-
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
@@ -31,9 +30,9 @@ public final class SubmoduleEffectiveStatementImpl extends AbstractEffectiveModu
                 belongsToModuleName);
         RevisionEffectiveStatementImpl submoduleRevision = firstEffective(RevisionEffectiveStatementImpl.class);
 
-        this.qNameModule = submoduleRevision == null ? QNameModule.create(belongsToModuleQName.getNamespace(),
-                SimpleDateFormatUtil.DEFAULT_DATE_REV) : QNameModule.create(belongsToModuleQName.getNamespace(),
-                submoduleRevision.argument());
+        this.qNameModule = QNameModule.cachedReference(submoduleRevision == null ?
+                QNameModule.create(belongsToModuleQName.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV) :
+                    QNameModule.create(belongsToModuleQName.getNamespace(), submoduleRevision.argument()));
     }
 
     @Override