Need correct import statement

stupid question… maybe

have two files. “facade” file ‘DeviceB.kt’

package demo.DeviceB
import ....

and util file util.kt that hold all trash classes for facade needs

package demo.DeviceB.util
class Garbage{

I wand somehow to reach Garbage util class, from inside DeviceB
if I write import in the ‘DeviceB.kt’ file like this

package demo.DeviceB
import demo.DeviceB.util.*

all my namespace in file get polluted with all util package content.
so I want to reference to classes inside util by ‘util.’ prefix
and expect this call looks like


but I cannot.
what correct import statement should I write in the ‘DeviceB.kt’ file ?

You should consider import aliases

No, packages cannot be aliased. Perhaps enclosing utils in object Util can help, although I don’t think objects are meant to be used this way.

You are right, @ark1,
it is not possible to import a package.

But it is possible to define an alias like util_Garbage.

I don’t think that what OP wants. That would require a separate import statement per each imported item and those ugly underscores.

ok, at least the question is not so stupid.

1 Like