Skip to content

Inconsistent use of glob imports #2076

@solonovamax

Description

@solonovamax

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: diffplug/spotless#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions