Skip to content

ST6RI-937 Variants are incorrectly referential#768

Merged
seidewitz merged 3 commits into
masterfrom
ST6RI-937
Jun 18, 2026
Merged

ST6RI-937 Variants are incorrectly referential#768
seidewitz merged 3 commits into
masterfrom
ST6RI-937

Conversation

@seidewitz

@seidewitz seidewitz commented Jun 16, 2026

Copy link
Copy Markdown
Member

This PR corrects the computation of an effective featuringType of a Usage in the postProcess method for UsageAdapter.

Background

Previously, the UsageAdapter::postProcess methods contained the code:

if (target.getDirection() != null || target.isEnd() || 
	// Note: A parsed Usage can only get a featuring type if it is owned via a FeatureMembership.
	!(target.eContainer() instanceof FeatureMembership)) {
	target.setIsComposite(false);
}

The comment note in this code is incorrect. A variant usage is owned by a VariantMembership, which is not a FeatureMembership, but, per semantic constraint checkUsageVariationUsageTypeFeaturing, has the same featuring types as its owning variation, which can be non-empty.

Note that the reason getFeaturingType isn’t just called here is to avoid computing derived values during parse post-processing.

Changes

In project org.omg.sysml.logic:

  1. UsageUtil – Added:
    • getExpectedFeaturingType – Gets the expected featuringType for a Usage, assuming limitations in the SysML syntax. This is computed recursively as the owningType of the nearest non-variation container if this exists. Note that the special featuringTypes for variable features are skipped in this computation (not necessary for how this utility is used in postprocessing).
    • hasFeaturingType – Whether getExpectedFeaturingType is non-null, meaning the Usage will have a FeaturingType.
  2. UsageAdapter – Revised the method postProcess to use UsageUtil.hasFeaturingType in the condition on whether to set isComposite to false.
  3. PortAdapter – Revised the method postProcess to use UsageUtil.getExpectedFeaturingType. This revision was necessary because the change to UsageAdapter resulted in variant PortUsages being considered composite, violating the constraint validatePortUsageIsReference.

Test

  • org.omg.sysml.logic.UsagePostProcessTest

@seidewitz seidewitz requested a review from AxelRICHARD June 16, 2026 17:03
@seidewitz seidewitz self-assigned this Jun 16, 2026
@seidewitz seidewitz added the bug Something isn't working label Jun 16, 2026
@seidewitz seidewitz added this to the 2026-05 milestone Jun 16, 2026
@seidewitz seidewitz linked an issue Jun 16, 2026 that may be closed by this pull request
@seidewitz seidewitz changed the title ST6RI-937 Variants are incorrectly variable ST6RI-937 Variants are incorrectly referential Jun 16, 2026
Comment thread org.omg.sysml.logic/src/main/java/org/omg/sysml/util/UsageUtil.java Outdated
Comment thread org.omg.sysml.logic/src/main/java/org/omg/sysml/util/UsageUtil.java
@AxelRICHARD

Copy link
Copy Markdown
Contributor

@seidewitz I don't have any other comments on this pull request. You can merge it.

@seidewitz seidewitz merged commit 2889393 into master Jun 18, 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.

Issue about isComposite of variant usage

2 participants