Skip to content

Remove wildcard imports #2517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

iddeepak
Copy link

@iddeepak iddeepak commented Jun 18, 2025

I have just opened a PR to help us say “goodbye” to those sneaky wildcard imports (like import java.util.*;) whenever Spotless tidies up our Java files. Wildcard imports can make it hard to see exactly which classes you’re relying on, so this change introduces a new step in the Spotless plugin that:

Spots any import foo.*; lines in your source

Removes them outright (so your IDE or build tools can regenerate only the exact imports you need)

Add remove wildcards imports when formating and ordering imports. #649

Unused wildcard imports aren’t removed (needed to block import foo.*;) #240

How to block import-star (*) wildcards in the Maven/Eclipse JDT formatter #832

Copy link

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thanks.

iddeepak and others added 2 commits June 20, 2025 01:19
Co-authored-by: Consequences of Lacking Discipline <8830888+Pankraz76@users.noreply.github.com>
…WildcardsUnformatted.test

Co-authored-by: Consequences of Lacking Discipline <8830888+Pankraz76@users.noreply.github.com>
@iddeepak iddeepak marked this pull request as ready for review June 19, 2025 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants