Bug 240686

Summary: [formatter] Formatter do unexpected things
Product: [Eclipse Project] JDT Reporter: Su Su <death228>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: daniel_megert, david_audel, death228, jerome_lanneluc, Olivier_Thomann
Version: 3.4   
Target Milestone: 3.4.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Su Su CLA 2008-07-14 10:55:15 EDT
After I press Ctrl+Shift+F to format the code.

/** 
 * <pre>{ }</pre>
 * 
 * <table>
 * <tr>{ "1",
 * "2"}
 * </tr>
 * </table>
 */

becomes

/**
 * <pre>
 * 
 * </pre>
 * 
 * <table>
 * <tr>
 * "1", "2"}
 * </tr>
 * </table>
 */

Two "{"s and one "}" are missing.
Comment 1 Frederic Fusier CLA 2008-08-20 11:37:21 EDT
Reproduced.

The problem comes from the parser which does not record text start while consuming a opening brace. This was not necessary for other comment parsers, but is essential for the comments formatter parser!
Comment 2 Frederic Fusier CLA 2008-08-20 12:30:20 EDT
Created attachment 110466 [details]
Proposed patch
Comment 3 Frederic Fusier CLA 2008-08-20 12:33:39 EDT
Released for 3.5M2
Comment 4 Frederic Fusier CLA 2008-08-20 12:35:52 EDT
Jerome, as this is a regression since 3.3.2, is it OK to backport the fix to 3.4.1?
Comment 5 Jerome Lanneluc CLA 2008-08-20 12:43:48 EDT
+1 for 3.4.1 since this is a regression and there is loss of data.
Comment 6 Frederic Fusier CLA 2008-08-21 04:45:33 EDT
The proposed patch is the same for R3_4_maintenance branch code...
Released for 3.4.1
Comment 7 Olivier Thomann CLA 2008-08-28 12:46:11 EDT
Verified for 3.4.1 using M20080827-2000
Comment 8 David Audel CLA 2008-09-15 11:41:34 EDT
Verified for 3.5M2 using I20080914-2000