https://kotlinlang.org logo
#announcements
Title
# announcements
b

barteks2x

08/03/2019, 7:55 PM
I can't figure it out, is there any way to use java.* class using fully qualified name when there is something with name "java" already in scope?
k

karelpeeters

08/03/2019, 8:15 PM
I don't think so, this is quite specific simple smile . Perhaps you can use renamed imports as a workaround:
Copy code
import java.math.BigInteger as Foo

fun foo() {
    val java = 3
    val x = Foo.ONE
}
b

barteks2x

08/03/2019, 8:22 PM
I found a way to do it using
java.nio.file
.Path
slack won't let me type it correctly
just wrapping the package name around `
k

karelpeeters

08/03/2019, 8:22 PM
Ah right, smart.
Why do you need a fully qualified name?
b

barteks2x

08/03/2019, 8:23 PM
because gradle default imports conflict with java.nio.file.Path and Paths
k

karelpeeters

08/03/2019, 8:23 PM
And you can't name it
NioPath
or something?
b

barteks2x

08/03/2019, 8:24 PM
I didn't use kotlin much before so I obviously didn't know it's a feature
4 Views