Inspectopedia Help

Redundant 'requires' directive in module-info

Reports redundant requires directives in Java Platform Module System files. A requires directive is redundant when a module A requires a module B, but the code in module A doesn't import any packages or classes from B. Furthermore, all modules have an implicitly declared dependence on the java.base module, therefore a requires java.base; directive is always redundant.

The quick-fix deletes the redundant requires directive. If the deleted dependency re-exported modules that are actually used, the fix adds a requires directives for these modules.

This inspection only reports if the language level of the project or module is 9 or higher.

New in 2017.1

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023