Skip to content

Comments

ST6RI-856 isConstant not serialized in XMI for end Usages#661

Merged
seidewitz merged 3 commits intomasterfrom
ST6RI-856
Jun 25, 2025
Merged

ST6RI-856 isConstant not serialized in XMI for end Usages#661
seidewitz merged 3 commits intomasterfrom
ST6RI-856

Conversation

@seidewitz
Copy link
Member

An end usage is automatically considered to be constant if it may time vary. However, while isConstant() returned true for such elements in memory, the value isConstant = true was not being serialized to XMI for them. Similarly, the isAbstract property was not being serialized for variation definitions and usages, even though isAbstract() returns true for them.

The underlying problem is that the automatic setting of isConstant and isAbstract was bing done by overriding the methods isConstant() in UsageImpl and isAbstract in DefinitionImpl and UsageImpl. In both case, the corresponding the field actually retained its default value. During XMI serialization, the eIsSet operation is used to check if a field is set. Unfortunately, the generated implementation for this for both isConstant and isAbstract directly checks the field against the default value. These fields are thus treated as having the default value and not serialized.

This PR fixes the problem as follows.

  1. The "additional override" for isConstant() has been removed from UsageImpl. Instead, in UsageAdapter::transform, the isConstant property is explicitly set to true if the usage is an end and it may time vary. (Note that this cannot be done in postProcess, because the computation of mayTimeVary requires traversing the specializations of the usage, which cannot be properly done during parse post-processing.
  2. The "additional overrides" for isAbstract() have been removed from DefinitionImpl and UsageImpl. Instead DefinitionAdapter::postProcess and UsageAdapter::postProcess have been updated to explicitly set isAbstract to true if isVariation is true.

- Moved it from additional overrides in DefinitionImpl and UsageImpl to
postProcess in DefinitionAdapter and UsageAdapter.
- Moved it from additional override UsageImpl to "transform" in
UsageAdapter.
@seidewitz seidewitz added this to the 2025-06 milestone Jun 25, 2025
@seidewitz seidewitz self-assigned this Jun 25, 2025
@seidewitz seidewitz merged commit d102053 into master Jun 25, 2025
2 checks passed
@seidewitz seidewitz added the bug Something isn't working label Jun 29, 2025
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