wmyywm / eclipse-code-formatter-intellij-plugin

Automatically exported from code.google.com/p/eclipse-code-formatter-intellij-plugin
0 stars 0 forks source link

Optimize imports duplicates them #62

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
To reproduce the problem,

1. Enable Eclipse Code Formatter plugin, with Optimize Imports option enabled 
and configured with the *org.eclipse.jdt.ui.prefs* file (see attachment).
2. Reformat a Java source file with optimize imports enabled (version 4.0.0, 
disabled with previous versions).

The expected output is the original Java source file reformatted with the 
Eclipse formatting rules and the imports rearranged according the Eclipse 
profile rules. What I see instead is the code correctly formatted, but all the 
imports expressions are reordered *and* duplicated: I see two identical blocks 
of reordered imports.

I'm using IntelliJ IDEA 12.1.6 with Eclipse Code Formatter 4.0.0 (but I have 
this exact problem since 3.7.0 or 3.6.0), on Ubuntu Linux 13.10 64bit.

I have unused import statements, code still compiles but since I collaborate 
with other people that use Eclipse this is annoying, especially when we have to 
merge changes in our VCS.

Original issue reported on code.google.com by manuel.p...@gmail.com on 25 Nov 2013 at 9:11

Attachments:

GoogleCodeExporter commented 9 years ago
I see, the parsing of the file is wrong, in one case, the one when the file do 
not contain line 
org.eclipse.jdt.ui.importorder=...
You would need to enable project specific import order for it to work. 

Or you can export the settings (result is file *.importorder), and use it 
rather than org.eclipse.jdt.ui.prefs

Original comment by vojta.kr...@gmail.com on 25 Nov 2013 at 9:52

GoogleCodeExporter commented 9 years ago
Ok, thank you very much!

Original comment by manuel.p...@gmail.com on 25 Nov 2013 at 1:42