GNOME Bugzilla – Bug 519162
C++ code generation mixes up attributes of classes and discards default values
Last modified: 2008-04-06 18:39:32 UTC
Please describe the problem: The C++ code generation module does not respect the order of attributes of UML classes. If UML class C has attributes a,b,c,d,e,f in this order it is unpredictable in which order they will show up in the C++ code. For larger numbers of attributes this makes the code unreadable. Moreover, default values as in f(x:int = 0):int are discarded. Steps to reproduce: 1. Create an UML class C. 2. Add attributes a,b,c to C. 3. Add operation f(x:int = 0):int to C. 4. Export to C++. 5. Look at the generated code file. Actual results: The code file is generated, but contains unsorted attributes and misses default values for function parameters. Expected results: I would expect attributes to show up in exactly the same order I defined them in the class diagram. Does this happen every time? Yes. Other information:
2008-04-06 Hans Breuer <hans@breuer.org> * plug-ins/python/codegen.py : use a list for attributes rather than a dictionary to preserve the order of attributes. Fixes bug #519162