IDEA 10.0.3 replaces declarations with fully qualified names on refactoring

Whenever I move a (unambiguously named) type to another package, IDEA decides to replace all occurrences of given type with its fully qualified name instead of just adding the appropriate imports; going through all affected files and manually fixing the imports is madness.

The "Use fully qualified class names" option is disabled. Has anybody run into the same problem?

6 comments
Comment actions Permalink

Are you moving the classes via Refactor->Move? Or are you moving them via the file system?

The only time I have seen this happen is if you move files around in the file system and the package declaration at the top of the file doesn't match its location in the package structure. Using the move in refactor of course avoid this issue. I have never seen it happen when using Refactor->Move.

0
Comment actions Permalink

Indeed, Refactor -> Move seems to resolve the issue. I was dragging & dropping the class in the project view, I was under the impression that those operations are equal (coming from Eclipse where they are).

0
Comment actions Permalink

Well it happens in the same module as well, so I guess it's not the same issue.

0
Comment actions Permalink

It should work also with DnD. Did you drag java classes? Were the classes accessible on method call sites? Thank you

0
Comment actions Permalink

Dragging and dropping within IntelliJ is the same as a Refactor->Move. It should work just fine there too. There has to be something odd with the project setup causing IntelliJ to get confused. I am not sure what that could be though.

0

Please sign in to leave a comment.