Support calling super method and constructor

Issue #430 resolved
Matthias Schoettle created an issue

In general, it should be possible to call:

  1. for methods: their super implementation, e.g., super.foo()
  2. for constructors:
    • the super constructor, e.g., super()
    • another constructor of the same class, e.g., this()

While 1. is already somewhat possible, the code generator does not add super. in front of the call. I think in the GUI the way it should be shown is that when the signature of a message points to a super class of the type of the lifeline (for self messages), it should indicate visually that it is a super call. This way, generating code is feasible.

For 2. it is currently not possible to select any other constructors. Visually, the same applies as above. Also, it should be ensured that these calls occur at the very beginning of the constructor definition (as per Java language specification).

Comments (7)

  1. Matthias Schoettle reporter

    References #430: Changes declaration of local properties when it is used the first time.

    Instead of declaring all local properties at the beginning of a method, it is declared when it is used the first time. This allows to start a method with a super call, which is required for calling the super constructor (it needs to be the first statement).

    → <<cset e35de23c9736>>

  2. Matthias Schoettle reporter

    Missing still are the following points:

    • visual indication of super call (e.g., super. prefix)
    • allowing to call another constructor when defining a constructor (as the first call)
  3. Log in to comment