Back to all reviewers

Avoid wildcard imports

quarkusio/quarkus
Based on 4 comments
Java

Wildcard (star) imports like `import java.util.*;` are prohibited in the codebase as they reduce code readability and can cause naming conflicts. Always import specific classes individually.

Code Style Java

Reviewer Prompt

Wildcard (star) imports like import java.util.*; are prohibited in the codebase as they reduce code readability and can cause naming conflicts. Always import specific classes individually.

Configure your IDE to disallow wildcard imports:

  • In IntelliJ IDEA: Navigate to Editor -> Code Style -> Java -> Imports and set ‘Class count to use import with *’ to 999.
  • The same setting should be applied for ‘Names count to use static import with *’.

Instead of:

import java.util.*;

Use:

import java.util.List;
import java.util.Map;
import java.util.Set;

This makes dependencies explicit and avoids potential name conflicts when classes with the same name exist in different packages.

4
Comments Analyzed
Java
Primary Language
Code Style
Category

Source Discussions