diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PackageableElementFifthPassBuilder.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PackageableElementFifthPassBuilder.java deleted file mode 100644 index 902d9761d8f..00000000000 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PackageableElementFifthPassBuilder.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2020 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.language.pure.compiler.toPureGraph; - -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElementVisitor; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.connection.PackageableConnection; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.data.DataElement; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Association; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Class; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Enumeration; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Function; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Measure; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.mapping.Mapping; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.runtime.PackageableRuntime; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.section.SectionIndex; -import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement; - -/** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ -@Deprecated -public class PackageableElementFifthPassBuilder implements PackageableElementVisitor -{ - private final CompileContext context; - - public PackageableElementFifthPassBuilder(CompileContext context) - { - this.context = context; - } - - @Override - public PackageableElement visit(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement element) - { - return null; - } - - @Override - public PackageableElement visit(Profile profile) - { - return null; - } - - @Override - public PackageableElement visit(Enumeration _enum) - { - return null; - } - - @Override - public PackageableElement visit(Class _class) - { - return null; - } - - @Override - public PackageableElement visit(Association association) - { - return null; - } - - @Override - public PackageableElement visit(Function function) - { - return null; - } - - @Override - public PackageableElement visit(Measure measure) - { - return null; - } - - @Override - public PackageableElement visit(Mapping mapping) - { - return null; - } - - @Override - public PackageableElement visit(PackageableRuntime packageableRuntime) - { - return null; - } - - @Override - public PackageableElement visit(PackageableConnection packageableConnection) - { - return null; - } - - @Override - public PackageableElement visit(SectionIndex sectionIndex) - { - return null; - } - - @Override - public PackageableElement visit(DataElement dataElement) - { - return null; - } -} diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PackageableElementFourthPassBuilder.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PackageableElementFourthPassBuilder.java deleted file mode 100644 index 68074dc91ca..00000000000 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PackageableElementFourthPassBuilder.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2020 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.language.pure.compiler.toPureGraph; - -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElementVisitor; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.connection.PackageableConnection; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.data.DataElement; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Association; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Class; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Enumeration; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Function; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Measure; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.mapping.Mapping; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.runtime.PackageableRuntime; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.section.SectionIndex; -import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement; - -/** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ -@Deprecated -public class PackageableElementFourthPassBuilder implements PackageableElementVisitor -{ - private final CompileContext context; - - public PackageableElementFourthPassBuilder(CompileContext context) - { - this.context = context; - } - - @Override - public PackageableElement visit(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement element) - { - return null; - } - - @Override - public PackageableElement visit(Profile profile) - { - return null; - } - - @Override - public PackageableElement visit(Enumeration _enum) - { - return null; - } - - @Override - public PackageableElement visit(Class srcClass) - { - return null; - } - - @Override - public PackageableElement visit(Association srcAssociation) - { - return null; - } - - @Override - public PackageableElement visit(Function function) - { - return null; - } - - @Override - public PackageableElement visit(Measure measure) - { - return null; - } - - @Override - public PackageableElement visit(Mapping mapping) - { - return null; - } - - @Override - public PackageableElement visit(PackageableRuntime packageableRuntime) - { - return null; - } - - @Override - public PackageableElement visit(PackageableConnection packageableConnection) - { - return null; - } - - @Override - public PackageableElement visit(SectionIndex sectionIndex) - { - return null; - } - - @Override - public PackageableElement visit(DataElement dataElement) - { - return null; - } -} diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/extension/Processor.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/extension/Processor.java index df2d233e510..1c0bc327012 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/extension/Processor.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/extension/Processor.java @@ -138,7 +138,7 @@ public static Processor newProcessor(Class BiFunction firstPass, BiConsumer secondPass) { - return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, null, null, null, null); + return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, null, null); } public static Processor newProcessor(Class elementClass, @@ -146,7 +146,7 @@ public static Processor newProcessor(Class BiConsumer secondPass, BiConsumer thirdPass) { - return newProcessor(elementClass, null, firstPass, secondPass, thirdPass); + return newProcessor(elementClass, null, firstPass, secondPass, thirdPass, null); } public static Processor newProcessor(Class elementClass, @@ -155,7 +155,7 @@ public static Processor newProcessor(Class BiConsumer secondPass, BiConsumer thirdPass) { - return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, thirdPass, null, null, null); + return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, thirdPass, null); } public static Processor newProcessor(Class elementClass, @@ -164,7 +164,7 @@ public static Processor newProcessor(Class BiConsumer thirdPass, BiFunction> prerequisiteElementsPass) { - return newProcessor(elementClass, null, firstPass, secondPass, thirdPass, null, null, prerequisiteElementsPass); + return newProcessor(elementClass, null, firstPass, secondPass, thirdPass, prerequisiteElementsPass); } public static Processor newProcessor(Class elementClass, @@ -173,122 +173,6 @@ public static Processor newProcessor(Class BiConsumer secondPass, BiConsumer thirdPass, BiFunction> prerequisiteElementsPass) - { - return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, thirdPass, null, null, prerequisiteElementsPass); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass) - { - return newProcessor(elementClass, null, firstPass, secondPass, thirdPass, fourthPass, null, null); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - Collection> prerequisiteClasses, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass) - { - return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, thirdPass, fourthPass, null, null); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass, - BiFunction> prerequisiteElementsPass) - { - return newProcessor(elementClass, null, firstPass, secondPass, thirdPass, fourthPass, null, prerequisiteElementsPass); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - Collection> prerequisiteClasses, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass, - BiFunction> prerequisiteElementsPass) - { - return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, thirdPass, fourthPass, null, prerequisiteElementsPass); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass, - BiConsumer fifthPass) - { - return newProcessor(elementClass, null, firstPass, secondPass, thirdPass, fourthPass, fifthPass, null); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - Collection> prerequisiteClasses, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass, - BiConsumer fifthPass) - { - return newProcessor(elementClass, prerequisiteClasses, firstPass, secondPass, thirdPass, fourthPass, fifthPass, null); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass, - BiConsumer fifthPass, - BiFunction> prerequisiteElementsPass) - { - return newProcessor(elementClass, null, firstPass, secondPass, thirdPass, fourthPass, fifthPass, prerequisiteElementsPass); - } - - /** - * @deprecated This will soon be removed as part of Engine compiler cleanup in the next release - */ - @Deprecated - public static Processor newProcessor(Class elementClass, - Collection> prerequisiteClasses, - BiFunction firstPass, - BiConsumer secondPass, - BiConsumer thirdPass, - BiConsumer fourthPass, - BiConsumer fifthPass, - BiFunction> prerequisiteElementsPass) { Collection> resolvedPrerequisiteClasses = (prerequisiteClasses == null) ? Collections.emptyList() : prerequisiteClasses; return new Processor() @@ -337,16 +221,6 @@ protected void processElementThirdPass(T element, CompileContext context) { thirdPass.accept(element, context); } - - if (fourthPass != null) - { - fourthPass.accept(element, context); - } - - if (fifthPass != null) - { - fifthPass.accept(element, context); - } } }; } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java index 4cc983f569d..5738b689924 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java @@ -874,7 +874,7 @@ private void checkForDuplicateJoins(Database srcDatabase, CompileContext context MutableList joins = nameToJoins.get(name); if (joins.size() > 1) { - warnings.add(new Warning(joins.getLast().sourceInformation, "Found joins with duplicate names: " + name)); + joins.forEach(join -> warnings.add(new Warning(join.sourceInformation, "Found joins with duplicate names: " + name))); } }); } @@ -893,7 +893,7 @@ private void checkForDuplicateFilters(Database srcDatabase, CompileContext conte MutableList filters = nameToFilters.get(name); if (filters.size() > 1) { - warnings.add(new Warning(filters.getLast().sourceInformation, "Found filters with duplicate names: " + name)); + filters.forEach(filter -> warnings.add(new Warning(filter.sourceInformation, "Found filters with duplicate names: " + name))); } }); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestRelationalCompilationFromGrammar.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestRelationalCompilationFromGrammar.java index a9e55d90af7..e5c9a80a8a6 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestRelationalCompilationFromGrammar.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestRelationalCompilationFromGrammar.java @@ -2813,7 +2813,7 @@ public void testDuplicateNameForJoins() " )\n" + " Join Firm_Person(firmTable.ID = personTable.FIRMID)\n" + " Join Firm_Person(firmTable.ADDRESSID = personTable.ADDRESSID)\n" + - ")", null, Collections.singletonList("COMPILATION error at [22:3-63]: Found joins with duplicate names: Firm_Person")); + ")", null, Arrays.asList("COMPILATION error at [21:3-53]: Found joins with duplicate names: Firm_Person", "COMPILATION error at [22:3-63]: Found joins with duplicate names: Firm_Person")); } @Test @@ -2841,6 +2841,6 @@ public void testDuplicateNameForFilters() " )\n" + " Filter FirmFilter(firmTable.LEGALNAME = 'myevent')\n" + " Filter FirmFilter(firmTable.ADDRESSID = 1)\n" + - ")", null, Collections.singletonList("COMPILATION error at [22:3-44]: Found filters with duplicate names: FirmFilter")); + ")", null, Arrays.asList("COMPILATION error at [21:3-52]: Found filters with duplicate names: FirmFilter", "COMPILATION error at [22:3-44]: Found filters with duplicate names: FirmFilter")); } } diff --git a/legend-engine-xts-service/legend-engine-service-post-validation-runner/src/test/java/org/finos/legend/engine/service/post/validation/runner/TestLegendServicePostValidationRunner.java b/legend-engine-xts-service/legend-engine-service-post-validation-runner/src/test/java/org/finos/legend/engine/service/post/validation/runner/TestLegendServicePostValidationRunner.java index cb723f5bb85..9c08800229d 100644 --- a/legend-engine-xts-service/legend-engine-service-post-validation-runner/src/test/java/org/finos/legend/engine/service/post/validation/runner/TestLegendServicePostValidationRunner.java +++ b/legend-engine-xts-service/legend-engine-service-post-validation-runner/src/test/java/org/finos/legend/engine/service/post/validation/runner/TestLegendServicePostValidationRunner.java @@ -20,9 +20,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import org.eclipse.collections.impl.utility.LazyIterate; import org.finos.legend.engine.language.pure.compiler.toPureGraph.CompileContext; -import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementFifthPassBuilder; import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementFirstPassBuilder; -import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementFourthPassBuilder; import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementSecondPassBuilder; import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementThirdPassBuilder; import org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel; @@ -38,7 +36,6 @@ import org.finos.legend.engine.shared.core.ObjectMapperFactory; import org.finos.legend.engine.shared.core.deployment.DeploymentMode; import org.finos.legend.engine.shared.core.identity.Identity; -import org.finos.legend.engine.shared.core.identity.factory.*; import org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_Service; import org.finos.legend.pure.m3.coreinstance.Package; import org.junit.Assert; @@ -111,8 +108,6 @@ public Root_meta_legend_service_metamodel_Service compileService(Service service Root_meta_legend_service_metamodel_Service compiledService = (Root_meta_legend_service_metamodel_Service) service.accept(new PackageableElementFirstPassBuilder(compileContext)); service.accept(new PackageableElementSecondPassBuilder(compileContext)); service.accept(new PackageableElementThirdPassBuilder(compileContext)); - service.accept(new PackageableElementFourthPassBuilder(compileContext)); - service.accept(new PackageableElementFifthPassBuilder(compileContext)); return compiledService; }