Was stuff in `kotlin.io.path` removed in 1.6 ? The...
# getting-started
i
Was stuff in
kotlin.io.path
removed in 1.6 ? These do not work anymore for me:
Path.readBytes()
Path.absolutePathString()
Path.writeBytes(ByteArray)
I can't find hints about it in changelogs
b
I think you mean to import this one instead:
Copy code
import java.nio.file.Path
Also, as I understand it it's a method on the instance, so you can't import
readBytes
like that, but should instantiate the
Path(...)
first and call the method on that.
i
It worked in 1.5
these are extension methods
e
Bart, no. Paths is the static helper to access NIO paths, and readBytes is a Kotlin extension function
👍 2
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/ they should still be there, but perhaps your project is somehow not configured for Java 7+ target?
i
it was configured for java 8 before, now its java17
b
Ah, okay. Learned something myself then 🙂
e
what matters here is what Kotlin is targeting as that affects the default stdlib artifact it pulls in, unless you explicitly disable that or add a stdlib dependency yourself
i
Copy code
compileKotlin {
    kotlinOptions {
        freeCompilerArgs = listOf("-Xjsr305=strict")
        jvmTarget = "17"
    }

    dependsOn(compileSass.get())
}
Kotlin does target 17
also this is part of the gradle
Copy code
java.sourceCompatibility = JavaVersion.VERSION_17
And @ephemient I doubt this has to do with it, I never get something like
Unknown JVM target version
k
It works on my machine (with IDEA 2021.3.2, Kotlin 1.6.10 and Java 17). Try invalidating caches and restarting.