https://kotlinlang.org logo
Title
s

spand

03/02/2021, 8:57 AM
Is there any particular set of reasons for requiring “wildcard imports” in Ktor? I am pretty sure ie. exposed requires “no wildcard imports” and seems the google guide for java is the same.
s

Shawn

03/02/2021, 3:29 PM
Can you clarify what you mean by “required”? I doubt it’s anything more than a style preference
s

spand

03/02/2021, 3:43 PM
Regardless, the question is the same
e

Eric Grimsborn

03/02/2021, 6:14 PM
I do not use any wildcards in my imports with ktor. It is completely up to you how to do your imports.
1
s

Shawn

03/02/2021, 7:13 PM
I was reminded of this while looking at some
.editorconfig
stuff just now — the IDE is configured by default to use wildcard imports for Ktor (
ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.**
). This can be disabled from
Preferences → Editor → Code Style → Kotlin → Imports → Packages to Use Import with '*'
h

hhariri

03/02/2021, 8:05 PM
This is more an IDE default than it is Ktor. Personally I don’t really see much value in individual imports to be honest (with the minor exception of looking at your code outside of an IDE and wondering what symbol belongs to what package).
s

spand

03/03/2021, 6:54 AM
So this seems to have been completely misunderstood. I am not asking as a user of ktor the framework. I am asking for why it has been chosen as a code style for contribution to ktor. I can place a guess that it is to reduce merge conflicts for collaboration on the codebase but obviously not know for sure. Especially since Exposed has chosen (I think, cant find it in the docs atm) and google has chosen differently.
h

hhariri

03/03/2021, 8:39 AM
Because it’s the code style that we generally follow on various teams at JetBrains.