Bug 249692 - The ImportRewriteAnalyzer does not honor a formatter setting
Summary: The ImportRewriteAnalyzer does not honor a formatter setting
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 257177 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-04 19:25 EDT by Hüseyin Kartal CLA
Modified: 2008-12-02 08:36 EST (History)
4 users (show)

See Also:


Attachments
Cleanup Setttings (3.61 KB, application/xml)
2008-10-07 08:47 EDT, Hüseyin Kartal CLA
no flags Details
Source Formatter Settings (27.50 KB, application/xml)
2008-10-07 08:48 EDT, Hüseyin Kartal CLA
no flags Details
Screenshot (71.78 KB, image/png)
2008-10-07 08:53 EDT, Hüseyin Kartal CLA
no flags Details
Proposed fix (3.07 KB, patch)
2008-10-24 06:39 EDT, David Audel CLA
no flags Details | Diff

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