Bug 48242 - Organize Import "gives up" too easily
Summary: Organize Import "gives up" too easily
Status: VERIFIED DUPLICATE of bug 44984
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.3 M3   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 37757 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-12-07 17:10 EST by David Corbin CLA
Modified: 2006-10-30 11:43 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Corbin CLA 2003-12-07 17:10:36 EST
I'm typing code.

I type

    List list = new ArrayList();
    list.

When I get there, because List is not imported, List has a red-squiggly under
it, and I do not get a list of valid methods after the period.  

However, because the code is syntacticly incomplete, Organize Import won't run.
 But there's a red-squiggly. List is clearly known to be a class that needs to
be imported.  Organize Import should be able to (a) import everything up to the
first syntax error and/or (b) specifically import those classes that are shown
as "unknown".
Comment 1 Dirk Baeumer CLA 2003-12-08 04:05:47 EST
Martin, this one is comparable to the one we discussed on Friday.
Comment 2 Martin Aeschlimann CLA 2003-12-08 04:28:13 EST
There is a good reason why organize import does not want to run in this case: 
It might be able to detect 'List' in your example, but it will also remove 
other imports for type references temporarly invisible due to your syntax error.

This would be very bad as it could require you to choose these types from a 
list again (if ambiguous).

So I don't think we should change that.
Use 'Add import' on the type reference.

This PR is simpliar to bug 44627.
Code assist could be cleverer here and still offer you methods from a 'List'

*** This bug has been marked as a duplicate of 44627 ***
Comment 3 Martin Aeschlimann CLA 2003-12-08 04:37:52 EST
*** Bug 37757 has been marked as a duplicate of this bug. ***
Comment 4 Frederic Fusier CLA 2006-10-30 11:35:56 EST
Reopen to set correct duplicate bug
Comment 5 Frederic Fusier CLA 2006-10-30 11:36:18 EST

*** This bug has been marked as a duplicate of 44984 ***
Comment 6 Frederic Fusier CLA 2006-10-30 11:43:14 EST
Verified for 3.3 M3 using build I20061030-0010.