Add generics to ImplementationClass

Issue #74 resolved
Matthias Schoettle created an issue

Currently there is no support for generics in the metamodel. For collections the type RCollection exists in the metamodel, which can be parametrized with a type of its elements.

In order to fully support implementation classes (see issue #34) we need support for generics. For example, when importing Java generic classes.

Regular classes don't need generic support, because by using partial classes in methods, a form of generics is used.

This is still open and needs to be discussed: Once we have that, we don't need RCollection types (RSet and RSequence) anymore in the metamodel, because implementation classes would be used instead. However, it could be nice to abstract from the actual language to be used and leave it open until code generation.

Comments (6)

  1. Matthias Schoettle reporter

    As per discussion in the meeting on March 12th:

    • RCollection types will for now not be removed: It might be useful to not have to force the decision of what specific class a collection is implemented by (same for the programming language). If we use our own collection types we can delay this decision.
    • We will introduce generics to Classifier (but will only use it for Implementation Classes, this way, if in the future we want to add it to classes it can be easily added):
      • We will add TypeParameter as a sub-class of Type. The name will be the generic type name (e.g. T), a reference to ObjectType) genericType (0..1) will denote the chosen actual type.
      • Classifier contains 0..* typeParameters.
      • We won't store upper/lower bounds of generics: We will currently not check for that, it will become a problem when generating code
  2. Matthias Schoettle reporter

    References issue #74 and issue #94: Made PrimitiveType inherit from ObjectType instead of directly from Type. This makes more sense, because through inheriting from ImplementationClass it is also an ObjectType. When referring to an ObjectType, every proper type (primitive plus classes) is included.

    → <<cset a2a50c2e8667>>

  3. Matthias Schoettle reporter

    Resolved issue #74: Adjusted edit code such that

    • TypeParameters text is shown depending on whether the generic type is set (shows the generic type, otherwise the name of the type parameter)
    • TypeParameter gets updated also when the referenced generic type is updated
    • change listeners also consider generic type of type parameter changes

    → <<cset f73f9241cb2d>>

  4. Matthias Schoettle reporter

    References issue #74: Added text for type parameters in textual representation. E.g., ArrayList<int>.

    Text wasn't updated when TypeParameter was updated and the used type is referenced in a Parameter. Added a "lax" check, because otherwise it is necessary to iterate through all parameters.

    → <<cset d92a6c24f38a>>

  5. Log in to comment