I had a project with the structure com.foo.Class, I moved a bunch of classes from the package com.foo to different sub-packages com.foo.bar by dragging and dropping the files in the project explorer. I moved more than one file at a time.
After the initial refactor the classes in the new packages could not import classes from the other sub-packages (e.g com.foo.bar1.ClassA cant import com.foo.bar2.ClassB)
It is a Maven project and my initial package is in the main/java folder.
I proceeded to invalidate caches ticking all boxes in the dialog. Now IntelliJ doesn't even open my .java files and they appear with a different symbol than the files in the main package. I also tried right-clicking in the pom.xml and then Maven --> Reload project to no effect.
The top icon is the icon of regular classes, and the bottom icon is the one used for the classes I cannot open (it seems to match the icon used for package-info.java files). New classes are created with the regular class icon and I can open them without any trouble.
One time after invalidating the caches some of the classes I moved appeared with the regular symbol and I could open them. However, after another cache invalidation, I can no longer open them. New classes can be added to the packages and are detected normally.