Skip to content

Commit 75bbe65

Browse files
gdanielAxelRICHARD
authored andcommitted
[1091] Fix qualified names in FeatureReferenceExpression export
Bug: #1091 Signed-off-by: Gwendal Daniel <gwendal.daniel@obeosoft.com> Signed-off-by: Arthur Daussy <arthur.daussy@obeo.fr>
1 parent e24e224 commit 75bbe65

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
- https://github.com/eclipse-syson/syson/issues/870[#870] [metamodel] Fix an issue while computing the name of `VariantMembership`.
2121
- https://github.com/eclipse-syson/syson/issues/1083[#1083] [metamodel] Fix an issue where resolving against "unrestricted" name did not work
2222
- https://github.com/eclipse-syson/syson/issues/1075[#1075] [import] Fix a ClassCastException thrown while importing a model with a name conflict.
23+
- https://github.com/eclipse-syson/syson/issues/1091[#1091] [export] Fix `FeatureReferenceExpression` export for elements that should be exported as qualified names.
24+
Exporting a SysML model containing a `FeatureReferenceExpression` now correctly procudes qualified names where it should.
2325

2426
=== Improvements
2527

backend/application/syson-application/src/test/java/org/eclipse/syson/application/export/ImportExportTests.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,20 @@ public void checkOccurrenceTest() throws IOException {
477477

478478
this.checker.check(input, expected);
479479
}
480+
481+
@Test
482+
@DisplayName("Given a model with a FeatureReferenceExpression set with a qualified name, when importing and exporting the model, then the exported text file should be the same as the imported one.")
483+
public void checkFeatureReferenceExpressionWithQualifiedNameDeresolution() throws IOException {
484+
var input = """
485+
package P1 {
486+
part p1;
487+
}
488+
package P2 {
489+
part part2 {
490+
part p = P1::p1;
491+
}
492+
}""";
493+
494+
this.checker.check(input, input);
495+
}
480496
}

backend/application/syson-sysml-export/src/main/java/org/eclipse/syson/sysml/export/SysMLElementSerializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ public String caseFeatureReferenceExpression(FeatureReferenceExpression expressi
575575
if (membership instanceof FeatureMembership feature && feature.getOwnedMemberFeature() instanceof Expression exp) {
576576
this.reportConsumer.accept(Status.warning("BodyExpression are not handled yet ({0})", exp.getElementId()));
577577
} else {
578-
this.appendFeatureReferenceMember(builder, membership);
578+
this.appendFeatureReferenceMember(builder, membership, expression);
579579
}
580580
return builder.toString();
581581
}
@@ -1316,9 +1316,9 @@ private void appendSequenceExpressionList(Appender builder, Expression expressio
13161316
}
13171317
}
13181318

1319-
private void appendFeatureReferenceMember(Appender builder, Membership membership) {
1319+
private void appendFeatureReferenceMember(Appender builder, Membership membership, Expression context) {
13201320
if (membership.getMemberElement() instanceof Feature feature) {
1321-
builder.appendSpaceIfNeeded().append(this.getDeresolvableName(feature, membership));
1321+
builder.appendSpaceIfNeeded().append(this.getDeresolvableName(feature, context));
13221322
}
13231323
}
13241324

doc/content/modules/user-manual/pages/release-notes/2025.4.0.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package p1 {
2121
}
2222
```
2323
- Fix a problem encountered during the import of a SysML textual file in a specific model configuration. The model incorrectly resolved the target of a `Redefinition` when a name conflict was detected.
24+
- Fix an issue that prevented the export functionality to correctly produce qualified name for elements referenced in `FeatureReferenceExpression`.
2425

2526
== New features
2627

0 commit comments

Comments
 (0)