Repository navigation
Conversation
- Test fail with stack overflow errors.
- This avoids calling removeRedundantTypes, which actually caused the stack overflow. - It also allows visited features to be carried across metadataFeature iterations. All tests pass.
Member
Author
|
@vincemolnar |
Member
Author
|
@vincemolnar |
vincemolnar
approved these changes
Oct 19, 2026
vincemolnar
left a comment
Contributor
There was a problem hiding this comment.
I have confirmed that the fixes prevent the stack overflow for all the previously identified examples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug that causes a
StackOverflowErrorwhen a metaclass/metadata definition is annotated with itself.Issue
A self-referential metadata applications such as this one in KerML:
or this one in SysML:
result in a
StackOverflowErrorduring validation.Cause
The method
TypeAdapter.getBaseTypesis called during implied specialization processing for aType. It checks all the metadata annotations of a type (if any). If it finds any semantic metadata, it returns the appropriatebaseTypesto be specialized.Method
TypeAdapter.getBaseTypespreviously made a call ongetMetaclassfor each metadata feature it checked. This call was added in PR #744 (ST6RI-923 Problem with name resolution when using Semantic metadata). The returned type from this call is not actually used; the reason for the call is just to ensure the proxies are resolved and the metaclass type is available.The delegate implementing
getMetaclasscallsFeatureUtil.getFirstTypeOf, which leads to the following call chain:FeatureUtil.getFirstTypeOfFeatureUtil.getAllTypesOfFeatureAdapter.getAllTypesFeatureAdapter.getTypesFeatureAdapter.removeRedundantTypesWhen there is a self-referential annotation, as in the examples above, recursion leading to the stack overflow happens through
removeRedundantTypes, while looking for other supertypes of the metaclass/metadata def.Changes
Replaced the
getMetaclasscall ingetBaseTypeswith a call toFeatureUtil.getTypesOf, which provides access to the lower-level methodFeatureAdapter.getTypes. By avoiding callingremoveRedundantTypes, this resolves the stack overflow issue, while preserving the fix of PR #744.