2

I have an issue in Intellij IDEA. Let's assume that after pretty heavy refactor we have changed one of the package's name. As you can see in the example below, package name changed from kmi to something different.

enter image description here

In terms of optimizing imports, ctrl + alt + o doesn't handle this case

Is there a shorthand that is working on IntelliJ? Definition of shorthand - It is NOT deleting invalid imports and importing them back again. I wonder if IntelliJ can handle it by one shortcut possibly

To be precise - this is NOT duplicate of IntelliJ Organize Imports because this shortcut doesn't handle my case

dawidklos
  • 902
  • 1
  • 9
  • 32
  • I think you should change the package's name through "refactor - rename" actions and let IntelliJ handle this kind of issues. – lzagkaretos Aug 22 '17 at 08:00
  • but we are talking about the case when something went bad, and how to solve this particular issue, not how to avoid it ;) – dawidklos Aug 22 '17 at 08:02
  • Then maybe you can use simple "Search and Replace in Project scope" for package names (previous and new). I know it is not the best answer, but it is something you can use to overcome inconsistencies more easily. – lzagkaretos Aug 22 '17 at 08:07
  • How did you perform a refactoring that made your code invalid? Refactorings in IntelliJ IDEA would update the imports automatically. – CrazyCoder Aug 22 '17 at 10:58
  • it is possible to perform refactor without checking for usage. I am just curious if in case of something like above is a way to fix it like in eclipse. Apparently not. – dawidklos Aug 22 '17 at 11:31

0 Answers0