Bug 136580

Summary: [ast rewrite] Comma is missing between update expressions in the ForStatement
Product: [Eclipse Project] JDT Reporter: Raimar Falke <i-buzilla-eclipse-82uwuefj>
Component: CoreAssignee: Martin Aeschlimann <martinae>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: i-buzilla-eclipse-82uwuefj, philippe_mulet
Version: 3.1.1   
Target Milestone: 3.2 RC2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
suggested fix none

Description Raimar Falke CLA 2006-04-13 05:00:12 EDT
If a block is copied with ASTNode.copySubtree where the 
block contains a for statement with multiple updaters 
the comma will be missing in the rewritten document.

Looking at the source the problem is also there in CVS HEAD.

One solution is to change in org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFlattener.visit(ForStatement) something like the following:

-        visitList(node, ForStatement.UPDATERS_PROPERTY, null);
+        visitList(node, ForStatement.UPDATERS_PROPERTY, ", ");
Comment 1 Martin Aeschlimann CLA 2006-04-13 08:45:03 EDT
Created attachment 38506 [details]
suggested fix
Comment 2 Martin Aeschlimann CLA 2006-04-13 08:46:23 EDT
Phlippe, I suggest to include this fix in RC2. Do you approve?
Comment 3 Philipe Mulet CLA 2006-04-25 05:32:50 EDT
+1 for 3.2RC2
Comment 4 Martin Aeschlimann CLA 2006-04-25 06:24:26 EDT
patch released > 20060425
Comment 5 Olivier Thomann CLA 2006-04-28 14:25:06 EDT
Verified with I20060427-1600 for 3.2RC2 (checking the source code).