Hi, I already proposed some bug fixes and enhancements in previous patches :
Generate Java menu don't launch the good plugin at http://gforge.enseeiht.fr/tracker/?func=detail&aid=3526&group_id=24&atid=180 Incorrect log path for the Java generation at http://gforge.enseeiht.fr/tracker/?func=detail&aid=3528&group_id=52&atid=109 wrong template for Java generation at http://gforge.enseeiht.fr/tracker/?func=detail&aid=3529&group_id=52&atid=109 Wrong attributes generation in UML to Java http://gforge.enseeiht.fr/tracker/?func=detail&atid=109&aid=3541&group_id=52 More than 15 bug fixes for java generation at http://gforge.enseeiht.fr/tracker/?func=detail&aid=3596&group_id=52&atid=109 But all the patches where computed from the same CVS head and when the committer applied the fourth one (#3541), the other patches can't be applied anymore. I come back with a cumulative patch from the 5.2.0 head. It contains bugs fixes and enhancements of previous patches #3526, #3528, #3529 and #3596. I also included some new bugs fixes and enhancements as follows. Bug fixes: --------- 1- Generate Interface extensions 2- For an abstract Class, generate a protected default constructor 3- Generate the super() call in default constructor, even when no superclass declared 4- When given, use default value to initialize an attribute. 5- Generate a final qualifier for readonly owned attributes (was made for associations) 6- For multiple attributes, distinguish between type declaration (an Interface, typically List, is expected in most programming styles) and the implementation Class (typically ArrayList). Introduction of some (Interface, Class) pairs in the File Properties Uml2Java menu. 7- Generate the Exception throws for methods generated from implemented interfaces or abstract inherited operations 8- Generate a synchronized qualifier for an operation with concurrency = guarded 9- Use the full method signature in the "// Start of user code for …" comment to avoid code loss during second time generation in case of overloading or internals. 10- For an attribute or an operation typed by an enumeration, don't initialize with or return an instance of this non instanciable type but instead, the first litteral. 11- Idem, for an attribute or an operation typed by an Interface or Abstract Class, don't initialize with or return an instance of this non instanciable type but try to find an implementation Class. (For this first try, priority to an implementation in the same package. To be improved.) 12- Idem, for an attribute or an operation of multi valued type, don't return an instance of the base type but a Collection implementation (the one chooses with the (Interface, Class) pair in the File Properties Uml2Java menu (was already made for associations). 13- Generate list element accessor and adder for multiple attributes, not only for multiple associations. 14- Normalize accessors names : isName (instead of getName) for the getter of a Boolean attribute; and for a multiple attribute, getName for the arrayed attribute (we had getNameList for an association and getName for an attribute), getNameElt for getting an element (we had getName for an association and nothing for an attribute), addNameElt for adding an element (we had addName for an association and nothing for an attribute). 15- In automated generated accessors, don't use the this. access for a static attribute. 16- Generate an import for the pair (Interface, Class) when a multiple attribute (was only made when presence of a multiple association) 17- When a method is to be generated due to an Interface or an inherited abstract operation, don't duplicate when the method is already owned or inherited (including generated accessors). For accessors, don't generate the automatic version, but give priority to owned, interface or abstract declarations as they can be there to modify visibility or to throw exceptions. [For this first try, we don't take visibility into account. As visibility can be relaxed, this will have to be improved] 18- Correctly generate an operation opaque behavior (at the beginning of the body, after the "// Start of user code for …" [sadly, Topcased don't allow to give an opaque behavior for an interface or abstract operation, but only for standard ones]. Enhancements: ------------ 1- When an operation to be generated (owned, abstract or implemented) is recognized as being an accessor according to the naming convention above, generate the standard accessor body (instead of the default void or return Type() body). 2- Idem when an operation is recognized as being a constructor (generate a body with initialization of the attributes with same names as parameters). 3- For those using this programming style, introduction of a switch in the File Properties Uml2Java menu for using setters for attributes initialization in the constructors. 4- For those using this programming style, introduction of a switch in the File Properties Uml2Java menu for initializing the attributes in the constructor instead of the declaration (except for static final ones). 5- Generate a // TODO comment for generated code that would be checked by the user 6- Generate imports from package imports and from dependencies [to be improved to avoid redondancies] Remains to be done: ------------------ 1- Update the documentation (to be seen with the developer team) 2- Grab inherited associations (currently only attributes) to identify those accessors among the operations to be generated (owned, interface or abstract) and to use them for initializations in the parameterized constructors. 3- Filter generated imports to avoid redundancies 4- Improve the choice of implementation Class used for initializing or returning an Interface type (priority to classes in dependencies, in same package, with shorter implementation path) 5- Generate author from Model 6- Look at what could be generated from sequences 7- Improve Model validation and warnings produced. Will be particularly useful for UML modeling beginners like my students who can create so incredible and unpredictable model pieces! I just upload the patches at http://gforge.enseeiht.fr/tracker/index.php?func=detail&aid=4331&group_id=52&atid=109 Could I hope to see these patches applied for the 5.3.0 version ? Thanks, Jean-Pierre PECUCHET INSA Rouen - LITIS Avenue de l'Université - BP 8 - 76801 Saint-Étienne-du-Rouvray Cedex France http://www.insa-rouen.fr & LITIS - EA4108 http://www.litislab.fr Tel: (+33) 232 956 543 Mobile: (+33) 680 856 214
_______________________________________________ Topcased-users mailing list [email protected] http://lists.gforge.enseeiht.fr/cgi-bin/mailman/listinfo/topcased-users
