Bug 240686 - [formatter] Formatter do unexpected things
Summary: [formatter] Formatter do unexpected things
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.4.1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-14 10:55 EDT by Su Su CLA
Modified: 2008-09-15 11:41 EDT (History)
5 users (show)

See Also:


Attachments
Proposed patch (2.76 KB, patch)
2008-08-20 12:30 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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