spring-data-commons icon indicating copy to clipboard operation
spring-data-commons copied to clipboard

Remove use of star imports in the codebase

Open jxblum opened this issue 3 years ago • 4 comments

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).

jxblum avatar Apr 12 '22 18:04 jxblum

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

mp911de avatar Apr 19 '22 07:04 mp911de

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

jxblum avatar Apr 19 '22 16:04 jxblum

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 ?

karthikeyan-r avatar May 01 '22 06:05 karthikeyan-r

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.

mp911de avatar May 01 '22 12:05 mp911de