I would prefer not to change the current import order and once org.apache.apex is introduced to keep it together with the org.apache group. It will be extremely inconvenient to work on different branches with different import orders.

Thank you,

Vlad

On 4/6/16 13:18, Munagala Ramanath wrote:
I prefer imports to be organized in groups with the groups themselves
ordered by decreasing order of "scope" where I
consider java to have the widest scope and com.datatorrent the narrowest
(roughly the way we have it now) with a
single blank line separating groups. When "scope" is not clear we can
default to lexicographic. I think this helps
readability.

No major project does completely lexicographic ordering as far as I know.
As a couple of data points : both Hadoop and
Flink are doing roughly what I propose though they are not always
consistent. Here are some examples:

https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FSDataOutputStream.java

-- java imports come after org.apache

https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java

-- java imports come before org.apache

https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java

-- org imports not alphabetic

hadoop-2.7.2-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service:

AbstractService.java

-- import groups not lexicographic: java comes before org but com comes
after.

Service.java

-- java comes after org

Ram

On Wed, Apr 6, 2016 at 12:24 PM, David Yan <[email protected]> wrote:

I think the import order should be alphabetical or lexicographical, and no
blank lines are needed.

The reason is this:

1) It's simple and future proof, and there will be no need to have this
discussion again in the future about what order it should be and where the
blank lines should be placed
2) It's easy to follow, and there is no rule to remember other than it's
alphabetical
3) It's easy to find where a particular import lines are because it's
alphabetical

Whatever we come up with, we should make the change ASAP and fix all the
style violations once and for all.

David


On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <[email protected]>
wrote:

Hi,

We need to include org.apache.apex in the import order that we have right
now:

*Current order:*
java
javax
org
org.apache
io
com
com.datatorrent
*
all static imports

*Proposed order:*
java
javax
org
org.apache
io
com
com.datatorrent
org.apache.apex
*
all static imports

Thanks,
Chandni


Reply via email to