[mdr-users] Feature Request: Extra WFR for UML profile for MOF (checked in UML2MOF)

Pieter Van Gorp <[email protected]> Fri, 28 Oct 2005 11:00:51 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
Hi all,
I believe the UML profile for MOF needs an additional well-formedness
rule (WFR).

(David, you're in CC since you've implemented UML2MOF as an ATL
transformation and you may be interested in the profile WFRs as well)

More specifically, UML2MOF needs to check that association ends do not
point to classes within packages that are not inside the same (or an
imported) metamodel.

Such a check would have saved me quite some time on debugging a
null-pointer exception thrown from NBMDRepositoryImpl.  The problem
started when I modeled (in MagicDraw UML) an association 'ab' from a
class A to a class B where A is in a package that clusters the package
of B.  I had properly specified the navigability of 'ab' such that it
worked from A to B but not vice versa.  However, due to the order of
clicking when creating the association, MagicDraw decided to store the
association in package B.  In the future, I'll of course check for
this kind of unexpected details but before being aware of this, I
didn't check the "relations" package inside B package shown (or
"hidden") in the component tree view...

Do you agree that an extra check (extra WFR for the profile) in
UML2MOF would have brought the problem to light much sooner?

Finally, coming back to the NPE in NBMDRepositoryImpl: it occured in
resolveAssociations.  The first call to cls.addAssociationEnd failed
since cls was null.  Ironically, there's a null-check for the second
call... is there a specific reason for not doing the null-check for
the first association end?  Also, the null-check has no "else-part". 
Shouldn't an error be reported in some cases (like mine)?

Hope this saves others some time in the future,
kind regards,
--
Pieter Van Gorp
       Teaching and Research Assistant
       FOrmal Techniques in Software engineering (FOTS)
       University of Antwerp
       Middelheimlaan 1
       2020 Antwerpen - Belgium
       Office: G.304
       Phone: +32 3 265 38 71
       Fax: +32 3 265 37 77
       http://www.fots.ua.ac.be/~pvgorp/research/
       http://motmot.sourceforge.net/