Bug 198362

Summary: Formatter stops working when source code contains following line
Product: [Eclipse Project] JDT Reporter: Amit Monbaz <amonbaz>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, david_audel, jerome_lanneluc, Olivier_Thomann, philippe_mulet
Version: 3.3   
Target Milestone: 3.3.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Amit Monbaz CLA 2007-07-31 03:21:15 EDT
Build ID: I20070625-1500

Steps To Reproduce:
Enter the following line in any source code file:
int i = (2+3+2)+2;
and the formatter will stop working for that file.

A more complete example of a file on which the formatter will not work:
public class Main {
	public static void main(String[] args) {
		int i = (2+3+2)+2;
	}
}

More information:
Comment 1 Dani Megert CLA 2007-07-31 03:40:25 EDT
Can reproduce on I20070724-0800.
Comment 2 Olivier Thomann CLA 2007-07-31 10:06:17 EDT
This is due to a problem when the CombinedBinaryExpression is built.
I don't know why, but the parenthesis are not set on the right expression leading to the failure while formatting the code.
Comment 3 Olivier Thomann CLA 2007-07-31 13:33:23 EDT
Created attachment 75062 [details]
Proposed fix
Comment 4 Olivier Thomann CLA 2007-07-31 15:03:58 EDT
Released for 3.4M1.
Added regression test in org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test668.

Philippe, candidate for 3.3.1?
Comment 5 Frederic Fusier CLA 2007-08-07 07:18:46 EDT
Verified for 3.4M1 using build I20070806-1800.
Comment 6 Olivier Thomann CLA 2007-08-13 13:55:38 EDT
Jérôme,

+1 for 3.3.1 ?
Comment 7 Jerome Lanneluc CLA 2007-08-14 07:16:09 EDT
+1 for backporting to 3.3.1
Comment 8 Olivier Thomann CLA 2007-08-14 11:09:54 EDT
Reopen for 3.3.1.
Comment 9 Olivier Thomann CLA 2007-08-14 11:15:18 EDT
Released for 3.3.1.
Added regression test in
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test668.
Comment 10 David Audel CLA 2007-09-03 09:00:35 EDT
Verified for 3.3.1 using build M20070831-2000.