Inspectopedia
 
2024.3

Dependencies on automatic modules

Warning
New
Last modified: 03 December 2024

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:

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.