Community
Participate
Working Groups
Build Identifier: I20090611-1540 The Java "Organize imports" command (shift-ctrl-o) always pulls static imports out to the top, which breaks the code standards of some teams. There should be an option for static imports to be interleaved with other imports, alphabetically. You can get to the relevant settings screen by: 1) Window -> Preferences 2) Java -> Code Style -> Organize Imports There are some static import settings there, but nothing about interleaving them with other imports. The workaround is very tedious: manually cut/paste the static imports back into the import list each time you organize it (or don't use organize imports at all). Reproducible: Always Steps to Reproduce: 1. Add several non-static Java imports to a .java file 2. Add several static Java imports to the same file 3. Press ctrl-shift-o to organize imports 4. Notice that the static imports are pulled out of the alphabetic import list, into there own section on top
ImportRewrite would have to support this. Low priority for me, since the import order is semantically irrelevant.
I need imports in the following format: import com.example.my.Class; import com.example.some.Stuff; import static com.example.my.static.Import; import org.other.company.Class import org.other.some.Stuff; import static org.other.static.Import; Eclipse almost can do this (by creating import groups for the static imports and interleaving with the regular ones), but it adds an extra line between the regular and corresponding static import groups. Clearly there are so many different styles that Eclipse doesn't want to be hacking in support for every request. But handling semantically irrelevant issues is an important feature that IDE's provide, allowing developers to ignore them. So it's critical to be able to customize it to match other IDE's, tools, and company wide style guidelines. I'll be working on a patch to include static imports at the end of the corresponding import group, and it probably won't be too hard to include them interleaved in alphabetical order.