diff --git a/gradle.properties b/gradle.properties index eac9d054c..c181e785f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ assertj_version = 3.21.0 junit_version = 5.8.2 # Version of published artifacts -version = 7.8.73 +version = 7.8.75 diff --git a/language-server/src/main/java/de/monticore/lang/sysmlv2/_lsp/commands/CreateModelCommand.java b/language-server/src/main/java/de/monticore/lang/sysmlv2/_lsp/commands/CreateModelCommand.java index 11026dd6c..48aae7307 100644 --- a/language-server/src/main/java/de/monticore/lang/sysmlv2/_lsp/commands/CreateModelCommand.java +++ b/language-server/src/main/java/de/monticore/lang/sysmlv2/_lsp/commands/CreateModelCommand.java @@ -1,6 +1,6 @@ package de.monticore.lang.sysmlv2._lsp.commands; -import de.monticore.lang.sysmlbasis._ast.ASTModifierBuilder; + import de.monticore.lang.sysmlparts._ast.ASTEnumDefBuilder; import de.monticore.lang.sysmlparts._ast.ASTPartDef; import de.monticore.lang.sysmlparts._ast.ASTPartDefBuilder; @@ -58,13 +58,13 @@ public Boolean execute(String[] args) { .addPortUsage("port1", booleanType) .addEmptyStateUsage(modelName); if (args.length == 4) { - automatonBuilder.addRefinement(new ASTPartDefBuilder().setName(args[3]).setModifier(new ASTModifierBuilder().build()).build()); + automatonBuilder.addRefinement(new ASTPartDefBuilder().setName(args[3]).setModifier(SysMLv2Mill.modifierBuilder().build()).build()); } partDef = automatonBuilder.build(); model.addSysMLElement(new ASTPartDefBuilder(partDef).build()); } else if (modelType.equalsIgnoreCase("Port Definition")) { - var portDef = new ASTPortDefBuilder().setName(modelName).setModifier(new ASTModifierBuilder().build()).build(); + var portDef = new ASTPortDefBuilder().setName(modelName).setModifier(SysMLv2Mill.modifierBuilder().build()).build(); model.addSysMLElement(portDef); } else if (modelType.equalsIgnoreCase("Enum Definition")) { diff --git a/language/src/main/grammars/de/monticore/lang/SysMLBasis.mc4 b/language/src/main/grammars/de/monticore/lang/SysMLBasis.mc4 index fa5edac2a..e62ece799 100644 --- a/language/src/main/grammars/de/monticore/lang/SysMLBasis.mc4 +++ b/language/src/main/grammars/de/monticore/lang/SysMLBasis.mc4 @@ -173,78 +173,6 @@ component grammar SysMLBasis SysMLIdentifier = "<" Name ">" ; - /** - * P.27 of 2a-OMG_Systems_Modeling_Language.PDF (though only in relation to *packages*): - * "The visibility of the membership can be specified by placing one of the keywords public, - * protected or private before the public element declaration. If the membership is public (the default), then it is - * visible outside of the namespace. If it is private, then it is not visible." - * P.29 of 2a-OMG_Systems_Modeling_Language.PDF (now relating to *imports*): - * "The visibility of an import can be specified by placing the keyword public or private before the import - * declaration. If the import is public (the default), then all the imported memberships become public for the - * importing namespace. If import is private, then the imported memberships become private relative to the - * importing namespace" - * Nowhere is the use of visibility keywords such as public, private, protected explicitly documented for any other - * elements. There exists however examples of showing its use on attributes and calculations. We therefore assume - * these modifiers to be applicable to all elements of the SysML. - * P.43 of 2a-OMG_Systems_Modeling_Language.PDF: - * "There are a number of additional properties of a usage that can be flagged by adding specific keywords to its - * declaration. If present these are always specified in the following order, before the kind keyword in the usage - * declaration. - * 1. in, out, inout - * 2. abstract - * 3. readonly - * 4. derived - * 5. end - * 6. ref" - * It is unclear if an how these modifiers relate to the visibility modifiers above. Their order differs from the - * specification in at least two official examples (ItemTest.sysml and PartTest.sysml). We therefore implement all - * these modifiers as one group and do not enforce any ordering. - * P.119 of 2a-OMG_Systems_Modeling_Language.PDF (relating to *calculations*): - * "A calculation definition or usage is declared as an action definition or usage (see 7.16.2), but using the keyword - * calc instead of action. As for an action definition or usage, directed usages declared in the body of a calculation - * definition or usage are consider to be parameters. In addition, the result parameter for a calculation definition or - * usage can be declared as an out parameter using the keyword return instead of out" - * Examples show further use of "return" in analysis cases, verification cases, and functions. Seeing as it is an - * alternative keyword to "out", we decided to implement it as a modifier. - * P.56&57 of 2a-OMG_Systems_Modeling_Language.PDF (once relating to timeslice/snapshot, once relating to individual): - * "An occurrence usage (of any kind) can be declared as a using the keyword , placed immediately before the - * kind keyword of the declaration (after any of the other usage property keywords described in 7.6.3)." - * Section 7.6.3 describes on P.43 (see above) more Modifiers. We therefore chose to implement all three keywords as - * Modifiers. - * P.57 of 2a-OMG_Systems_Modeling_Language.PDF: - * "An event occurrence usage is declared like an occurrence usage, as described in 7.9.2, 7.9.3, and 7.9.4, but using the - * kind keyword event occurrence instead of just occurrence." - * While it seemingly only applies to "real occurences", re-implementing it for anonymous references seems tedious - * compared to simply declaring it as Modifier. - * P.48 of 2a-OMG_Systems_Modeling_Language.PDF: - * "A definition or usage is specified as a variation by placing the keyword variation before its kind keyword. A - * variation is always abstract, so the abstract keyword is not used on a variation." - * Since "abstract" is already mentioned, we chose to implement this as a Modifier - * Lastly, we add all remaining modifiers previously known from the UML: final, local, static. - */ - @Override - Modifier = - Stereotype? - ( ["public"] | [public:"+"] - | ["private"] | [private:"-"] - | ["protected"] | [protected:"#"] - | ["abstract"] - | ["constant"] - | ["local"] - | ["derived"] | [derived:"/"] - | ["readonly"] | [readonly:"?"] - | ["static"] - | ["in"] | ["out"] | ["inout"] // default direction is "in" - | ["end"] - | ["ref"] - | ["return"] // only in calculation, analysis, verification, function - | ["timeslice"] // only in occurrences - | ["snapshot"] // only in occurrences - | ["individual"] // only in occurrences - | ["event"] // only in occurrences - | ["variation"] - | ["variant"] - )*; UserDefinedKeyword = {noSpace(2);} "#" MCQualifiedName ; diff --git a/language/src/main/grammars/de/monticore/lang/SysMLv2.mc4 b/language/src/main/grammars/de/monticore/lang/SysMLv2.mc4 index 16dd5d350..bc14a8d84 100644 --- a/language/src/main/grammars/de/monticore/lang/SysMLv2.mc4 +++ b/language/src/main/grammars/de/monticore/lang/SysMLv2.mc4 @@ -38,6 +38,79 @@ grammar SysMLv2 extends SysMLExpressions, FractalLiteral implements NumericLiteral = { noSpace(2) }? "." post:Digits; + /** + * P.27 of 2a-OMG_Systems_Modeling_Language.PDF (though only in relation to *packages*): + * "The visibility of the membership can be specified by placing one of the keywords public, + * protected or private before the public element declaration. If the membership is public (the default), then it is + * visible outside of the namespace. If it is private, then it is not visible." + * P.29 of 2a-OMG_Systems_Modeling_Language.PDF (now relating to *imports*): + * "The visibility of an import can be specified by placing the keyword public or private before the import + * declaration. If the import is public (the default), then all the imported memberships become public for the + * importing namespace. If import is private, then the imported memberships become private relative to the + * importing namespace" + * Nowhere is the use of visibility keywords such as public, private, protected explicitly documented for any other + * elements. There exists however examples of showing its use on attributes and calculations. We therefore assume + * these modifiers to be applicable to all elements of the SysML. + * P.43 of 2a-OMG_Systems_Modeling_Language.PDF: + * "There are a number of additional properties of a usage that can be flagged by adding specific keywords to its + * declaration. If present these are always specified in the following order, before the kind keyword in the usage + * declaration. + * 1. in, out, inout + * 2. abstract + * 3. readonly + * 4. derived + * 5. end + * 6. ref" + * It is unclear if an how these modifiers relate to the visibility modifiers above. Their order differs from the + * specification in at least two official examples (ItemTest.sysml and PartTest.sysml). We therefore implement all + * these modifiers as one group and do not enforce any ordering. + * P.119 of 2a-OMG_Systems_Modeling_Language.PDF (relating to *calculations*): + * "A calculation definition or usage is declared as an action definition or usage (see 7.16.2), but using the keyword + * calc instead of action. As for an action definition or usage, directed usages declared in the body of a calculation + * definition or usage are consider to be parameters. In addition, the result parameter for a calculation definition or + * usage can be declared as an out parameter using the keyword return instead of out" + * Examples show further use of "return" in analysis cases, verification cases, and functions. Seeing as it is an + * alternative keyword to "out", we decided to implement it as a modifier. + * P.56&57 of 2a-OMG_Systems_Modeling_Language.PDF (once relating to timeslice/snapshot, once relating to individual): + * "An occurrence usage (of any kind) can be declared as a using the keyword , placed immediately before the + * kind keyword of the declaration (after any of the other usage property keywords described in 7.6.3)." + * Section 7.6.3 describes on P.43 (see above) more Modifiers. We therefore chose to implement all three keywords as + * Modifiers. + * P.57 of 2a-OMG_Systems_Modeling_Language.PDF: + * "An event occurrence usage is declared like an occurrence usage, as described in 7.9.2, 7.9.3, and 7.9.4, but using the + * kind keyword event occurrence instead of just occurrence." + * While it seemingly only applies to "real occurences", re-implementing it for anonymous references seems tedious + * compared to simply declaring it as Modifier. + * P.48 of 2a-OMG_Systems_Modeling_Language.PDF: + * "A definition or usage is specified as a variation by placing the keyword variation before its kind keyword. A + * variation is always abstract, so the abstract keyword is not used on a variation." + * Since "abstract" is already mentioned, we chose to implement this as a Modifier + * Lastly, we add all remaining modifiers previously known from the UML: final, local, static. + */ + @Override + Modifier = + Stereotype? + ( ["public"] | [public:"+"] + | ["private"] | [private:"-"] + | ["protected"] | [protected:"#"] + | ["abstract"] + | ["constant"] + | ["local"] + | ["derived"] | [derived:"/"] + | ["readonly"] | [readonly:"?"] + | ["static"] + | ["in"] | ["out"] | ["inout"] // default direction is "in" + | ["end"] + | ["ref"] + | ["return"] // only in calculation, analysis, verification, function + | ["timeslice"] // only in occurrences + | ["snapshot"] // only in occurrences + | ["individual"] // only in occurrences + | ["event"] // only in occurrences + | ["variation"] + | ["variant"] + )*; + /** * A user-defined keyword for semantic metadata may also be used to declare a * definition or usage without using any language-defined keyword. diff --git a/language/src/main/java/de/monticore/lang/sysmlparts/_ast/ASTPartDefBuilder.java b/language/src/main/java/de/monticore/lang/sysmlparts/_ast/ASTPartDefBuilder.java index 0e58ae178..ea1984f26 100644 --- a/language/src/main/java/de/monticore/lang/sysmlparts/_ast/ASTPartDefBuilder.java +++ b/language/src/main/java/de/monticore/lang/sysmlparts/_ast/ASTPartDefBuilder.java @@ -3,7 +3,7 @@ import de.monticore.ast.Comment; import de.monticore.expressions.expressionsbasis._ast.ASTLiteralExpressionBuilder; import de.monticore.lang.sysmlbasis._ast.ASTDefaultValueBuilder; -import de.monticore.lang.sysmlbasis._ast.ASTModifierBuilder; +import de.monticore.lang.sysmlv2._ast.ASTModifierBuilder; import de.monticore.lang.sysmlconstraints._ast.ASTConstraintUsage; import de.monticore.lang.sysmlconstraints._ast.ASTConstraintUsageBuilder; import de.monticore.lang.sysmlparts._symboltable.PartDefSymbol; diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcDefCoCo.java b/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcDefCoCo.java index 27a85db5e..3af69bb0f 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcDefCoCo.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcDefCoCo.java @@ -22,7 +22,10 @@ public void check(ASTCalcDef node) { traverser.add4SysMLBasis(new SysMLBasisVisitor2() { @Override public void visit(ASTAnonymousUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { returnCount[0]++; } } @@ -31,7 +34,10 @@ public void visit(ASTAnonymousUsage retNode) { traverser.add4SysMLParts(new SysMLPartsVisitor2() { @Override public void visit(ASTAttributeUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { returnCount[0]++; } } diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcUsageCoCo.java b/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcUsageCoCo.java index 58783fe44..88fef5550 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcUsageCoCo.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/cocos/MaxOneDirectReturnInCalcUsageCoCo.java @@ -22,7 +22,10 @@ public void check(ASTCalcUsage node) { traverser.add4SysMLBasis(new SysMLBasisVisitor2() { @Override public void visit(ASTAnonymousUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { returnCount[0]++; } } @@ -31,7 +34,10 @@ public void visit(ASTAnonymousUsage retNode) { traverser.add4SysMLParts(new SysMLPartsVisitor2() { @Override public void visit(ASTAttributeUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { returnCount[0]++; } } diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/cocos/SubcomponentOutputConnectionDirectionCoCo.java b/language/src/main/java/de/monticore/lang/sysmlv2/cocos/SubcomponentOutputConnectionDirectionCoCo.java index 9832bbafe..22dd8e644 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/cocos/SubcomponentOutputConnectionDirectionCoCo.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/cocos/SubcomponentOutputConnectionDirectionCoCo.java @@ -1,7 +1,6 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.lang.sysmlv2.cocos; -import de.monticore.lang.sysmlbasis._ast.ASTModifier; import de.monticore.lang.sysmlbasis._ast.ASTEndpoint; import de.monticore.lang.sysmlbasis._ast.ASTSysMLTyping; import de.monticore.lang.sysmlparts._ast.ASTAttributeUsage; @@ -9,6 +8,7 @@ import de.monticore.lang.sysmlparts._cocos.SysMLPartsASTConnectionUsageCoCo; import de.monticore.lang.sysmlparts._symboltable.*; import de.monticore.symboltable.modifiers.AccessModifier; +import de.monticore.umlmodifier._ast.ASTModifier; import de.se_rwth.commons.logging.Log; import java.util.List; @@ -180,21 +180,30 @@ protected ASTModifier getModifiersFromPortUsageSymbol(PortUsageSymbol symbol) { protected boolean portIsInput(PortUsageSymbol symbol) { ASTModifier mods = getModifiersFromPortUsageSymbol(symbol); - boolean portIsInAndNotConjugated = mods.isIn() && !portIsConjugated(symbol); - boolean portIsOutAndConjugated = mods.isOut() && portIsConjugated(symbol); - return (portIsInAndNotConjugated || portIsOutAndConjugated); + if (mods instanceof de.monticore.lang.sysmlv2._ast.ASTModifier) { + var sysMLModifier = (de.monticore.lang.sysmlv2._ast.ASTModifier) mods; + boolean portIsInAndNotConjugated = sysMLModifier.isIn() && !portIsConjugated(symbol); + boolean portIsOutAndConjugated = sysMLModifier.isOut() && portIsConjugated(symbol); + return (portIsInAndNotConjugated || portIsOutAndConjugated); + } + return false; } protected boolean portIsOutput(PortUsageSymbol symbol) { ASTModifier mods = getModifiersFromPortUsageSymbol(symbol); - boolean portIsOutAndNotConjugated = mods.isOut() && !portIsConjugated(symbol); - boolean portIsInAndConjugated = mods.isIn() && portIsConjugated(symbol); - return (portIsOutAndNotConjugated || portIsInAndConjugated); + if (mods instanceof de.monticore.lang.sysmlv2._ast.ASTModifier) { + var sysMLModifier = (de.monticore.lang.sysmlv2._ast.ASTModifier) mods; + boolean portIsOutAndNotConjugated = sysMLModifier.isOut() && !portIsConjugated(symbol); + boolean portIsInAndConjugated = sysMLModifier.isIn() && portIsConjugated(symbol); + return (portIsOutAndNotConjugated || portIsInAndConjugated); + } + return false; } protected boolean portIsInOutput(PortUsageSymbol symbol) { ASTModifier mods = getModifiersFromPortUsageSymbol(symbol); - return mods.isInout(); + return mods instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) mods).isInout(); } protected boolean portIsConjugated(PortUsageSymbol symbol) { diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/DirectionCompleter.java b/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/DirectionCompleter.java index aedd9fc25..576326687 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/DirectionCompleter.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/DirectionCompleter.java @@ -2,10 +2,10 @@ import de.monticore.lang.sysmlbasis._ast.ASTAnonymousReference; import de.monticore.lang.sysmlbasis._ast.ASTAnonymousUsage; -import de.monticore.lang.sysmlbasis._ast.ASTModifier; import de.monticore.lang.sysmlbasis._visitor.SysMLBasisVisitor2; import de.monticore.lang.sysmlparts._ast.ASTAttributeUsage; import de.monticore.lang.sysmlparts._visitor.SysMLPartsVisitor2; +import de.monticore.umlmodifier._ast.ASTModifier; /** * Sets the isIn / isOut properties of symbols based on Modifiers parsed to the AST. @@ -17,7 +17,11 @@ public class DirectionCompleter implements SysMLBasisVisitor2, SysMLPartsVisitor * yields true. */ protected boolean isIn(ASTModifier modifier) { - return modifier.isIn() || !modifier.isOut() && !modifier.isReturn(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier) { + var sysMLModifier = (de.monticore.lang.sysmlv2._ast.ASTModifier) modifier; + return sysMLModifier.isIn() || !sysMLModifier.isOut() && !sysMLModifier.isReturn(); + } + return true; } /** @@ -25,7 +29,11 @@ protected boolean isIn(ASTModifier modifier) { * yields true. The keyword "return" is treated as output. */ protected boolean isOut(ASTModifier modifier) { - return modifier.isOut() || modifier.isInout() || modifier.isReturn(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier) { + var sysMLModifier = (de.monticore.lang.sysmlv2._ast.ASTModifier) modifier; + return sysMLModifier.isOut() || sysMLModifier.isInout() || sysMLModifier.isReturn(); + } + return false; } @Override diff --git a/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/TypesCompleter.java b/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/TypesCompleter.java index 7024bae1f..7e41e64c8 100644 --- a/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/TypesCompleter.java +++ b/language/src/main/java/de/monticore/lang/sysmlv2/symboltable/completers/TypesCompleter.java @@ -160,7 +160,10 @@ public void endVisit(ASTCalcUsage node) { traverser.add4SysMLBasis(new SysMLBasisVisitor2() { @Override public void visit(ASTAnonymousUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { List types = getTypeCompletion(retNode.getSpecializationList(), false); returnType[0] = types.isEmpty() ? SymTypeExpressionFactory.createObscureType() : types.get(0); } @@ -170,7 +173,10 @@ public void visit(ASTAnonymousUsage retNode) { traverser.add4SysMLParts(new SysMLPartsVisitor2() { @Override public void visit(ASTAttributeUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { List types = getTypeCompletion(retNode.getSpecializationList(), false); returnType[0] = types.isEmpty() ? SymTypeExpressionFactory.createObscureType() : types.get(0); } @@ -184,7 +190,10 @@ public void visit(ASTAttributeUsage retNode) { argTraverser.add4SysMLBasis(new SysMLBasisVisitor2() { @Override public void visit(ASTAnonymousUsage retNode) { - if (retNode.getModifier().isIn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isIn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { List types = getTypeCompletion(retNode.getSpecializationList(), false); var argType = types.isEmpty() ? SymTypeExpressionFactory.createObscureType() : types.get(0); argTypes.add(argType); @@ -195,7 +204,10 @@ public void visit(ASTAnonymousUsage retNode) { argTraverser.add4SysMLParts(new SysMLPartsVisitor2() { @Override public void visit(ASTAttributeUsage retNode) { - if (retNode.getModifier().isIn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isIn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { List types = getTypeCompletion(retNode.getSpecializationList(), false); var argType = types.isEmpty() ? SymTypeExpressionFactory.createObscureType() : types.get(0); argTypes.add(argType); @@ -219,7 +231,10 @@ public void endVisit(ASTCalcDef node) { traverser.add4SysMLBasis(new SysMLBasisVisitor2() { @Override public void visit(ASTAnonymousUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { List types = getTypeCompletion(retNode.getSpecializationList(), false); returnType[0] = types.isEmpty() ? SymTypeExpressionFactory.createObscureType() : types.get(0); } @@ -229,7 +244,10 @@ public void visit(ASTAnonymousUsage retNode) { traverser.add4SysMLParts(new SysMLPartsVisitor2() { @Override public void visit(ASTAttributeUsage retNode) { - if (retNode.getModifier().isReturn() && retNode.getEnclosingScope() == node.getSpannedScope()) { + var modifier = retNode.getModifier(); + if (modifier instanceof de.monticore.lang.sysmlv2._ast.ASTModifier + && ((de.monticore.lang.sysmlv2._ast.ASTModifier) modifier).isReturn() + && retNode.getEnclosingScope() == node.getSpannedScope()) { List types = getTypeCompletion(retNode.getSpecializationList(), false); returnType[0] = types.isEmpty() ? SymTypeExpressionFactory.createObscureType() : types.get(0); }