Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363447

Summary: When having two FigureRef to the same figure. generated code has 2 variables with same name
Product: [Modeling] GMF-Tooling Reporter: Mickael Istria <mistria>
Component: Generation / TemplatesAssignee: Svyatoslav Kovalsky <kovalsky>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3 CC: borlander
Version: 2.4   
Target Milestone: 3.0M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
A sample GMF Graph highlighting the issue none

Description Mickael Istria CLA 2011-11-10 05:26:03 EST
Created attachment 206774 [details]
A sample GMF Graph highlighting the issue

If in a FigureDescriptor, you have two FigureRef that references that same Figure, the generated code creates the same variable name for both figures.

With the attached gmfgraph, you can see the IfFigure contains two FigureRefs to the diamond Figure. Generated code contains twice a diamond0 variable. A simple "Generate Figures plug-in" shows the issue.
Comment 1 Michael Golubev CLA 2011-11-10 10:25:35 EST
Slava, could you please add this use case to gmfgraph test suite? 

It should not be difficult to fix and the same fix will probably work for both bridge-time and codegen-time templates.
Comment 2 Mickael Istria CLA 2011-11-10 10:27:29 EST
Do you think this could be part of a 2.4.1 maintenance release?
Comment 3 Mickael Istria CLA 2011-11-24 10:41:25 EST
I think adding curly braces around line 45 of Children.xpt should be enough to fix that.
Comment 4 Michael Golubev CLA 2011-11-24 10:45:36 EST
I asked Slava to fix that "ad hoc", without introducing the differences for the generated code that is not explicily affected by problem. 

But yes, if this is difficult enough, then it seems that 
>adding curly braces around line 45 of Children.xpt 
would fix the problem.