Bug 249692

Summary: The ImportRewriteAnalyzer does not honor a formatter setting
Product: [Eclipse Project] JDT Reporter: Hüseyin Kartal <hk>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, david.newcomb, frederic_fusier, Olivier_Thomann
Version: 3.4   
Target Milestone: 3.5 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Cleanup Setttings
none
Source Formatter Settings
none
Screenshot
none
Proposed fix none

Description Hüseyin Kartal CLA 2008-10-04 19:25:09 EDT
I think the source clean up module "formats code" before it "organize imports" if selected. In some configurations (like my one) the clean up show every time changes on the imports even if there were none.

i think because of the "whitespace before semicolon" option on format.

hint: select every option in source format and in source clean up. then cleanup source to reproduce. every time there will be shown some changes on imports.
Comment 1 Olivier Thomann CLA 2008-10-05 18:21:40 EDT
Please provide example of what you mean as well as steps to reproduce.
Thanks.
Comment 2 Hüseyin Kartal CLA 2008-10-07 08:47:33 EDT
Created attachment 114408 [details]
Cleanup Setttings
Comment 3 Hüseyin Kartal CLA 2008-10-07 08:48:04 EDT
Created attachment 114409 [details]
Source Formatter Settings
Comment 4 Hüseyin Kartal CLA 2008-10-07 08:53:47 EDT
Created attachment 114411 [details]
Screenshot
Comment 5 Hüseyin Kartal CLA 2008-10-07 08:58:21 EDT
in the screenshot you can see the result of a cleanup process. even if you repeat the process several times there are the same differences in the import directives.
you should be able to reproduce if you import the attached setting in your SourceFormatter and your CleanUp preferences.
Comment 6 Jerome Lanneluc CLA 2008-10-07 09:02:04 EDT
Moving to JDT/UI
Comment 7 Dani Megert CLA 2008-10-08 09:11:37 EDT
ImportRewriteAnalyzer.getResultingEdits(IProgressMonitor) does not honor the following code formatter setting:
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON
Comment 8 David Audel CLA 2008-10-24 06:39:11 EDT
Created attachment 116029 [details]
Proposed fix
Comment 9 David Audel CLA 2008-10-24 06:41:01 EDT
Released for 3.5M3.

Test added
  ImporRewriteTest#testAddImports4()
Comment 10 Jerome Lanneluc CLA 2008-10-28 08:58:46 EDT
Verified for 3.5M3 using I20081027-1800
Comment 11 Markus Keller CLA 2008-12-02 08:36:25 EST
*** Bug 257177 has been marked as a duplicate of this bug. ***