Java

Java

Made by DeepSource

Unnecessary imports detected JAVA-W1069

Anti-pattern
Major

Unused imports should be removed from all source files.

If a type is never used, there is no point in importing it in a class. Such imports should be removed from source files. This helps readability and also prevents potential name clashes in the source file.

This issue will be reported when no usages, including doc comments, can be seen for a particular import.

Bad Practice

import java.io.File;

// ...rest of the source that never uses `java.io.File`

Recommended

Just remove unused imports. Most modern IDEs provide handy shortcuts for that. If that's not an option for you, consider removing them manually.

References