github-api icon indicating copy to clipboard operation
github-api copied to clipboard

Inconsistent use of glob imports

Open solonovamax opened this issue 9 months ago • 0 comments

Some classes use glob imports, while others don't. The use of glob imports across files seems to be rather inconsistent.

Currently, with spotless, there doesn't seem to be a way to enforce using/disallowing glob imports, however there is an open issue for it: https://github.com/diffplug/spotless/issues/649. Some comments on the issue suggest using

<replaceRegex>
    <name>Remove wildcard imports</name>
    <searchRegex>import\s+(?:static\s+)?[^\*\s]+\*;(\r\n|\r|\n)</searchRegex>
    <replacement>$1</replacement>
</replaceRegex>

to remove all the glob imports, however this solution will simply remove them and won't replace them with the appropriate imports, causing the compile to fail.

Opened due to discussion in #2074

solonovamax avatar Mar 28 '25 21:03 solonovamax