Bug 425009 - Templates as data types of parameters in operations causing problems
Summary: Templates as data types of parameters in operations causing problems
Status: REPORTED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-04 19:30 UTC by Robert Hairgrove
Modified: 2020-08-08 16:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
template_names_in_operation_parameters.png (137.58 KB, image/png)
2020-08-04 19:30 UTC, Robert Hairgrove
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Hairgrove 2020-08-04 19:30:01 UTC
Created attachment 130633 [details]
template_names_in_operation_parameters.png

SUMMARY
Language = C++

If a class extends another class wsith template parameters of class type, and the derived class also has template parameters, setting parameter types in operations to a template always displays the full package path, causing overly long names. Also, when the parameter is newly created, it doesn't show the type after the dialog is closed, but only after editing it a second time does it show up on the diagram.

STEPS TO REPRODUCE
1. Create a base class with templates;
2. Create a second class with templates (which might have the same name as the base class, and actually should);
3. Add some operations with parameters and set the types to the templates of the same class.

OBSERVED RESULT
Although the package path of the class is not displayed in the diagram (option "Packages" under "Display" is unchecked), the full path for each of the template types is.

EXPECTED RESULT
Since the actual type of a template is undefined, being merely a placeholder for almost anything, showing a package path for a template makes no sense and should never be displayed if the template belongs to the class being edited.

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

ADDITIONAL INFORMATION
See attached screenshot.
Comment 1 Robert Hairgrove 2020-08-08 13:13:38 UTC
How to reproduce problem:

A. Start a new project. Under "Logical View" in the tree view, create three nested packages: PKG1/PKG2/PKG3.
B. Create a new class under PKG3 called "ClassBase". Add a template "CharType".
C. Add a new operation with a parameter. In the parameter properties dialog, select "CharType" from the list as parameter type. Notice that the type "PKG1::PKG2::PKG3::ClassBase::CharType" is also offered as a type.
D. After clicking "OK", notice that the parameter type is empty in the list of parameters for the new operation.
E. After selecting the parameter just entered and clicking on "Properties", the type has changed to "PKG1::PKG2::PKG3::ClassBase::CharType" instead of just "CharType".
F. In the tree view, notice that there is a new top-level class with the name "PKG1::PKG2::PKG3::ClassBase::CharType" which was not there before.

It is therefore not possible to select a template of the class as a datatype for the parameter without having this happen.
Comment 2 Robert Hairgrove 2020-08-08 13:14:31 UTC
Actually, I added PKG1..3 as folders, not packages.
Comment 3 Robert Hairgrove 2020-08-08 16:29:11 UTC
It seems like we can set a parameter's datatype either to an existing datatype, or a class type, in which case (the latter of the two) the type name is always prefixed by any package scope. This is certainly desirable for types like "std::string", etc. (assuming there is a package "std" which defines these).

But if a class has templates, then attributes or parameters of those classes should be able to select a template parameter as a type without creating global datatypes for them. Indeed, they should only have class scope, regardless of whether or not the class has parent packages.

Seems like there is work to be done here on the conceptual level...
Comment 4 Robert Hairgrove 2020-08-08 16:30:54 UTC
"...attributes or parameters of those classes..."

Should be:
"...attributes or parameters of OPERATIONS of those classes..."