Bug 94078 - [code manipulation] Source -> Organize Imports does not work correctly for static imports
Summary: [code manipulation] Source -> Organize Imports does not work correctly for st...
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-08 23:34 EDT by Stephen Tyler CLA
Modified: 2015-09-23 09:08 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Tyler CLA 2005-05-08 23:34:13 EDT
Source -> Organize Imports does not work correctly for static imports.

For example, I am using lwjgl and I call  glLoadIdentity();
When I organize imports, i expect that the line

import static org.lwjgl.opengl.GL11.glLoadIdentity;

is place at the top... but this does not happen.
Comment 1 Frederic Fusier CLA 2005-05-09 04:51:08 EDT
Move to JDT/UI
Comment 2 Dirk Baeumer CLA 2005-05-09 06:41:13 EDT
Stephen,

we are not automatically generating static imports. This isn't possible since it
would mean that we know all static fields and methods in the workspace, which is
currently not possible.

Static imports can only be added using Add Import.

I will keep the bug as an enhancement.
Comment 3 Denis Roy CLA 2009-08-30 02:20:24 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 4 Dani Megert CLA 2013-05-27 10:44:53 EDT
Bug 283287 offers an alternative solution.
Comment 5 Dani Megert CLA 2013-05-27 10:46:15 EDT
*** Bug 409142 has been marked as a duplicate of this bug. ***
Comment 6 Dani Megert CLA 2013-05-28 04:05:40 EDT
*** Bug 409142 has been marked as a duplicate of this bug. ***
Comment 7 xghost . CLA 2015-06-29 01:23:39 EDT
I see it's been quite a while since this report last saw some action, but the recommended solution in a previous comment is not really as practical as it might appear at first.

I think this report is still valid and (hopefully) someone will work on it :c

I've tried using content assist for this as suggested in Bug 283287 and in this SO post (https://stackoverflow.com/questions/288861/eclipse-optimize-imports-to-include-static-imports)

Unfortunately, I find that the content assist is does not work as I expect (e.g. as effectively/efficiently as the automatic inclusion of non-static imports). In fact, to make it "work", I find that I have to manually add pretty much everything in the library I'm trying to use (e.g. lwjgl).

This happens to be a very frustrating situation, to say the least, especially when you're learning/testing a new library and end up fighting the tool that should be helping you out instead; it severely interrupts developer workflow...
Comment 8 Steven Byks CLA 2015-09-23 09:08:08 EDT
I think I'm sufficiently annoyed by this bug that I'd like to try working on it.  If anyone could give me some pointers for where to start that would be greatly appreciated.