[jboss-as7-dev] order of import statements

Tomaž Cerar tomaz.cerar at gmail.com
Tue Oct 9 17:29:50 EDT 2012


On Tue, Oct 9, 2012 at 9:53 PM, David M. Lloyd <david.lloyd at redhat.com>wrote:

> 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.
>
> Jeff, i generally agree with you and can share my idea code-style settings
with you, but David has a point :|
I just enabled "only text changed to vcs" when reformatting code, so you it
will be reformatting just changed code and noting else.


> 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).
>
checkstyle checks for this during build, so no worries about abusing this.

> --
> - DML
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>

--
Tomaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-as7-dev/attachments/20121009/5b195374/attachment.html 


More information about the jboss-as7-dev mailing list