Issue with code generation [message #1807912] |
Wed, 12 June 2019 08:22 |
Yoann Farré Messages: 235 Registered: November 2017 |
Senior Member |
|
|
Hello,
Using the C++ code generator, I obtain an error that looks like to a bug but I'm not sure about.
The use case is the following one:
I generate automatically a transition in a state machine from a sequence diagram. To keep a link between the transition and the sequence diagram which produces the transition, I created a stereotype applied on the transition which contains a Message as stereotype attribute.
When I generate the code, I want to generate the state machine of the class but the sequence diagram and the Message is useless fot that use case so I applied the Stereotype NoCodeGen (C_Cpp profile) on the package which contains the sequence diagram (and all owned elements).
Now, if I generate the code from this model, I obtain an error (see attached files : pop up and stack trace).
If I remove the message from the transition (so I break the link), the error doesn't occur.
To generate the code correctly, I have to close and open the model.
Seeing the error log, I suppose that the transformation chain try to access to the values of SendEvent and Receive Event elements of the Message.
I precise that the Message Occurence Specifications are stored in the same resource (MyModel.uml) than the other UML elements.
Could you help me with this issue?
Thanks.
Yoann.
-
Attachment: error_log.txt
(Size: 7.44KB, Downloaded 67 times) -
Attachment: Error.PNG
(Size: 19.29KB, Downloaded 145 times)
|
|
|
Re: Issue with code generation [message #1807964 is a reply to message #1807912] |
Thu, 13 June 2019 11:49 |
|
The error message indicates that the referenced message-occurence-specification (from the stereotype attribute) is not contained in any resource. If you debug, the eContainer of the message-occurence-specification is probably null as well, i.e. it's not owned by another object. This can happen due to multiple reasons. One is the use of an element created by the UMLFactory that has never been added to a container. But it's more likely an issue of the model copier. If I should look into the issue, I would need your modelto reproduce/identify the issue.
Ansgar
|
|
|
|
Re: Issue with code generation [message #1808433 is a reply to message #1808035] |
Mon, 24 June 2019 14:35 |
|
Hi Yoann,
concerning your first question: the lazy copier does not evaluate the "NoCodeGen" stereotype, i.e. it will copy this package regardless of the stereotype. It will (of course) preserve the stereotype.
I'm probably not the best person to answer your second questions as I did not encounter this problem. Elements created within an aborted transaction are normally destroyed. If you use a command within the transaction to set a reference, this should be undone as well. As far as I know, only exceptions as as an NPE could leave the model in an inconsistent state - in this case before the command could be canceled.
Ansgar
|
|
|
|
Powered by
FUDForum. Page generated in 0.03148 seconds