UML 2.5 FTF Avatar
  1. OMG Issue

UML25 — Avoid covariant parameters in metamodel operation redefinition

  • Key: UML25-539
  • Legacy Issue Number: 18810
  • Status: closed  
  • Source: Model Driven Solutions ( Mr. Steve Cook)
  • Summary:

    The vast majority of operation redefinitions in the metamodel have invariant parameters, but four operations inconsistently use covariant parameter redefinition. MOF actually says nothing about whether covariant redefinition is allowed, but for consistency and type-safety the UML spec should avoid it. This can be done using a precondition that requires the parameter to be of the right type.

    Region::isRedefinitionContextValid(), State::isRedefinitionContextValid(), StateMachine::isRedefinitionContextValid(), and Classifer::conformsTo().

  • Reported: UML 2.5b1 — Thu, 11 Jul 2013 04:00 GMT
  • Disposition: Resolved — UML 2.5
  • Disposition Summary:

    The operations that do not have covariant parameters are isCompatibleWith(p), isDistinguishableFrom(n,
    ns), and isConsistentWith(redefinee).
    The implementations of isCompatibleWith explicitly check the type of the parameter as part of the test:
    p.oclisKindOf(self.oclType()).
    The implementations of isDistinguishableFrom explicitly check the type of the parameter.
    The implementations of isConsistentWith call isRedefinitionContextValid() as a precondition. The truth of
    this precondition is a consequence of well-formedness rules.
    Rather than using a precondition as suggested in the issue, it is safer to make the operations explicitly check
    the parameter type in their logic.

  • Updated: Fri, 6 Mar 2015 20:59 GMT