Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ This fix ensure that imported models containing, for example, a top-level `Libra
- https://github.com/eclipse-syson/syson/issues/1784[#1784] Error while exporting `FeatureValue` using enumeration literals.
- https://github.com/eclipse-syson/syson/issues/1838[#1838] [metamodel] Invalid computation of `Usage.getType`: The subsetted features should be taken into account.

- https://github.com/eclipse-syson/syson/issues/1847[#1847] [export] Textual export duplicates "abstract" keyword for `OccurrenceUsage`.

=== Improvements

- https://github.com/eclipse-syson/syson/issues/1666[#1666] [export] Export `SatisfyRequirementUsage` in textual format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,17 @@ public void checkReferencingWithShortName() throws IOException {
this.checker.check(input, input);
}

@Test
@DisplayName("GIVEN an abstract OccurrenceUsage, WHEN importing and exporting the model, THEN the abstract keyword should be correctly exported")
public void checkAbstractOccurrenceUsage() throws IOException {
var input = """
package root {
abstract occurrence test;
abstract occurrence def Test;
}""";
this.checker.check(input, input);
}

@Test
@DisplayName("GIVEN a model with a references to elements, WHEN importing and exporting the model, THEN the references should privileged short name over declared name when possible")
public void checkReferencingIdentifiers() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,6 @@ public String caseObjectiveMembership(ObjectiveMembership objective) {
@Override
public String caseOccurrenceUsage(OccurrenceUsage occurrenceUsage) {
Appender builder = new Appender(this.lineSeparator, this.indentation);
this.appendUsagePrefix(builder, occurrenceUsage);
this.appendOccurrenceUsagePrefix(builder, occurrenceUsage);
if (PortionKind.SNAPSHOT.equals(occurrenceUsage.getPortionKind())) {
builder.appendWithSpaceIfNeeded("snapshot");
Expand Down Expand Up @@ -2487,7 +2486,7 @@ private void appendPrefixMetadataMember(Appender builder, MetadataUsage metadata
}

}

private void appendRequirementConstraintUsage(Appender builder, ConstraintUsage constraintUsage) {
if (this.useRequirementConstraintUsageShortHandNotation(constraintUsage)) {
this.appendRequirementConstraintUsageShorthandNotation(builder, constraintUsage);
Expand Down Expand Up @@ -2567,6 +2566,10 @@ private void appendBasicUsagePrefix(Appender builder, Usage usage) {
builder.appendSpaceIfNeeded();
builder.append("end");
}

if (usage.isIsReference() && !this.isImplicitlyReferential(usage)) {
builder.appendWithSpaceIfNeeded(SysMLv2Keywords.REF);
}
}

private FeatureDirectionKind getDefaultDirection(Usage usage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ package root {
** New `Expose` elements now have `visibility` set to _protected_ and have `isImportAll` set to _true_, as required by the SysMLv2 specification.
** Correct the computation of a `Feature`'s types to properly account for subsetted features.

** Fix the textual export of `OccurrenceUsage` to avoid duplication of the abstract keyword.

== Improvements

Expand Down
Loading