Inspectopedia Help

Dependencies on automatic modules

Reports usages of automatic modules in a requires directive.

An automatic module is unreliable since it can depend on the types on the class path, and its name and exported packages can change if it's converted into an explicit module.

Corresponds to -Xlint:requires-automatic and -Xlint:requires-transitive-automatic Javac options. The first option increases awareness of when automatic modules are used. The second warns the authors of a module that they're putting the users of that module at risk by establishing implied readability to an automatic module.

Example:

//module-info.java module org.printer { requires transitive drivers.corp.org; // reported in case 'drivers.corp.org' is an automatic module }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

JavaRequiresAutoModule
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Java language level migration aids | Java 9

Use the Highlight only transitive dependencies option to warn only about transitive dependencies.

This inspection depends on the Java feature 'Modules', which is available since Java 9.

Inspection options

Here you can find the description of settings available for the Dependencies on automatic modules inspection, and the reference of their default values.

Highlight only transitive dependencies

Default: Selected

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.2, Qodana for JVM 2024.2,

Can be installed with plugin:

Java, 242.22892

Last modified: 11 September 2024