[keycloak-dev] Don't import * please!

John Dennis jdennis at redhat.com
Wed May 24 08:31:43 EDT 2017


The way I've heard this explained and it applies to other languages 
besides Java as well is that wildcard imports are inherently dangerous 
because you don't have explicit knowledge of how a symbol is being 
resolved. You are also exposed to the risk of symbol collision. The more 
you can reduce the opportunity for unexpected consequences the more 
robust your code will be. Explicit is better than implicit.

I used to be frustrated by the prohibition against wildcard imports but 
I now view it as a good thing.

On 05/24/2017 12:23 AM, Stian Thorgersen wrote:
> What do you mean?
> 
> On 23 May 2017 at 16:19, Martin Hardselius <martin.hardselius at gmail.com>
> wrote:
> 
>> It clutters your local namespace.
>> On Mon, 22 May 2017 at 08:21, Stian Thorgersen <sthorger at redhat.com>
>> wrote:
>>
>>> Why is this a problem?
>>>
>>> On 19 May 2017 at 17:37, Bill Burke <bburke at redhat.com> wrote:
>>>
>>>> Please make your IDE import the full classname.  This is not allowed:
>>>>
>>>> import java.uti.*;
>>>>
>>>> All imports must be fully qualified.  A number of people are making this
>>>> mistake lately.
>>>>
>>>> Thanks,
>>>>
>>>> Bill
>>>>
>>>> _______________________________________________
>>>> keycloak-dev mailing list
>>>> keycloak-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>>>
>>> _______________________________________________
>>> keycloak-dev mailing list
>>> keycloak-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>>
>>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
> 


-- 
John


More information about the keycloak-dev mailing list