diff --git a/pom.xml b/pom.xml index e9d99fe..b560ac8 100644 --- a/pom.xml +++ b/pom.xml @@ -12,10 +12,10 @@ 17 5.12.0 2.0.13 - 3.14.0 + 3.3.2 2.21.1 1.18.24 - 0.0.7-SNAPSHOT + 0.0.4-SNAPSHOT 3.0-rc1 2.3.1 6.1.11 diff --git a/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/CQLTools.java b/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/CQLTools.java index 6fa74ab..3e4ae69 100644 --- a/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/CQLTools.java +++ b/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/CQLTools.java @@ -14,8 +14,8 @@ import org.cqframework.cql.cql2elm.CqlTranslator; import org.cqframework.cql.cql2elm.LibraryBuilder; import org.cqframework.cql.cql2elm.model.CompiledLibrary; -import org.cqframework.cql.cql2elm.preprocessor.CqlPreprocessorElmCommonVisitor; -import org.cqframework.cql.elm.IdObjectFactory; +import org.cqframework.cql.cql2elm.preprocessor.CqlPreprocessorVisitor; + import org.cqframework.cql.gen.cqlLexer; import org.cqframework.cql.gen.cqlParser; import org.hl7.elm.r1.ExpressionDef; @@ -135,10 +135,9 @@ public void generate() throws IOException { || usingProperties.getLibraryType() == "QICore"); // <-- BADDDDD!!!! Defaults to fhir - CqlPreprocessorElmCommonVisitor preprocessor = - new CqlPreprocessorElmCommonVisitor( - new LibraryBuilder(translationResource.getLibraryManager(), new IdObjectFactory()), - tokens); + CqlPreprocessorVisitor preprocessor = + new CqlPreprocessorVisitor( + new LibraryBuilder(translationResource.getLibraryManager()), tokens); preprocessor.visit(tree); ParseTreeWalker walker = new ParseTreeWalker(); diff --git a/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/parsing/Cql2ElmListener.java b/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/parsing/Cql2ElmListener.java index 05233d9..c3c3678 100644 --- a/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/parsing/Cql2ElmListener.java +++ b/src/main/java/gov/cms/madie/cql_elm_translator/utils/cql/parsing/Cql2ElmListener.java @@ -22,11 +22,10 @@ import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.apache.commons.collections4.CollectionUtils; +import org.cqframework.cql.cql2elm.CqlCompilerOptions; import org.cqframework.cql.cql2elm.LibraryBuilder; import org.cqframework.cql.cql2elm.model.CompiledLibrary; -import org.cqframework.cql.cql2elm.preprocessor.CqlPreprocessorElmCommonVisitor; - -import org.cqframework.cql.elm.IdObjectFactory; +import org.cqframework.cql.cql2elm.preprocessor.CqlPreprocessorVisitor; import org.cqframework.cql.gen.cqlBaseListener; import org.cqframework.cql.gen.cqlLexer; import org.cqframework.cql.gen.cqlParser; @@ -690,10 +689,14 @@ private void parseChildLibraries(IncludeDef def) throws IOException { TranslationResource translationResource = TranslationResource.getInstance(true); // <-- BADDDDD!!!! Defaults to fhir - CqlPreprocessorElmCommonVisitor preprocessor = - new CqlPreprocessorElmCommonVisitor( - new LibraryBuilder(translationResource.getLibraryManager(), new IdObjectFactory()), - tokens); + // Add CqlCompilerOptions from LibraryManager to prevent NPE while walking through CQL + LibraryBuilder libraryBuilder = new LibraryBuilder(translationResource.getLibraryManager()); + // MAT-7300: change signature level to overloads + CqlCompilerOptions options = translationResource.getLibraryManager().getCqlCompilerOptions(); + options.setSignatureLevel(LibraryBuilder.SignatureLevel.Overloads); + libraryBuilder.setCompilerOptions(options); + CqlPreprocessorVisitor preprocessor = new CqlPreprocessorVisitor(libraryBuilder, tokens); + preprocessor.visit(tree); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree);