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

Bug 328932

Summary: Java generation : java.lang.IndexOutOfBoundsException in Helios SR1
Product: [Modeling] MoDisco Reporter: Fabien Giquel <fabien.giquel>
Component: TechnologiesAssignee: Fabien Giquel <fabien.giquel>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: gdupe, hugo.bruneliere, modisco.web-inbox, nicolas.bros
Version: 0.8.1Flags: fabien.giquel: helios+
fabien.giquel: indigo+
Target Milestone: 0.8.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 328931    
Bug Blocks:    

Description Fabien Giquel CLA 2010-10-28 10:18:13 EDT
There is an issue when launching Java generation template with Helios SR1.
The error does not occur in 3.7 milestones.
See "depends on" M2T issue for details on the error.
Comment 1 Fabien Giquel CLA 2010-10-28 10:19:37 EDT
oups, wrong dependency 181952 -> 328931
Comment 2 Nicolas Bros CLA 2010-10-28 10:36:20 EDT
using a "for" loop instead of a recursive template fixes the problem:

[template public writeBrackets(o : ASTNode, d : Integer)]
[for (i : Integer | Sequence{1..d})]['[]'/][/for]
[/template]
Comment 3 Nicolas Bros CLA 2010-10-28 12:32:49 EDT
For some reason, the previous code outputs nothing when d = 1.
So, I propose instead:

[template public writeBrackets(o : ASTNode, d : Integer)]
[if (d = 1)]['[]'/][/if]
[if (d > 1)][for (i : Integer | Sequence{1..d})]['[]'/][/for][/if]
[/template]
Comment 4 Fabien Giquel CLA 2010-11-24 08:02:47 EST
since We do not know when bug 328931 can be fixed and we have a simple solution, I commited your proposal, Nicolas. 
Both on 0.8 (rev 3615) and 0.9 branch (rev 3616).
Comment 5 Hugo Bruneliere CLA 2011-01-11 05:08:52 EST
Bug fixed.