Version: 1.5.61 with patches (using KDE KDE 3.5.5) Installed from: Fedora RPMs Compiler: n/a OS: Linux 1) Create two simple classes 2) Draw a dependancy or directional association between the classes 3) Generate the ada code. 4) Note that both specs with each other in. 5) The class which has the arrow pointing away from it is the only class which should have the "with" in its code.
Created attachment 19753 [details] xmi, generated code for problem
Created attachment 19764 [details] bug141956-fix.diff SVN is not letting me commit right now so here is the fix for the impatient. findObjectsRelated(): Only consider those associations for which `c' is in role A. Only add the role B object to the returned list.
SVN commit 635772 by okellogg: findObjectsRelated(): Only consider those associations for which `c' is in role A. Only add the role B object to the returned list. BUG:141956 M +2 -0 ChangeLog M +4 -10 umbrello/codegenerator.cpp --- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #635771:635772 @@ -15,6 +15,8 @@ * Unable to delete multiplicity information or lable from an association (141813) * C++ code generator does not correctly define namespaces (141876) +* Ada code generator generates "withs" in both directions for certain + associations (141956) Version 1.5.61 --- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerator.cpp #635771:635772 @@ -548,7 +548,6 @@ void CodeGenerator::findObjectsRelated(UMLClassifier *c, UMLPackageList &cList) { UMLPackage *temp; - UMLDoc *umldoc = UMLApp::app()->getDocument(); UMLAssociationList associations = c->getAssociations(); for (UMLAssociation *a = associations.first(); a; a = associations.next()) { @@ -568,10 +567,8 @@ { UMLObject *objA = a->getObject(Uml::A); UMLObject *objB = a->getObject(Uml::B); - if (objA != c) - temp = (UMLPackage*)objA; - else if (objB != c) - temp = (UMLPackage*)objB; + if (objA == c) + temp = static_cast<UMLPackage*>(objB); } break; case Uml::at_Aggregation: @@ -582,12 +579,9 @@ UMLObject *objA = a->getObject(Uml::A); UMLObject *objB = a->getObject(Uml::B); // Add related object only if the rolename is not empty. - if (objA != c && !a->getRoleName(Uml::A).isEmpty() && - objA->getBaseType() != Uml::ot_Datatype) - temp = (UMLPackage*)objA; - else if (objB != c && !a->getRoleName(Uml::B).isEmpty() && + if (objA == c && !a->getRoleName(Uml::B).isEmpty() && objB->getBaseType() != Uml::ot_Datatype) - temp = (UMLPackage*)objB; + temp = static_cast<UMLPackage*>(objB); } break; default: /* all others.. like for state diagrams..we currently don't use */