Static methods of mapped classes not visible, and wrong lifeline type

Issue #364 resolved
Jörg Kienzle created an issue

When a static method mstat is defined on |A in a reused concern AC on an instance of a class B defined in the current concern that reuses AC with mapping |A -> B, then:

  • it is not callable on the metaclass B
  • the meatballs <|A> shows up, and it is possible to call mstat, but:

  • the visualized lifeline is <<metaclass |A>> and

  • if mstat returns an |A (like the static getInstance method of singleton, for example), then the returned object is treated as a |A, which means none of the methods of B can be called later on that instance

the instance type shown in the message view is |A (instead of B)

Comments (3)

  1. Matthias Schoettle
    • changed status to open

    Indeed. It occurs because (based on the assumption that Singleton is reused) it does not consider mapped classes for the choice that is presented. I.e., if |Singleton is mapped to B, either only |Singleton (if B does not contain static operations) or both (if B contains static operations) appear.

    This needs to be improved such that mappings are considered, and only the mapped to class appears. The selection for callable operations already provides the complete list of all operations (based on mappings and extensions). Here, also mapped operations (mapped from) need to be hidden.

  2. Matthias Schoettle

    References #364: Changes the way that the choice of values for Lifeline.represents is collected. Now, it considers if a class was mapped and only the "mapped to" class is collected as a choice.

    For instance, when reusing Singleton, only the class mapped to |Singleton will be shown. When the callable operations are shown, those from Singleton will already be contained in that choice.

    In addition, when creating the temporary variable, the mapped to type is used as the type of that Reference in order to show that class when it is called after.

    For example:

    instance := B.getInstance(); [metaclass :B] instance.doSomething(); [instance: B]

    → <<cset 19e766c67d37>>

  3. Log in to comment