Skip to content

ST6RI-950 UsageImpl silently changes isComposite=false to true after an XMI round-trip - #797

Merged
seidewitz merged 1 commit into
masterfrom
ST6RI-950
Sep 8, 2026
Merged

seidewitz merged 1 commit into
masterfrom
ST6RI-950

Conversation

@adaussy

@adaussy adaussy commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a bug that caused the isComposite property of a Usage to always be true when reading from XMI, even if it was false in the XMI. The fix presumes the changes already made in PR #793.

Background

UsageImpl initialized the inherited Feature::isComposite property to true directly in its constructor:

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
protected UsageImpl() {
    super();
    isComposite = true;
}

This conflicts with the declared Ecore default of the inherited property:

<eStructuralFeatures
    xsi:type="ecore:EAttribute"
    name="isComposite"
    lowerBound="1"
    eType="ecore:EDataType  "
    defaultValueLiteral="false">

As a result, an explicit isComposite=false value was silently changed to true after saving and reloading the model.

This is not only a difference between two default-value conventions. It violates the fundamental persistence invariant:

load(save(model)) 

must preserve the semantic state of model.

Note that this was not a problem for Xtext parsing, because isComposite could be set during parsing after a Usage element was created, if a ref keyword is found or during post-processing. The intent was that the Usage element would default to isComposite = true in the abstract syntax otherwise, but that the XMI default isComposite would still be false, as for KerML. As outlined above, however, this does no work for an XMI roundtrip.

Changes

The following changes were made following the changes made in PR #793.

  1. In org.omg.sysml.xtext.postprocessor.UsageParserPostProcessor, use Xtext node information to preserve explicit isComposite and isReference assignments while restoring implicit parser defaults during post-processing.
  2. In the abstract suntax, remove constructor-specific isComposite initialization, restoring standard EMF creation and XMI deserialization aligned with the Ecore default.

Use Xtext node information to preserve explicit isComposite and
isReference assignments while restoring implicit parser defaults during
post-processing.

Keep standard EMF creation and XMI deserialization aligned with the
Ecore default by removing constructor-specific isComposite
initialization.
@adaussy
adaussy requested a review from seidewitz September 7, 2026 11:41
@adaussy adaussy added this to the 2026-08 milestone Sep 7, 2026
@AxelRICHARD AxelRICHARD added the enhancement New feature or request label Sep 7, 2026
@seidewitz seidewitz changed the title ST6RI-950 Restore Usage composite defaults through parser adapters ST6RI-950 UsageImpl silently changes isComposite=false to true after an XMI round-trip Sep 8, 2026
@seidewitz seidewitz self-assigned this Sep 8, 2026
@seidewitz seidewitz added bug Something isn't working and removed enhancement New feature or request labels Sep 8, 2026
@seidewitz
seidewitz merged commit b54d624 into master Sep 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants