IDEA shows error accessing type in the same package
Answered
I am transitioning a large legacy codebase to OPENJDK16 and I am getting an error that I can't resolve. It may have to do with Java Modules as this is the first time I am using them. The latest incarnation of this problem is in the image below:
Note that all of these classes are in the same package (ui) and there are no classes anywhere else with the same name.
I have tried clearing the cache, restarting, refreshing, adding the full class path, adding an import (IDEA complains that it can't see AlarmUI), including this package in an 'exports' line in the module-info.java.
I tried creating a small project with a similar structure but it doesn't show this error.
Interestingly, I can run the project just fine
Please sign in to leave a comment.
Hello! Please try to remove all IDE related data (.iml files and .idea folder) and reimport project again.
Thank you Yaroslav. After removing the .idea directory and .iml file, then rebuilding, the error went away. This solved my problem.
If I may editorialize, it appears to me that the support for Java Modules could be better. A tool that will list out missing exports, requires and even module-info.java files would be very helpful. It seems to me that this kind of tool would be straightforward to implement. Also, a switch to remove the Unnamed Module to show what module-info.java files are needed would also be helpful.