Hauke Radtki
11/13/2020, 12:42 PMexpect
an extension function that is available on some targets and not on others.
E.g.: File.readBytes():ByteArray
is defined in jvm but not on native. So I want to have an actual expression that references the existing extension function (located in <http://kotlin.io|kotlin.io>
) for jvm and roll my own implementation for native targets.ilya.gorbunov
11/13/2020, 4:28 PMFile.readBytes()
extension and can't call readBytes
from <http://kotlin.io|kotlin.io>
, because it is now shadowed by your extensions?
In this case you can import readBytes
with alias, and call it by the new alias then:
import kotlin.io.readBytes as kotlinReadBytes
fun File.readBytes(...) = this.kotlinReadBytes(...)
Hauke Radtki
11/13/2020, 6:11 PM