Skip to content

ForbidWildcardImports misses indented import statements #2938

Closed

Description

@mirkoalicastro

While testing some other spotless changes, I noticed this interesting behaviour. ForbidWildcardImports fails to flag wildcard import statements that have leading whitespace (either indentation or tab). Leading whitespace before an import is valid Java (although ugly 😅), so these lines compile but they don't get detected by the lint.

Steps to reproduce

Run the forbidWildcardImports step against:

  import java.util.*;

(2 leading spaces)

Expected

Line reported as wildcard-import lint errors.

Actual

No lint error.

Activity

  1. added 3 commits that reference this issue on May 19, 2026
    6fb1b03
    a292be2
    228d42f
  2. added a commit that references this issue on May 26, 2026
    66dae19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions