dev@glassfish.java.net

Re: java.* - import first or last?

From: Jerome Dochez <jerome.dochez_at_oracle.com>
Date: Thu, 9 Dec 2010 01:28:46 -0800

I am with Bill here, I always put my java imports first and I rarely use the * wildcard (which is one of my pet-peeve when reading others code).

I many cases I find the java.* imports annoying as I feel the compiler should do it for me and let me just do my app specific imports. So the java.* being so boring, I put them first so I have to scroll less between code and imports.

being lazy is really a bless ;-)

jerome

On Dec 9, 2010, at 12:34 AM, Byron Nevins wrote:

> I'm with Sahoo on this one. The specifics come first. The other way around makes no sense to me. My analogy would be catching Exception AFTER catching RuntimeException (in which case you HAVE to do the more specific first).
>
>
>
> On 12/8/2010 10:29 PM, Sahoo wrote:
>> One can't import p1.C and p2.C at the same time. If one imports p1.* and p2.C, then p2.C always wins irrespective of the order. So, what's the real issue?
>>
>> I am one of those who import java.* at the end, because I like to see non-standard dependencies ahead of standard ones. I may not have done that consistently though.
>>
>> Sahoo
>>
>> On Thursday 09 December 2010 11:43 AM, Bill Shannon wrote:
>>> I always include imports of java.* classes first. If there's any sort of
>>> naming conflict, I want the standard classes, not the product-specific
>>> classes of the same name. If I see "List", I really don't want to wonder
>>> whether it's java.util.List or some other List.
>>>
>>> But I see a bunch of code that imports the java.* classes last.
>>>
>>> Why?
>>
>
> --
> Byron Nevins - Oracle Corporation
> Home: 650-359-1290
> Cell: 650-784-4123
> Sierra: 209-295-2188
>