Every class of a package is imported with *
What it finds
import java.util.*; hides which classes a file uses, and a class added to the package later can clash with a name of the file and stop it from compiling. Static imports on demand are reported as well.
From the rule's source, wildcard_import.rs.
import java.util.*;tx0 reports: everything in java.util is imported with *import java.io.File;import static org.junit.Assert.*;tx0 reports: everything in org.junit.Assert is imported class A { List<File> files;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java:import-on-demand" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/java:import-on-demand] reason="..."tx0 explain tx0/java:import-on-demand shows the same in the terminal. Found a false positive? Report it.