[umbrello] [Bug 425156] New: Template typenames in attribute and operation parameter types don't work

Robert Hairgrove bugzilla_noreply at kde.org
Sun Aug 9 12:32:00 BST 2020


https://bugs.kde.org/show_bug.cgi?id=425156

            Bug ID: 425156
           Summary: Template typenames in attribute and operation
                    parameter types don't work
           Product: umbrello
           Version: Git
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: general
          Assignee: umbrello-devel at kde.org
          Reporter: code at roberthairgrove.com
  Target Milestone: ---

SUMMARY
Parameters of an operation in a class with templates cannot define
template typenames as their types without Umbrello creating spurious
additional classes at global scope.

STEPS TO REPRODUCE
1. Start a new project.
2. Under the folder "Logical View", create three nested folders named
   PKG1, PKG2, and PKG3. Under PKG3, create a new class "ClassBase" (for
example).
3. Add a template to ClassBase "CharType" (for example).
4. Add an operation to ClassBase with a parameter called "param". Set the
parameter
   type to "CharType".

OBSERVED RESULT
In the operation properties dialog's parameter list, the following is
displayed: "param :" (empty type). When the same parameter "param" is selected
and "Properties"
is clicked, the type has changed to "PKG1::PKG2::PKG3::ClassBase::CharType".
If "OK" is clicked, there is a newly-created class called
"PKG1::PKG2::PKG3::ClassBase::CharType"
at global scope in the tree view.

EXPECTED RESULT
The parameter type should simply show the template typename; no extra class
or datatype should be created on the fly.

SOFTWARE/OS VERSIONS
Linux Ubuntu 18.04.4
Qt Version: 5.x

ADDITIONAL INFORMATION
The reason for this is that in the function UMLAttribute::toString, the
call to "UMLClassifier *type = UMLClassifierListItem::getType();" returns
NULL instead of a pointer to the template. However, UMLTemplate is not a
descendent of UMLClassifier, but UMLClassifierListItem, so the dynamic_cast 
in the body of the getType() function fails.

FIX:
1 - attribute.cpp needs to #include "template.h".
2 - If UMLClassifier *type == NULL after the above call, adding a check 
for m_pSecondary != NULL && m_pSecondary->asUMLTemplate() != NULL, then calling
name() will
fetch the correct type.

Additional testing should be done to ensure that the XMI document is
correctly updated.

RELATED TO: Bug 425009

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list