[jboss-as7-dev] order of import statements
David M. Lloyd
david.lloyd at redhat.com
Tue Oct 9 15:53:06 EDT 2012
On 10/09/2012 11:55 AM, Jeff Mesnil wrote:
> Hi,
>
> Is there an agreement on the order of import statements in our codebase?
>
> I'm using eclipse which, by default, organize imports in the following order:
>
> static
>
> java
> javax
> org
> com
>
> but we have some files with a different order *cough*intellij*cough* :)
> That makes for some noise in the commits when I modify a class and eclipse changes the imports order.
>
> If we agree with this default order, I can add a checkstyle rule[1] for this.
We tried this before but it didn't work out because checkstyle gets
confused about imports which are only used in Javadoc, and because
regardless of checkstyle rules everyone cannot agree on an order, and
anyway changes to existing code should NEVER EVER EVER EVER include
import "cleanups", "reorgs", or anything of the sort (no matter how bad
you think it is) along with "real" changes because it just obscures what
has changed and causes trouble. The same goes for whitespace fixes. If
a file is very offensively formatted, I could see considering a
specific, dedicated commit whose sole purpose and content is to clean up
the whitespace (i.e. absolutely no functional changes), but other than
that... no.
For new code I can't imagine it really matters as long as you don't use
star imports (though using star with static import for certain classes
is just fine).
--
- DML
More information about the jboss-as7-dev
mailing list