BUG-6522: do not re-read models
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / util / ASTSchemaSource.java
index 5e3ab5eaabf926f71a22c701e1a682c394f15d54..3ccc8f0935c85f19c06b446b7db4a6d287e07580 100644 (file)
@@ -96,9 +96,29 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation {
      * @return A new representation instance.
      * @throws YangSyntaxErrorException
      *             if we fail to extract dependency information.
+     *
+     * @deprecated Use {@link #create(SourceIdentifier, ParserRuleContext)} instead.
      */
+    @Deprecated
     public static ASTSchemaSource create(@Nonnull final SourceIdentifier identifier,
             @Nonnull final ParserRuleContext tree, final String text) throws YangSyntaxErrorException {
+        return create(identifier, tree);
+    }
+
+    /**
+     * Create a new instance of AST representation for a abstract syntax tree,
+     * performing minimal semantic analysis to acquire dependency information.
+     *
+     * @param identifier
+     *            SourceIdentifier of yang schema source.
+     * @param tree
+     *            ANTLR abstract syntax tree
+     * @return A new representation instance.
+     * @throws YangSyntaxErrorException
+     *             if we fail to extract dependency information.
+     */
+    public static ASTSchemaSource create(@Nonnull final SourceIdentifier identifier,
+            @Nonnull final ParserRuleContext tree) throws YangSyntaxErrorException {
         final YangModelDependencyInfo depInfo = YangModelDependencyInfo.fromAST(identifier.getName(), tree);
         final SourceIdentifier id = getSourceId(depInfo);