ForbidWildcardImports misses indented import statements (original) (raw)
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.