Skip to content

FeatureAdapter.getTypes() makes the types list attribute null (resulting in nullptr exception) if an attribute usage has an initial value in the SysML v2 model #704

@grbeni

Description

@grbeni

If the SysML v2 model contains attributes with initial values, e.g.,

attribute count : ScalarValues::Integer := 0;

and the type of the corresponding attribute is retrieved programatically, e.g.,

AttributeUsage countAttribute = ...
...
countAttribute.getType()

then the code throws a nullptr exception. This is because the FeatureAdapter.getTypes(List<Type> types, Set<Feature> visitedFeatures) method makes the types attribute null as a result of calling the computeImplicitGeneralTypes() method, which (indirectly) calls the clearCache() method making the types attribute null.

I am attaching a small SysML v2 model to facilitate the reproduction of the bug.

ExampleUsageExtension2.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions