Disable "There may be usages in unloaded module" when refactoring
Answered
Hi, is there a way to disable the "There may be usages in unloaded module" warning when refactoring? It makes working in IntelliJ while having some modules unloaded annoying, since I either know whatever I'm refactoring isn't used in the modules I have unloaded, or I just don't care about the unloaded modules.
Normally IntelliJ uses the Refactoring Preview to let me know about something potentially important, for ex. that it found something inside a comment/string that I might want to check. With an unloaded module, it appears literally every time I refactor anything, so I cannot easily tell whether there's actually something important I need to pay attention to.
Thanks.
Please sign in to leave a comment.
Hi Chylek
Let me check. What is the version of your IDE?
Thanks; I'm always trying to be on the latest stable version.
IntelliJ IDEA 2021.3 (Ultimate Edition)
Build #IU-213.5744.223, built on November 27, 2021
This warning appears if there are unloaded modules which depend on the module which is refactored, so they may contain references to the refactored element. Currently there is no way to switch off this warning, feel free to file a feature request about that. However, if you don't care about unloaded modules, maybe it's better to remove them from the project instead of unloading.
The problem is that removing modules changes modules.xml, which we're sharing in version control to make project setup easier, so it'd be nice to have the ability to unload a module without adding obstacles to regularly used features.
If I recall correctly, this was a reason why people in the team didn't want to use module unloading for modules only a few developers use. Instead, the infrequently used modules were removed completely, but now the few developers who want to add those modules have a constant change in modules.xml, and have to be careful not to commit it to version control.
If modules.xml is in version control, I don't quite understand how it is possible that you don't care about possibility to break code in unloaded modules when you refactor something in modules they depend on. This way you can easily break compilation for other people working on the project, who don't have these modules unloaded. Or maybe you have some other techniques to prevent such problems?
Yes, the technique is "we break compilation, they fix it" :P but since it almost never happens, and even the people who use those modules don't touch them all the time, it's not really a problem. Sometimes it's inconvenient to have a particular module loaded all the time, so loading it only when it's needed and occasionally fixing errors is kind of like resolving merge conflicts.