diff --git a/monticore-generator/src/main/java/de/monticore/MontiCoreScript.java b/monticore-generator/src/main/java/de/monticore/MontiCoreScript.java index a1ecf4385e..2c3cddc4ae 100644 --- a/monticore-generator/src/main/java/de/monticore/MontiCoreScript.java +++ b/monticore-generator/src/main/java/de/monticore/MontiCoreScript.java @@ -100,7 +100,7 @@ import de.monticore.generating.templateengine.TemplateHookPoint; import de.monticore.generating.templateengine.freemarker.FreeMarkerTemplateEngine; import de.monticore.generating.templateengine.freemarker.MontiCoreTemplateLoader; -import de.monticore.generating.templateengine.reporting.Reporting; +import de.monticore.generating.templateengine.reporting.ReportingFix; import de.monticore.grammar.MCGrammarSymbolTableHelper; import de.monticore.grammar.cocos.GrammarCoCos; import de.monticore.grammar.grammar._ast.ASTMCGrammar; @@ -378,9 +378,9 @@ public ASTMCGrammar createSymbolsFromAST(IGrammar_WithConceptsGlobalScope global MCGrammarSymbol symbol = result.getSymbol(); for(MCGrammarSymbol it: MCGrammarSymbolTableHelper.getAllSuperGrammars(symbol)) { if(!it.getFullName().equals(symbol.getFullName())) { - Reporting.reportOpenInputFile(Optional.empty(), + ReportingFix.reportOpenInputFile(Optional.empty(), Paths.get(it.getFullName().replaceAll("\\.", "/").concat(".mc4"))); - Reporting.reportOpenInputFile(Optional.empty(), + ReportingFix.reportOpenInputFile(Optional.empty(), Paths.get(it.getFullName().replaceAll("\\.", "/").concat(".cd"))); } @@ -1400,7 +1400,7 @@ public GlobalExtensionManagement initGlex(MontiCoreConfiguration mcConfig) { // initialize glex GlobalExtensionManagement glex = new GlobalExtensionManagement(); glex.addAfterTemplate("cd2java.Imports", new TemplateHookPoint("mc.Imports")); - if(Reporting.isInitialized()) { + if(ReportingFix.isInitialized()) { if(mcConfig.getConfigTemplate().isPresent()) { String configTemplate = mcConfig.getConfigTemplate().get(); if (configTemplate.endsWith(".ftl")) { // remove file ending @@ -1440,14 +1440,13 @@ public static class Runner extends GroovyRunnerBase { "de.monticore.io.paths", "de.monticore.languages.grammar", "de.se_rwth.commons.logging", - "de.monticore.generating.templateengine.reporting", + "de.monticore.generating.templateengine.reporting.fix", // TODO: Remove .fix after 7.7.0 release "de.se_rwth.commons", - "de.monticore.generating.templateengine.reporting.reporter", "de.monticore.incremental"}; public static final String[] DEFAULT_STATIC_IMPORTS = { "de.se_rwth.commons.logging.Log", - "de.monticore.generating.templateengine.reporting.Reporting", + "de.monticore.generating.templateengine.reporting.fix.Reporting", // TODO: Remove .fix after 7.7.0 release "de.se_rwth.commons.Names"}; diff --git a/monticore-generator/src/main/java/de/monticore/cli/MontiCoreTool.java b/monticore-generator/src/main/java/de/monticore/cli/MontiCoreTool.java index 5ac083788c..cd71d7b122 100644 --- a/monticore-generator/src/main/java/de/monticore/cli/MontiCoreTool.java +++ b/monticore-generator/src/main/java/de/monticore/cli/MontiCoreTool.java @@ -11,7 +11,7 @@ import de.monticore.MontiCoreScript; import de.monticore.StatisticsHandlerFix; import de.monticore.cli.updateChecker.UpdateCheckerRunnable; -import de.monticore.generating.templateengine.reporting.Reporting; +import de.monticore.generating.templateengine.reporting.ReportingFix; import de.monticore.grammar.grammar_withconcepts.Grammar_WithConceptsMill; import de.se_rwth.commons.logging.Log; import de.se_rwth.commons.logging.Slf4jLog; @@ -175,7 +175,7 @@ else if (cmd.hasOption("d")) { // Case 3: Use custom log file logging if configured and present else if (cmd.hasOption("cl")) { File userLogFile = new File(cmd.getOptionValue("cl", StringUtils.EMPTY)); - Reporting.reportFileExistenceChecking(Lists.newArrayList(), + ReportingFix.reportFileExistenceChecking(Lists.newArrayList(), userLogFile.toPath().toAbsolutePath()); if (userLogFile.exists() && userLogFile.isFile()) { @@ -249,7 +249,7 @@ protected String loadScript(CommandLine cmd) { // available and load its content if (cmd.hasOption(SCRIPT)) { File f = new File(cmd.getOptionValue(SCRIPT, StringUtils.EMPTY)); - Reporting.reportFileExistenceChecking(Lists.newArrayList(), + ReportingFix.reportFileExistenceChecking(Lists.newArrayList(), f.toPath().toAbsolutePath()); if (f.exists() && f.isFile()) { diff --git a/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/ReportingFix.java b/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/ReportingFix.java new file mode 100644 index 0000000000..008d572c85 --- /dev/null +++ b/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/ReportingFix.java @@ -0,0 +1,792 @@ +/* (c) https://github.com/MontiCore/monticore */ +package de.monticore.generating.templateengine.reporting; + +import de.monticore.ast.ASTNode; +import de.monticore.generating.templateengine.HookPoint; +import de.monticore.generating.templateengine.TemplateController; +import de.monticore.generating.templateengine.reporting.commons.ReportLogHookFix; +import de.monticore.generating.templateengine.reporting.commons.ReportManager.ReportManagerFactory; +import de.monticore.io.paths.MCPath; +import de.monticore.symboltable.IScope; +import de.se_rwth.commons.logging.Log; + +import java.net.URL; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +/** + * TODO: Remove after 7.7.0 release + * Future-porting the reporting-logger-changes, copy of Reporting.java + * --- + * Facade for all reporting activities. Invoking a report method causes all + * AReporter implementing this method to execute it. + */ +public class ReportingFix extends Log { + + /* whether reporting is enabled at the moment */ + protected static boolean enabled = false; + + /* the currently active model for which reporting takes place */ + protected static String currentModel; + + public static String getCurrentModel() { + return currentModel; + } + + @Deprecated + public static void init(String outputDirectory, String reportDirectory, ReportManagerFactory factory) { + if (outputDirectory == null || outputDirectory.isEmpty()) { + Log.error("0xA4050 Output directory must not be null or empty."); + } + if (reportDirectory == null || reportDirectory.isEmpty()) { + Log.error("0xA4052 ReportDirectory directory must not be null or empty."); + } + if (factory == null) { + Log.error("0xA4051 Report manager factory must not be null."); + } + init(reportDirectory, factory); + } + + public static boolean wasInitialized = false; + + public static void init(String reportDirectory, ReportManagerFactory factory) { + Log.ensureInitialization(); + addReportHook(new ReportLogHookFix(reportDirectory, factory)); + wasInitialized = true; + } + + public static boolean isInitialized() { + // We probably should check if a ReportLogHookFix is present in the Log + return wasInitialized; + } + + + public static void resetInitializedFlagFix() { + // Unset the wasInitialized flag - can be removed once #isInitialized is realized as described + wasInitialized = false; + } + + /** + * @return whether reporting is currently enabled + */ + public static boolean isEnabled() { + return enabled; + } + + /** + * Enable reporting for the given model name. + * + * @param modelName for which to enable reporting + * @return whether reporting is enabled or not (reporting will not be enabled + * if reporting was not previously initialized) + */ + public static boolean on(String modelName) { + if (modelName == null || modelName.isEmpty()) { + Log.error("0xA4109 Must specify valid model name for reporting."); + } + + currentModel = modelName; + enabled = true; + + return isEnabled(); + } + + /** + * Disable reporting entirely. + * + * @return the currently active model name for which reporting was active + */ + public static String off() { + enabled = false; + if (currentModel != null) { + return currentModel; + } + return ""; + } + + static List reportHooks = new ArrayList<>(); + + protected static List getReportHooks() { + return reportHooks; + } + + public static void addReportHook(ReportLogHookFix reportHook) { + reportHooks.add(reportHook); + } + + /** + * Clears the current report hooks, e.g. at the end of a tool call + * Note: This does not report the clearing of the hooks! + */ + public static void clearReportHooks() { + reportHooks.clear(); + } + + public static void reportTransformationStart(String transformationName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationStart(transformationName); + } + } + } + + public static void reportTransformationObjectMatch(String transformationName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationObjectMatch(transformationName, ast); + } + } + } + + public static void reportTransformationOldValue(String transformationName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationOldValue(transformationName, ast); + } + } + } + + public static void reportTransformationNewValue(String transformationName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationNewValue(transformationName, ast); + } + } + } + + public static void reportTransformationOldValue(String transformationName, String value) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationOldValue(transformationName, value); + } + } + } + + public static void reportTransformationNewValue(String transformationName, String value) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationNewValue(transformationName, value); + } + } + } + + public static void reportTransformationOldValue(String transformationName, boolean value) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationOldValue(transformationName, value); + } + } + } + + public static void reportTransformationNewValue(String transformationName, boolean value) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationNewValue(transformationName, value); + } + } + } + + public static void reportTransformationObjectChange(String transformationName, ASTNode ast, String attributeName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationObjectChange(transformationName, ast, attributeName); + } + } + } + + public static void reportTransformationObjectCreation(String transformationName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationObjectCreation(transformationName, ast); + } + } + } + + public static void reportTransformationObjectDeletion(String transformationName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTransformationObjectDeletion(transformationName, ast); + } + } + } + + public static void reportModelStart(ASTNode ast, String modelName, String fileName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportModelStart(ast, modelName, fileName); + } + } + } + + /** + * Reports the execution of templates + */ + public static void reportTemplateStart(String templateName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTemplateStart(templateName, ast); + } + } + } + + /** + * Reports the execution of a standard template that is wrapped into a + * template hook point, + */ + public static void reportExecuteStandardTemplate(String templateName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportExecuteStandardTemplate(templateName, ast); + } + } + } + + /** + * Reports a template based file creation via the + * {@link TemplateController#writeArgs(String, String, String, ASTNode, List) + * writeArgs} method of the + * {@link TemplateController + * TemplateController}. + */ + public static void reportFileCreation(String templateName, Path path, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportFileCreation(templateName, path, ast); + } + } + } + + /** + * Reports a file creation + */ + public static void reportFileCreation(Path parentPath, Path file) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportFileCreation(parentPath, file); + } + } + } + + /** + * Reports a file creation + */ + public static void reportFileCreation(String fileName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportFileCreation(fileName); + } + } + } + + /** + * Reports the end of a file creation (file finalization). + */ + public static void reportFileFinalization(String templateName, Path path, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportFileFinalization(templateName, path, ast); + } + } + } + + /** + * Reports a template based file creation. + */ + public static void reportFileCreation(String templateName, String qualifiedFilename, + String fileExtension, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportFileCreation(templateName, qualifiedFilename, fileExtension, ast); + } + } + } + + /** + * Reports the end of a file creation (file finalization). + */ + public static void reportFileFinalization(String templateName, String qualifiedFilename, + String fileExtension, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportFileFinalization(templateName, qualifiedFilename, fileExtension, ast); + } + } + } + + /** + * Reports a checking of file existence + */ + public static void reportFileExistenceChecking(List parentPath, Path file) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportFileExistenceChecking(parentPath, file); + } + } + } + + /** + * Reports the end of a template execution. + */ + public static void reportTemplateEnd(String templateName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTemplateEnd(templateName, ast); + } + } + } + + public static void reportModelEnd(String modelName, String fileName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportModelEnd(modelName, fileName); + } + } + } + + public static void reportModelLoad(String qualifiedName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportModelLoad(qualifiedName); + } + } + } + + public static void reportSetValue(String name, Object value) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportSetValue(name, value); + } + } + } + + public static void reportInstantiate(String className, List params) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportInstantiate(className, params); + } + } + } + + public static void reportMethodCall(String className, String methodName, List params) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportMethodCall(className, methodName, params); + } + } + } + + /** + * Reports template inclusion. + */ + public static void reportTemplateInclude(String templateName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTemplateInclude(templateName, ast); + } + } + } + + /** + * Reports the template write. TemplateWrite does not calculate forwardings, it + * processes the template instantly. + */ + public static void reportTemplateWrite(String templateName, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTemplateWrite(templateName, ast); + } + } + } + + /** + * Reports the registration of a hook point via the + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#defineHookPoint(TemplateController, String)} (String, HookPoint) + * setHookPoint} method of the + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement + * GlobalExtensionManagement}. + */ + public static void reportSetHookPoint(String hookName, HookPoint hp) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportSetHookPoint(hookName, hp); + } + } + } + + /** + * Reports the execution of a hook point via the + * callHookPoint} method. This does not include the execution of hook points + * registered by the setBefore, setAfter or replaceTemplate Methods, nor the + * execution of AST specific hook points. + */ + public static void reportCallHookPointStart(String hookName, HookPoint hp, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportCallHookPointStart(hookName, hp, ast); + } + } + } + + /** + * Reports the end of the execution of a hook point via the + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#bindHookPoint(String, HookPoint)} (TemplateController, String, ASTNode) + * callHookPoint} method. + */ + public static void reportCallHookPointEnd(String hookName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportCallHookPointEnd(hookName); + } + } + } + + /** + * Reports the execution of hook points via the + * {@link TemplateController#include(List, List) + * include} or + * {@link TemplateController#includeArgs(String, List) + * includeArgs} method of the + * {@link TemplateController + * TemplateController}. This includes the execution of all hook points + * registered by setAfter. + */ + public static void reportCallAfterHookPoint(String oldTemplate, Collection afterHps, + ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportCallAfterHookPoint(oldTemplate, afterHps, ast); + } + } + } + + /** + * Reports the execution of hook points via the + * {@link TemplateController#include(List, List) + * include} or + * {@link TemplateController#includeArgs(String, List) + * includeArgs} method of the + * {@link TemplateController + * TemplateController}. This includes the execution of all hook points + * registered by setBefore. + */ + public static void reportCallBeforeHookPoint(String oldTemplate, Collection beforeHps, + ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportCallBeforeHookPoint(oldTemplate, beforeHps, ast); + } + } + } + + /** + * Reports the execution of hook points via the + * {@link TemplateController#include(List, List) + * include} or + * {@link TemplateController#includeArgs(String, List) + * includeArgs} method of the + * {@link TemplateController + * TemplateController}. This includes the execution of all hook points + * registered by setReplace. These hook points replace a template. + */ + public static void reportCallReplacementHookPoint(String oldTemplate, List hps, + ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportCallReplacementHookPoint(oldTemplate, hps, ast); + } + } + } + + /** + * Reports the execution of hook points via the + * {@link TemplateController#include(List, List) + * include} or + * {@link TemplateController#includeArgs(String, List) + * includeArgs} method of the + * {@link TemplateController + * TemplateController}. This includes the execution of all hook points + * registered by setASTSpecificReplacement. + */ + public static void reportCallSpecificReplacementHookPoint(String oldTemplate, + List hps, ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportCallSpecificReplacementHookPoint(oldTemplate, hps, ast); + } + } + } + + /** + * Reports the replacement of a template by an AST hook point via the + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#replaceTemplate(String, ASTNode, HookPoint) + * replaceTemplate} method of the + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement + * GlobalExtensionManagement}. This does not include any other assignment or + * replacement. + */ + public static void reportASTSpecificTemplateReplacement(String oldTemplate, ASTNode node, + HookPoint newHp) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportASTSpecificTemplateReplacement(oldTemplate, node, newHp); + } + } + } + + /** + * Reports the replacement of a template by hook points via the + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#replaceTemplate(String, List) + * replaceTemplate} method of the + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement + * GlobalExtensionManagement}. This does not include any other assignment or + * replacement. + */ + public static void reportTemplateReplacement(String oldTemplate, List newHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportTemplateReplacement(oldTemplate, newHps); + } + } + } + + + /** + * Reports the assignment of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setBeforeTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ + /* TODO: Re-add once #4095 is upstream (7.7.0 release) + public static void reportSetBeforeTemplate(String template, Optional ast, List beforeHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportSetBeforeTemplate(template, ast, beforeHps); + } + } + } + + /** + * Reports the addition of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ + /* TODO: Re-add once #4095 is upstream (7.7.0 release) + public static void reportSetAfterTemplate(String template, Optional ast, List afterHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportSetAfterTemplate(template, ast, afterHps); + } + } + } + */ + + /** + * Reports the assignment of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setBeforeTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ + public static void reportSetBeforeTemplate(String template, List beforeHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportSetBeforeTemplate(template, beforeHps); + } + } + } + + /** + * Reports the addition of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ + public static void reportSetAfterTemplate(String template, List afterHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportSetAfterTemplate(template, afterHps); + } + } + } + + public static void reportUseHandwrittenCodeFile(Path parentDir, Path fileName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportUseHandwrittenCodeFile(parentDir, fileName); + } + } + } + + + /** + * Reports the assignment of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ /* TODO: Re-add once #4095 is upstream (7.7.0 release) + public static void reportAddAfterTemplate(String template, Optional ast, List afterHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportAddAfterTemplate(template, ast, afterHps); + } + } + } + + /** + * Reports the assignment of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ /* TODO: Re-add once #4095 is upstream (7.7.0 release) + public static void reportAddBeforeTemplate(String template, Optional ast, List afterHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportAddBeforeTemplate(template, ast, afterHps); + } + } + } + */ + + /** + * Reports the assignment of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ /* TODO: Re-add once #4095 is upstream (7.7.0 release) + public static void reportAddAfterTemplate(String template, Optional ast, List afterHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportAddAfterTemplate(template, ast, afterHps); + } + } + } + + /** + * Reports the assignment of hook points to a template via + * {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}. + * This does not include any other assignment or replacement. + */ /* TODO: Re-add once #4095 is upstream (7.7.0 release) + public static void reportAddBeforeTemplate(String template, Optional ast, List afterHps) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportAddBeforeTemplate(template, ast, afterHps); + } + } + } + + /** + * Reports the check for existence of an artifact + */ + public static void reportHWCExistenceCheck(MCPath mcp, Path fileName, Optional resolvedPath) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportHWCExistenceCheck(mcp, fileName, resolvedPath); + } + } + } + + public static void reportUserSpecificTemplate(Path parentDir, Path fileName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportUserSpecificTemplate(parentDir, fileName); + } + } + } + + public static void reportAddValue(String name, Object value, int size) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportAddValue(name, value, size); + } + } + } + + /** + * Invoking this method causes a report of value to DetailedReporter. + * + * @param value that will be reported in DetailedReporter + */ + public static void reportToDetailed(String value) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportDetailed(value); + } + } + + /** + * This method is called when an input file is opened which is obtained via + * model resolution. Such files typically are dependency models (e.g., super + * grammars, super CDs, ...). + */ + public static void reportOpenInputFile(Optional parentPath, Path file) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportOpenInputFile(parentPath, file); + } + } + } + + /** + * This method is called when an input file is opened which is obtained via + * model resolution. Such files typically are dependency models (e.g., super + * grammars, super CDs, ...). + */ + public static void reportOpenInputFile(String fileName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportOpenInputFile(fileName); + } + } + } + + /** + * This method is called when an input file is parsed; i.e., this report hook + * point is designed for the main input artifacts only. E.g., files that are + * loaded on demand during further processing should not report using this + * method but {@link #reportOpenInputFile(Optional, Path)} instead. + */ + public static void reportParseInputFile(Path inputFilePath, String modelName) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportParseInputFile(inputFilePath, modelName); + } + } + } + + /** + * This method is called to report the content of the symbol table. The method + * should only be called once during the execution of the generator. + */ + public static void reportSymbolTableScope(IScope scope) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportSymbolTableScope(scope); + } + } + } + + /** + * Invoking this method causes all AReporter to close their files and all + * OneTimeReporter to write their content into files. + * + * @param ast the root node of the reported ast, may be null on error + */ + public static void flush(ASTNode ast) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.flush(ast); + } + } + } + + public static void reportWarning(String msg) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportWarning(msg); + } + } + } + + public static void reportError(String msg) { + if (isEnabled()) { + for (ReportLogHookFix hook : getReportHooks()) { + hook.reportError(msg); + } + } + } +} diff --git a/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/commons/ReportLogHookFix.java b/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/commons/ReportLogHookFix.java new file mode 100644 index 0000000000..f52470c526 --- /dev/null +++ b/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/commons/ReportLogHookFix.java @@ -0,0 +1,422 @@ +/* (c) https://github.com/MontiCore/monticore */ +package de.monticore.generating.templateengine.reporting.commons; + +import de.monticore.ast.ASTNode; +import de.monticore.generating.templateengine.HookPoint; +import de.monticore.generating.templateengine.reporting.ReportingFix; +import de.monticore.generating.templateengine.reporting.artifacts.ReportingNameHelper; +import de.monticore.io.paths.MCPath; +import de.monticore.symboltable.IScope; +import de.se_rwth.commons.logging.Finding; +import de.se_rwth.commons.logging.ILogHook; + +import java.net.URL; +import java.nio.file.Path; +import java.util.*; + +// TODO: Remove after 7.7.0 release +// Future-porting the reporting-logger-changes, copy of ReportLogHook.java +@Deprecated +public class ReportLogHookFix implements ILogHook, IReportEventHandler { + + /** + * @param reportDirectory for storing the reports + * @param factory for creating specific report manager configurations + */ + public ReportLogHookFix(String reportDirectory, + ReportManager.ReportManagerFactory factory) { + this.reportDirectory = reportDirectory; + this.factory = factory; + } + + @Override + public void doPrintln(String msg) { + + } + + @Override + public void doErrPrint(String msg) { + this.getReportManager().reportError(msg); + flush(null); + } + + @Override + public void doWarn(Finding warn) { + this.getReportManager().reportWarning(String.format("[WARN] %s", warn)); + } + + @Override + public void doWarn(Finding warn, Throwable t) { + ILogHook.super.doWarn(warn, t); + } + + @Override + public void doPrintStackTrace(Throwable t) { + + } + + @Override + public void doErrPrintStackTrace(Throwable t) { + + } + + @Override + public void doPrint(String msg) { + + } + + /** + * Map of model names to actual report managers. + */ + protected Map reportManagers = new HashMap<>(); + + protected Map getReportManagers() { + return this.reportManagers; + } + + protected ReportManager getReportManager(String modelName) { + if (!this.getReportManagers().containsKey(modelName)) { + ReportManager repoMan = this.getFactory().provide(modelName); + this.getReportManagers().put(modelName, repoMan); + } + return this.getReportManagers().get(modelName); + } + + /** + * @return the currently active/responsible report manager instance + */ + protected ReportManager getReportManager() { + return getReportManager(ReportingFix.getCurrentModel()); + } + + /** + * For creating report managers on-demand for newly processed models. + */ + protected ReportManager.ReportManagerFactory factory; + + protected ReportManager.ReportManagerFactory getFactory() { + return this.factory; + } + + /** + * Where reports will be written to. + */ + protected String reportDirectory; + + protected String getReportDirectory() { + return this.reportDirectory; + } + + @Override + public void reportModelStart(ASTNode ast, + String modelName, + String fileName) { + this.getReportManager().reportModelStart(ast, modelName, fileName); + } + + @Override + public void reportTemplateStart(String templatename, ASTNode ast) { + this.getReportManager().reportTemplateStart(templatename, ast); + } + + @Override + public void reportExecuteStandardTemplate(String templatename, ASTNode ast) { + this.getReportManager().reportExecuteStandardTemplate(templatename, ast); + } + + @Override + public void reportFileCreation(String templatename, + String qualifiedfilename, + String fileextension, ASTNode ast) { + this.getReportManager().reportFileCreation(templatename, qualifiedfilename, fileextension, ast); + } + + public void reportFileCreation(String templateName, Path path, ASTNode ast) { + this.getReportManager().reportFileCreation(templateName, path, ast); + } + + @Override + public void reportFileCreation(Path parentPath, Path file) { + this.getReportManager().reportFileCreation(parentPath, file); + } + + @Override + public void reportFileFinalization(String templatename, + String qualifiedfilename, + String fileextension, + ASTNode ast) { + this.getReportManager().reportFileFinalization(templatename, qualifiedfilename, fileextension, ast); + } + + public void reportFileFinalization(String templateName, + Path path, + ASTNode ast) { + String qualifiedName = ReportingNameHelper.getQualifiedName(this.getReportDirectory(), path); + String fileExtension = ReportingNameHelper.getFileextension(path); + + this.getReportManager().reportFileFinalization(templateName, qualifiedName, fileExtension, ast); + } + + @Override + public void reportTemplateEnd(String templatename, ASTNode ast) { + this.getReportManager().reportTemplateEnd(templatename, ast); + } + + @Override + public void reportModelEnd(String modelname, String filename) { + this.getReportManager().reportModelEnd(modelname, filename); + } + + @Override + public void reportModelLoad(String qualifiedName) { + this.getReportManager().reportModelLoad(qualifiedName); + } + + @Override + public void reportSetValue(String name, Object value) { + this.getReportManager().reportSetValue(name, value); + } + + @Override + public void reportAddValue(String name, Object value, int size) { + this.getReportManager().reportAddValue(name, value, size); + } + + @Override + public void reportInstantiate(String className, List params) { + this.getReportManager().reportInstantiate(className, params); + } + + @Override + public void reportTemplateInclude(String templateName, ASTNode ast) { + this.getReportManager().reportTemplateInclude(templateName, ast); + } + + @Override + public void reportTemplateWrite(String templateName, ASTNode ast) { + this.getReportManager().reportTemplateWrite(templateName, ast); + } + + @Override + public void reportSetHookPoint(String hookName, HookPoint hp) { + this.getReportManager().reportSetHookPoint(hookName, hp); + } + + @Override + public void reportCallHookPointStart(String hookName, HookPoint hp, ASTNode ast) { + this.getReportManager().reportCallHookPointStart(hookName, hp, ast); + } + + @Override + public void reportCallHookPointEnd(String hookName) { + this.getReportManager().reportCallHookPointEnd(hookName); + } + + @Override + public void reportASTSpecificTemplateReplacement(String oldTemplate, ASTNode node, HookPoint newHp) { + this.getReportManager().reportASTSpecificTemplateReplacement(oldTemplate, node, newHp); + } + + @Override + public void reportCallSpecificReplacementHookPoint(String oldTemplate, List hps, ASTNode ast) { + this.getReportManager().reportCallSpecificReplacementHookPoint(oldTemplate, hps, ast); + } + + @Override + public void reportCallReplacementHookPoint(String oldTemplate, List hps, ASTNode ast) { + this.getReportManager().reportCallReplacementHookPoint(oldTemplate, hps, ast); + } + + @Override + public void reportCallBeforeHookPoint(String oldTemplate, Collection beforeHPs, ASTNode ast) { + this.getReportManager().reportCallBeforeHookPoint(oldTemplate, beforeHPs, ast); + } + + @Override + public void reportCallAfterHookPoint(String oldTemplate, Collection afterHPs, ASTNode ast) { + this.getReportManager().reportCallAfterHookPoint(oldTemplate, afterHPs, ast); + } + + @Override + public void reportTemplateReplacement(String oldTemplate, List newHps) { + this.getReportManager().reportTemplateReplacement(oldTemplate, newHps); + } + + + /* TODO: Re-add once #4095 is upstream (7.7.0 release) + @Override + public void reportSetBeforeTemplate(String template, Optional ast, List beforeHps) { + this.getReportManager().reportSetBeforeTemplate(template, ast, beforeHps); + } + @Override + public void reportSetAfterTemplate(String template, Optional ast, List afterHps) { + this.getReportManager().reportSetAfterTemplate(template, ast, afterHps); + } + + @Override + public void reportAddAfterTemplate(String template, Optional ast, List afterHps) { + this.getReportManager().reportAddAfterTemplate(template, ast, afterHps); + } + + @Override + public void reportAddBeforeTemplate(String template, Optional ast, List beforeHps) { + this.getReportManager().reportAddBeforeTemplate(template, ast, beforeHps); + } + */ + + @Override + public void reportSetBeforeTemplate(String template, List beforeHps) { + this.getReportManager().reportSetBeforeTemplate(template, beforeHps); + } + + @Override + public void reportSetAfterTemplate(String template, List afterHps) { + this.getReportManager().reportSetAfterTemplate(template, afterHps); + } + + @Override + public void reportAddAfterTemplate(String template, List afterHps) { + this.getReportManager().reportAddAfterTemplate(template, afterHps); + } + + + @Override + public void reportTransformationStart(String transformationName) { + this.getReportManager().reportTransformationStart(transformationName); + } + + @Override + public void flush(ASTNode ast) { + this.getReportManager().flush(ast); + } + + @Override + public void reportUseHandwrittenCodeFile(Path parentDir, Path fileName) { + this.getReportManager().reportUseHandwrittenCodeFile(parentDir, fileName); + } + + @Override + public void reportHWCExistenceCheck(MCPath mcp, Path fileName, Optional exists) { + this.getReportManager().reportHWCExistenceCheck(mcp, fileName, exists); + } + + @Override + public void reportUserSpecificTemplate(Path parentDir, Path fileName) { + this.getReportManager().reportUserSpecificTemplate(parentDir, fileName); + } + + @Override + public void reportWarning(String message) { + this.getReportManager().reportWarning(message); + } + + @Override + public void reportUserWarning(String message) { + this.getReportManager().reportUserWarning(message); + } + + @Override + public void reportError(String message) { + this.getReportManager().reportError(message); + } + + @Override + public void reportErrorUser(String message) { + this.getReportManager().reportErrorUser(message); + } + + @Override + public void reportErrorInternal(String message) { + this.getReportManager().reportErrorInternal(message); + } + + @Override + public void reportTransformationObjectChange(String transformationName, ASTNode ast, String attributeName) { + this.getReportManager().reportTransformationObjectChange(transformationName, ast, attributeName); + } + + @Override + public void reportTransformationObjectCreation(String transformationName, ASTNode ast) { + this.getReportManager().reportTransformationObjectCreation(transformationName, ast); + } + + @Override + public void reportTransformationObjectDeletion(String transformationName, ASTNode ast) { + this.getReportManager().reportTransformationObjectDeletion(transformationName, ast); + } + + @Override + public void reportDetailed(String value) { + this.getReportManager().reportDetailed(value); + } + + @Override + public void reportOpenInputFile(Optional parentPath, Path file) { + this.getReportManager().reportOpenInputFile(parentPath, file); + } + + @Override + public void reportParseInputFile(Path inputFilePath, String modelName) { + this.getReportManager().reportParseInputFile(inputFilePath, modelName); + } + + @Override + public void reportSymbolTableScope(IScope scope) { + this.getReportManager().reportSymbolTableScope(scope); + } + + @Override + public void reportMethodCall(String className, String methodName, List params) { + this.getReportManager().reportMethodCall(className, methodName, params); + } + + @Override + public void reportTransformationObjectMatch(String transformationName, ASTNode ast) { + this.getReportManager().reportTransformationObjectMatch(transformationName, ast); + } + + @Override + public void reportTransformationOldValue(String transformationName, ASTNode ast) { + this.getReportManager().reportTransformationOldValue(transformationName, ast); + } + + @Override + public void reportTransformationNewValue(String transformationName, ASTNode ast) { + this.getReportManager().reportTransformationNewValue(transformationName, ast); + } + + @Override + public void reportTransformationOldValue(String transformationName, String value) { + this.getReportManager().reportTransformationOldValue(transformationName, value); + } + + @Override + public void reportTransformationNewValue(String transformationName, String value) { + this.getReportManager().reportTransformationNewValue(transformationName, value); + } + + @Override + public void reportTransformationOldValue(String transformationName, boolean value) { + this.getReportManager().reportTransformationOldValue(transformationName, value); + } + + @Override + public void reportTransformationNewValue(String transformationName, boolean value) { + this.getReportManager().reportTransformationNewValue(transformationName, value); + } + + @Override + public void reportFileCreation(String fileName) { + this.getReportManager().reportFileCreation(fileName); + } + + @Override + public void reportOpenInputFile(String fileName) { + this.getReportManager().reportOpenInputFile(fileName); + } + + @Override + public void reportFileExistenceChecking(List parentPath, Path file) { + this.getReportManager().reportFileExistenceChecking(parentPath, file); + } +} diff --git a/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/fix/Reporting.java b/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/fix/Reporting.java new file mode 100644 index 0000000000..db2f003d83 --- /dev/null +++ b/monticore-generator/src/main/java/de/monticore/generating/templateengine/reporting/fix/Reporting.java @@ -0,0 +1,20 @@ +/* (c) https://github.com/MontiCore/monticore */ +package de.monticore.generating.templateengine.reporting.fix; + +import de.monticore.generating.templateengine.reporting.ReportingFix; +import de.monticore.generating.templateengine.reporting.commons.ReportManager; + +/** + * TODO: Remove after 7.7.0 release + * Enables the groovy scripts to use "Reporting" instead of having to use + * "ReportingFix" + */ +@Deprecated(forRemoval = true) +public class Reporting extends ReportingFix { + @Deprecated + public static void init(String outputDirectory, String reportDirectory, ReportManager.ReportManagerFactory factory) { + // Delegate to static + ReportingFix.init(outputDirectory, reportDirectory, factory); + } + +} diff --git a/monticore-generator/src/main/java/de/monticore/gradle/gen/MCGradleTool.java b/monticore-generator/src/main/java/de/monticore/gradle/gen/MCGradleTool.java new file mode 100644 index 0000000000..e9f7d7514d --- /dev/null +++ b/monticore-generator/src/main/java/de/monticore/gradle/gen/MCGradleTool.java @@ -0,0 +1,20 @@ +/* (c) https://github.com/MontiCore/monticore */ +package de.monticore.gradle.gen; + +import de.monticore.cli.MontiCoreTool; +import de.monticore.gradle.common.GradleLog; +import de.monticore.grammar.grammar_withconcepts.Grammar_WithConceptsMill; + +public class MCGradleTool extends MontiCoreTool { + + /** + * Main method entry that configures and runs the MontiCore tool. + * + * @param args The input parameters for configuring the MontiCore tool + */ + public static void main(String[] args) { + GradleLog.init(); + Grammar_WithConceptsMill.init(); + new MCGradleTool().run(args); + } +} diff --git a/monticore-generator/src/main/java/de/monticore/gradle/gen/MCToolInvoker.java b/monticore-generator/src/main/java/de/monticore/gradle/gen/MCToolInvoker.java index 5a11eeb3e8..012529d6ba 100644 --- a/monticore-generator/src/main/java/de/monticore/gradle/gen/MCToolInvoker.java +++ b/monticore-generator/src/main/java/de/monticore/gradle/gen/MCToolInvoker.java @@ -2,8 +2,8 @@ package de.monticore.gradle.gen; import de.monticore.AmbiguityException; -import de.monticore.cli.MontiCoreTool; import de.monticore.generating.templateengine.freemarker.MontiCoreFreeMarkerException; +import de.monticore.generating.templateengine.reporting.ReportingFix; import de.monticore.grammar.MCGrammarSymbolTableHelper; import de.monticore.grammar.grammar_withconcepts.Grammar_WithConceptsMill; import de.monticore.mcbasics.MCBasicsMill; @@ -13,7 +13,7 @@ import java.util.Arrays; /** - * This class contains a method which actually calls the {@link MontiCoreTool}. + * This class contains a method which actually calls the {@link MCGradleTool}. * It will be called by either the {@link MCToolAction} or the {@link MCGenTask} * itself, if debugging is enabled. * We isolate the method into its own class, to enable classloader isolation. @@ -34,10 +34,10 @@ public static void run(String[] args) { // resulting in blocked mc-tool-"main" threads, inducing extra overhead somewhere in the JVM // due to switching threads all trying to access the same .jar file. // We thus preload some classes in a synchronized block (its monitor is being shared across isolation borders) - MontiCoreTool.preLoad(); + MCGradleTool.preLoad(); }); try { - MontiCoreTool.main(args); + MCGradleTool.main(args); }catch (final AmbiguityException | MontiCoreFreeMarkerException e) { RuntimeException newThrow = e; if (e.getCause() instanceof AmbiguityException) { // Freemarker adds special Freemarker Exceptions @@ -51,6 +51,7 @@ public static void run(String[] args) { MCBasicsMill.globalScope().clearLoadedFiles(); MCBasicsMill.globalScope().getSymbolPath().close(); Grammar_WithConceptsMill.reset(); + ReportingFix.resetInitializedFlagFix(); } } } diff --git a/monticore-generator/src/main/java/de/monticore/tagging/TagGenerator.java b/monticore-generator/src/main/java/de/monticore/tagging/TagGenerator.java index c1f45ec23f..cb9b778bf0 100644 --- a/monticore-generator/src/main/java/de/monticore/tagging/TagGenerator.java +++ b/monticore-generator/src/main/java/de/monticore/tagging/TagGenerator.java @@ -3,7 +3,7 @@ import com.google.common.base.Joiner; import de.monticore.codegen.cd2java._tagging.TaggingConstants; -import de.monticore.generating.templateengine.reporting.Reporting; +import de.monticore.generating.templateengine.reporting.ReportingFix; import de.monticore.grammar.grammar.GrammarMill; import de.monticore.grammar.grammar._ast.ASTMCGrammar; import de.monticore.grammar.grammar._visitor.GrammarTraverser; @@ -76,7 +76,7 @@ static Path saveGrammar(ASTMCGrammar defDerivGrammar, Grammar_WithConceptsFullPr Files.createDirectories(Paths.get(directories)); } Path path = Paths.get(directories + "/" + defDerivGrammar.getName() + ".mc4"); - Reporting.reportFileCreation(path.toString()); + ReportingFix.reportFileCreation(path.toString()); return Files.writeString(path, fpp.prettyprint(defDerivGrammar)); } diff --git a/monticore-generator/src/test/java/de/monticore/MontiCoreScriptTest.java b/monticore-generator/src/test/java/de/monticore/MontiCoreScriptTest.java index 0a9b0ca050..795f8a754c 100644 --- a/monticore-generator/src/test/java/de/monticore/MontiCoreScriptTest.java +++ b/monticore-generator/src/test/java/de/monticore/MontiCoreScriptTest.java @@ -17,7 +17,7 @@ import de.monticore.codegen.mc2cd.TestHelper; import de.monticore.generating.GeneratorSetup; import de.monticore.generating.templateengine.GlobalExtensionManagement; -import de.monticore.generating.templateengine.reporting.Reporting; +import de.monticore.generating.templateengine.reporting.ReportingFix; import de.monticore.grammar.grammar._ast.ASTMCGrammar; import de.monticore.grammar.grammar_withconcepts.Grammar_WithConceptsMill; import de.monticore.grammar.grammar_withconcepts._symboltable.Grammar_WithConceptsGlobalScope; @@ -317,7 +317,7 @@ private void testDefaultScript(String[] args) { new MontiCoreScript().run(cfg); // Reporting is enabled in the monticore_standard.groovy script but needs to be disabled for other tests // because Reporting is static directly disable it again here - Reporting.off(); + ReportingFix.off(); Assertions.assertTrue(!false); } @@ -335,7 +335,7 @@ private void testDefaultScriptWithEmf(String[] args) { new MontiCoreScript().run_emf(cfg); // Reporting is enabled in the monticore_standard.groovy script but needs to be disabled for other tests // because Reporting is static directly disable it again here - Reporting.off(); + ReportingFix.off(); Assertions.assertTrue(!false); } diff --git a/monticore-generator/src/test/java/de/monticore/cli/MontiCoreToolTest.java b/monticore-generator/src/test/java/de/monticore/cli/MontiCoreToolTest.java index 676cfc022d..334a2a7812 100644 --- a/monticore-generator/src/test/java/de/monticore/cli/MontiCoreToolTest.java +++ b/monticore-generator/src/test/java/de/monticore/cli/MontiCoreToolTest.java @@ -3,7 +3,7 @@ package de.monticore.cli; import de.monticore.cd4code.CD4CodeMill; -import de.monticore.generating.templateengine.reporting.Reporting; +import de.monticore.generating.templateengine.reporting.ReportingFix; import de.monticore.grammar.grammar_withconcepts.Grammar_WithConceptsMill; import de.se_rwth.commons.logging.Log; import de.se_rwth.commons.logging.LogStub; @@ -250,6 +250,6 @@ public void generateGrammarAndCheckFiles(Path path, String grammar) throws IOExc @AfterEach public void tearDown() throws Exception { - Reporting.off(); + ReportingFix.off(); } } diff --git a/monticore-generator/src/test/java/de/monticore/codegen/parser/ParserGeneratorTest.java b/monticore-generator/src/test/java/de/monticore/codegen/parser/ParserGeneratorTest.java index 7358e57faa..d8fc29f634 100644 --- a/monticore-generator/src/test/java/de/monticore/codegen/parser/ParserGeneratorTest.java +++ b/monticore-generator/src/test/java/de/monticore/codegen/parser/ParserGeneratorTest.java @@ -5,7 +5,7 @@ import de.monticore.MontiCoreScript; import de.monticore.cd4code.CD4CodeMill; import de.monticore.generating.templateengine.GlobalExtensionManagement; -import de.monticore.generating.templateengine.reporting.Reporting; +import de.monticore.generating.templateengine.reporting.ReportingFix; import de.monticore.grammar.MCGrammarSymbolTableHelper; import de.monticore.grammar.grammar._ast.ASTMCGrammar; import de.monticore.grammar.grammar._symboltable.MCGrammarSymbol; @@ -183,9 +183,9 @@ private ASTMCGrammar createSymbolsFromAST(IGrammar_WithConceptsGlobalScope globa MCGrammarSymbol symbol = result.getSymbol(); for (MCGrammarSymbol it : MCGrammarSymbolTableHelper.getAllSuperGrammars(symbol)) { if (!it.getFullName().equals(symbol.getFullName())) { - Reporting.reportOpenInputFile(Optional.empty(), + ReportingFix.reportOpenInputFile(Optional.empty(), Paths.get(it.getFullName().replaceAll("\\.", "/").concat(".mc4"))); - Reporting.reportOpenInputFile(Optional.empty(), + ReportingFix.reportOpenInputFile(Optional.empty(), Paths.get(it.getFullName().replaceAll("\\.", "/").concat(".cd"))); } }