UML 2.6 RTF Avatar
  1. OMG Issue

UMLR — NamedElement::allNamespaces is invalid at model root

  • Key: UMLR-328
  • Legacy Issue Number: 19349
  • Status: open  
  • Source: Model Driven Solutions ( Dr. Edward Willink)
  • Summary:

    The specified OCL body for NamedElement::allNamespaces has its tests in the wrong order and consequently fails at the root since in:

    if owner.oclIsKindOf(TemplateParameter) and
    owner.oclAsType(TemplateParameter).signature.template.oclIsKindOf(Namespace) then
    ...
    else
    if namespace->isEmpty()
    then ...

    At the root owner is null and the navigation results in invalid for both arms of the conjunction and consequently the if condition and if result.

    Suggest the more readable, less redundant and more correct:

    if owner = null
    then OrderedSet{}
    else
    let enclosingNamespace : Namespace =
    if owner.oclIsKindOf(TemplateParameter)
    and owner.oclAsType(TemplateParameter).signature.template.oclIsKindOf(Namespace)
    then owner.oclAsType(TemplateParameter).signature.template.oclAsType(Namespace)
    else namespace
    endif
    in enclosingNamespace.allNamespaces()->prepend(enclosingNamespace)
    endif

  • Reported: UML 2.5 — Sun, 20 Apr 2014 04:00 GMT
  • Updated: Wed, 11 Mar 2015 03:37 GMT