History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-13253
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Alexey Kudravtsev
Reporter: Vadim Spivak
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Change 'X' type to 'y.X' intention messes up imports.

Created: 18 Aug 06 23:53   Updated: 16 Jan 07 18:24
Component/s: Editor. Error Highlighting, Editor. Intention Actions
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Linux

Build: 5,581
Severity: Medium


 Description  « Hide
Here is a small example that shows the problem:

----------- a/b/Foo.java ------------
package a.b;

public class Foo {
}

----------- a/b/FooFactoryB.java ------------
package a.b;

public class FooFactoryB {
public static Foo getFoo() { return new Foo(); }
}

----------- a/Foo.java ------------
package a;

public class Foo {
}

----------- a/FooFactoryA.java ------------
package a;

public class FooFactoryA {
public static Foo getFoo() { return new Foo(); } }
}

----------- a/Bar.java ------------

package a;

import a.b.FooFactoryB;

public class Bar {

public static void main(String[] args) { Foo aFoo = FooFactoryA.getFoo(); Foo foo = FooFactoryB.getFoo(); }
}

---------------------------------------

Now, in Bar.java, you will see the second statement in main underlined. The intention says 'Change 'foo' type to 'a.b.Foo'. When I select it, this is what happens:

package a;

import a.b.*;
import a.b.Foo;

public class Bar {

public static void main(String[] args) { Foo aFoo = FooFactoryA.getFoo(); Foo foo = FooFactoryB.getFoo(); } }
}

---------------------------------------------------

Which basically messes up the imports for the original Foo class. Also, in my code style I specified only to use the wildcard when there are 99 imports from the same package, so I'm not sure whats going on here. In my real world example, this is really annoying since I have a lot of references to the original class, and I have to use the local history to revert the changes to the imports.



 All   Comments   Work Log   Change History      Sort Order:
Bas Leijdekkers - 01 Nov 06 16:26
This is a problem with the quick fix not any intention (of IPP or otherwise).