Skip to content

Commit a7279b1

Browse files
committed
ST6RI-685 Revised validateAssociationBinarySpecialization.
1 parent cb55a5d commit a7279b1

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

org.omg.kerml.xtext/src/org/omg/kerml/xtext/validation/KerMLValidator.xtend

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,14 @@ class KerMLValidator extends AbstractKerMLValidator {
547547
@Check
548548
def checkAssociation(Association a){
549549
// validateAssociationBinarySpecialization
550-
if (a.associationEnd.size() > 2) {
550+
// NOTE: It is sufficient to check owned ends, since they will redefine ends from any supertypes.
551+
val associationEnds = TypeUtil.getOwnedEndFeaturesOf(a);
552+
if (associationEnds.size() > 2) {
551553
val binaryLinkType = SysMLLibraryUtil.getLibraryElement(a, "Links::BinaryLink") as Type
552554
if (a.conformsTo(binaryLinkType)) {
553-
error(INVALID_ASSOCIATION_BINARY_SPECIALIZATION_MSG, a.associationEnd.get(2), null, INVALID_ASSOCIATION_BINARY_SPECIALIZATION)
555+
for (var i = 2; i < associationEnds.size(); i++) {
556+
error(INVALID_ASSOCIATION_BINARY_SPECIALIZATION_MSG, associationEnds.get(i), null, INVALID_ASSOCIATION_BINARY_SPECIALIZATION)
557+
}
554558
}
555559
}
556560

@@ -623,6 +627,7 @@ class KerMLValidator extends AbstractKerMLValidator {
623627
}
624628

625629
// validateConnectorBinarySpecialization
630+
// NOTE: It is sufficient to check owned ends, since they will redefine ends from any supertypes.
626631
val connectorEnds = TypeUtil.getOwnedEndFeaturesOf(c)
627632
if (connectorEnds.size() > 2) {
628633
val binaryLinkType = SysMLLibraryUtil.getLibraryElement(c, "Links::BinaryLink") as Type

org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/InterfaceUsage_Invalid.sysml.xt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ package 'Interface Example' {
4646
end supplierPort : FuelOutPort;
4747
end consumerPort : FuelInPort;
4848

49-
//XPECT errors --> "An interface definition end must be a port." at "end part notPort : Fuel;"
49+
//*XPECT errors ---
50+
"An interface definition end must be a port." at "end part notPort : Fuel;"
51+
"Cannot have more than two ends" at "end part notPort : Fuel;"
52+
--- */
5053
end part notPort : Fuel;
5154
}
5255

0 commit comments

Comments
 (0)