Community
Participate
Working Groups
Created attachment 271425 [details] smallest model triggering the bug When, - using an internal self transition with a non-empty effect, - inside a composite state that has at least two states, then, the code generator generates duplicate code, i.e., the generated code contains the definition of the associated actionchain twice: from Top.hh: > void actionchain_____State1__timeout1( const UMLRTMessage * msg ); > void actionchain_____State1__timeout1( const UMLRTMessage * msg ); When, either - the number of substates in the composite state is reduced to one, or - the effect is removed from the internal self transition, the bug does not occur. The model in the attachment is pretty much as small as I could make it.
*** Bug 528164 has been marked as a duplicate of this bug. ***
Confirmed. The duplicated functions are the *actionchain* functions, not the *transitionaction* functions. The problem is in the way we handle internal transitions in the state machine flattener. Specifically, we "push-down" all internal transitions to the simple states, which produces a state machine with the same behaviour. However, when we do that, for every internal transition, we create a new self transition in each simple state with a copy of its ActionChain, specifically at org.eclipse.papyrusrt.codegen.statemachines.transformations.StateNestingFlattener.copyInternalTransitions(SimpleState, Iterable<Transition>) This action chain is created with a reference to the TransitionAction, which means that only one transition action is generated, but multiple copies of the action chain functions are generated.