Skip to content

ST6RI-924 Problems with TypeAdapter and AssignmentActionUsageAdapter#747

Open
seidewitz wants to merge 2 commits intomasterfrom
ST6RI-924
Open

ST6RI-924 Problems with TypeAdapter and AssignmentActionUsageAdapter#747
seidewitz wants to merge 2 commits intomasterfrom
ST6RI-924

Conversation

@seidewitz
Copy link
Copy Markdown
Member

This PR fixes bugs in TypeAdapter and AssignmentUsageAdapter.

TypeAdapter

  • Previously, TypeAdapter::removeUnnecessaryImplicitGeneralTypes could throw an NullPointerException if implicitEClassGenerals was null for a certain specialization EClass (which can happen during processing of an ill-formed model).
  • Added a check on that implicitEClassGenerals is non-null before processing it further.

AssignmentUsageAdapter

  • Previously, AssignmentActionUsageAdapter::addTargetRedefinition called FeatureAdapter::addFeatureWriteTypes to satisfy redefinition constraints on target::StartingAt and target::startingAt::accessedFeature nested in an AssignmentActionUsage. However, placing this within AssignmentActionUsageAdapter means that the transformation is not done if Feature::computeImplicitGeneralTypes is called directly on these features, which can happen during Xtext editor reconciliation of text changes. The result can be spurious validation errors.

  • Moved the implementation satisfying these constraints to FeatureAdapter, called from addComputedRedefinitions.

    Note. This change results in the KerML-level FeatureAdapter depending on SysML AssignmentActionUsage. However, in general, "on-demand" calls to computeImplicitGeneralTypes can only be properly handled if the satisfaction of all semantic constrains effecting a metaclass are implemented in the adapter for that metaclass.

@seidewitz seidewitz self-assigned this Mar 28, 2026
@seidewitz seidewitz added the bug Something isn't working label Mar 28, 2026
@seidewitz seidewitz added this to the 2026-02 milestone Mar 28, 2026
@seidewitz seidewitz requested a review from himi March 28, 2026 06:39
@himi
Copy link
Copy Markdown
Member

himi commented Mar 28, 2026

I encountered this issue during Xtext editing, but I do not remember any concrete steps to reproduce that NullPointerException. Do you know anything about it? So far, it works quite well without NPE :).

@seidewitz
Copy link
Copy Markdown
Member Author

I encountered this issue during Xtext editing, but I do not remember any concrete steps to reproduce that NullPointerException. Do you know anything about it? So far, it works quite well without NPE :).

I have not been able to reliably reproduce the exception, so I have no been able to track down its cause, which does bother me. I am not even sure how it is possible for implicitEClassGenerals to be null at this point, since it is the result of accessing a Map using a known member of the keySet. But it does happen, and there is an easy way to prevent it just by checking for null.

Copy link
Copy Markdown
Member

@himi himi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I tried many patterns and could not get any NPEs so far. In my experience, analysis and subject edit has had caused an NPE often, but I could not reproduce such problems in this version.

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.

2 participants