From 4d070a3cccd299f688b8d4a0297d7cbd484ec6e4 Mon Sep 17 00:00:00 2001 From: "jonas.boecker" Date: Wed, 26 Jul 2023 15:58:10 +0200 Subject: [PATCH] generate default access modifier of builder classes as all access --- .../cd2java/_symboltable/symbol/SymbolBuilderDecorator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/monticore-generator/src/main/java/de/monticore/codegen/cd2java/_symboltable/symbol/SymbolBuilderDecorator.java b/monticore-generator/src/main/java/de/monticore/codegen/cd2java/_symboltable/symbol/SymbolBuilderDecorator.java index 3a27b817b8..9757a12d30 100644 --- a/monticore-generator/src/main/java/de/monticore/codegen/cd2java/_symboltable/symbol/SymbolBuilderDecorator.java +++ b/monticore-generator/src/main/java/de/monticore/codegen/cd2java/_symboltable/symbol/SymbolBuilderDecorator.java @@ -12,6 +12,7 @@ import de.monticore.codegen.cd2java._ast.builder.buildermethods.BuilderMutatorMethodDecorator; import de.monticore.codegen.cd2java._symboltable.SymbolTableService; import de.monticore.generating.templateengine.GlobalExtensionManagement; +import de.monticore.generating.templateengine.StringHookPoint; import de.monticore.generating.templateengine.TemplateHookPoint; import de.monticore.types.mcbasictypes._ast.ASTMCType; import de.monticore.types.mccollectiontypes._ast.ASTMCOptionalType; @@ -22,6 +23,7 @@ import java.util.Optional; import java.util.stream.Collectors; +import static de.monticore.cd.codegen.CD2JavaTemplates.VALUE; import static de.monticore.cd.facade.CDModifier.PROTECTED; import static de.monticore.cd.facade.CDModifier.PUBLIC; import static de.monticore.cd.codegen.CD2JavaTemplates.EMPTY_BODY; @@ -139,7 +141,9 @@ protected List createSymbolAttributes(ASTCDClass symbolClass) { symbolTableService.getASTPackage() + "." + AST_PREFIX + symbolClass.getName()); attrs.add(this.getCDAttributeFacade().createAttribute(PROTECTED.build(), optionalTypeOfASTNode, AST_NODE_VAR)); - attrs.add(this.getCDAttributeFacade().createAttribute(PROTECTED.build(), ACCESS_MODIFIER, "accessModifier")); + ASTCDAttribute accessModifier = this.getCDAttributeFacade().createAttribute(PROTECTED.build(), ACCESS_MODIFIER, "accessModifier"); + this.replaceTemplate(VALUE, accessModifier, new StringHookPoint("= " + ACCESS_MODIFIER_ALL_INCLUSION)); + attrs.add(accessModifier); attrs.add(this.getCDAttributeFacade().createAttribute(PROTECTED.build(), symbolTableService.getScopeInterfaceFullName(), ENCLOSING_SCOPE_VAR));