Bug 20384 - Organize Imports fails to resolve ambiguity [code manipulation]
Summary: Organize Imports fails to resolve ambiguity [code manipulation]
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC other
: P3 enhancement (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2002-06-14 15:29 EDT by Unknown User CLA
Modified: 2005-01-18 16:44 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown User CLA 2002-06-14 15:29:15 EDT
I have the following imports ..

import javax.wsdl.*;
import com.ibm.etools.ctc.wsdl.*;
import com.ibm.etools.ctc.wsdl.Input;
import com.ibm.etools.ctc.wsdl.Output;
import com.ibm.etools.ctc.wsdl.Operation;
import javax.wsdl.Fault;
import javax.wsdl.OperationType;

In javax.wsdl.* and com.ibm.etools.ctc.wsdl.* there are many classes with the 
same name, so I have to resolve the ambiguity by importing specific classes 
afterwards.

If I add some more code and invoke Organize Imports with "Number of Qualified 
Imports" set to 2, errors are introduced into my class because the last few 
import statements above are removed.  

If it's necessary, Organize Imports should leave import statements which 
resolve ambiguities.  Otherwise, it will introduce more errors than it can fix.
Comment 1 Dirk Baeumer CLA 2002-07-31 09:39:41 EDT
Reproduced under 2.0 using the following example:

- package p1 containing A, B, X, Y, Z
- package p2 containing X, Y, Z
- Class Ref

package p3;

import p1.*;
import p2.*;
import p1.X;
import p2.Y;
import p2.Z;

/**
 * @version 	1.0
 * @author
 */
public class Ref {
	X x;
	Y y;
	Z z;
	
	A a;
	B b;
	List list;
}

- do organize imports. You end up with to imports p1.* and p2.*.

Martin, please investigate.
Comment 2 Martin Aeschlimann CLA 2002-11-20 13:09:43 EST
support for ambiguity resolving added > 20021120