Bug 257177 - Saving file inverts space formatting of imports
Summary: Saving file inverts space formatting of imports
Status: RESOLVED DUPLICATE of bug 249692
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-02 06:43 EST by David Newcomb CLA
Modified: 2009-06-24 20:11 EDT (History)
2 users (show)

See Also:


Attachments
config files (3.53 KB, application/octet-stream)
2008-12-02 06:45 EST, David Newcomb CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Newcomb CLA 2008-12-02 06:43:50 EST
Build ID: M20080911-1700

Steps To Reproduce:
Set up:

Java->Editor->Save Actions:
  Format source code
    Format all lines
  Organize imports
  Additional actions
  Convert for loops to enhanced for loops
    Add final modifier to private fields
    Remove unused imports
    Add missing '@Override' annotations
    Add missing '@Deprecated' annotations
    Remove unnecessary casts
    Remove trailing white spaces on all lines
    Correct indentation

Attached is a zip containing:
eclipse_clean_up.xml - my clean up settings (just in case you need it)
eclipse_quantel.xml - my formatting settings

Given the following code:

package uk.co.bigsoft.proj.bus;

import uk.co.bigsoft.proj.dom.ObjectOne;
import uk.co.bigsoft.proj.dom.ObjectTwo;
import uk.co.bigsoft.proj.dom.ObjectThree;

Saving produces:
package uk.co.bigsoft.proj.bus ;

import uk.co.bigsoft.proj.dom.ObjectOne ;
import uk.co.bigsoft.proj.dom.ObjectTwo ;
import uk.co.bigsoft.proj.dom.ObjectThree ;

ok - good. Make an edit and save. Produces:

package uk.co.bigsoft.proj.bus ;

import uk.co.bigsoft.proj.dom.ObjectOne;
import uk.co.bigsoft.proj.dom.ObjectTwo;
import uk.co.bigsoft.proj.dom.ObjectThree;

Spaces are removed. Make another edit and save it to get
your formatting back:
import uk.co.bigsoft.proj.dom.ObjectOne ;
import uk.co.bigsoft.proj.dom.ObjectTwo ;
import uk.co.bigsoft.proj.dom.ObjectThree ;

It toggles like this all the time.

The most bizzare thing is that if you start with:

import uk.co.bigsoft.proj.dom.ObjectOne ;
import uk.co.bigsoft.proj.dom.ObjectTwo;
import uk.co.bigsoft.proj.dom.ObjectThree ;

and save it, you get:

import uk.co.bigsoft.proj.dom.ObjectOne;
import uk.co.bigsoft.proj.dom.ObjectTwo ;
import uk.co.bigsoft.proj.dom.ObjectThree;

make an edit and save to get back to the invert:

import uk.co.bigsoft.proj.dom.ObjectOne ;
import uk.co.bigsoft.proj.dom.ObjectTwo;
import uk.co.bigsoft.proj.dom.ObjectThree ;

The reset of the code formatting is fine. This only happens on the imports.

More information:
Comment 1 David Newcomb CLA 2008-12-02 06:45:41 EST
Created attachment 119253 [details]
config files

This bug is really annoying!
Comment 2 Markus Keller CLA 2008-12-02 08:36:25 EST
Please reopen if you still find a problem with 3.5 M3 or later.

*** This bug has been marked as a duplicate of bug 249692 ***