Skip to content

Remove use of star imports in the codebase #2601

Open
@jxblum

Description

@jxblum
Contributor

A number of production classes and test classes alike import all the members of a class using a star import or static star import.

Star imports do not improve the readability of a class, and often times introduces ambiguity (confusion) when more than one class shares a similar API (e.g. by name).

Activity

mp911de

mp911de commented on Apr 19, 2022

@mp911de
Member

As per our conventions, we use star imports if we use more than 10 members from a package.

jxblum

jxblum commented on Apr 19, 2022

@jxblum
ContributorAuthor

I think that convention should be changed. Star imports serves no useful purpose.

karthikeyan-r

karthikeyan-r commented on May 1, 2022

@karthikeyan-r

Hi @mp911de , I would like to contribute to this fix. I found that star imports are done in CreatedBy.Java & CreatedDate.java for static import of ENUM types (3 fields).

Shall i change this or is it based on convention ?

mp911de

mp911de commented on May 1, 2022

@mp911de
Member

Thanks for reaching out. Changing code style is a team issue on which we've not decided yet. It doesn't make sense to proceed here yet.

Going forward, we have about 16 repositories with 4 maintained branches each that we take care of. If we would proceed, then a pull request isn't efficient.

added
for: team-attentionAn issue we need to discuss as a team to make progress
and removed on Jun 28, 2022
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

    for: team-attentionAn issue we need to discuss as a team to make progresstype: taskA general task

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mp911de@karthikeyan-r@jxblum

        Issue actions

          Remove use of star imports in the codebase · Issue #2601 · spring-projects/spring-data-commons