bod
07/11/2020, 1:16 PMexpect
class and reflecting the constructors of the actual
one. Here's what I'm trying to do:
common:
expect class File(path: String) {
constructor(path: File, name: String)
fun isDirectory(): Boolean
}
jvm:
actual class File actual constructor(path: String): java.io.File(path) {
actual constructor(path: File, name: String)
}
This results in Primary constructor call expected
sikri
07/11/2020, 1:19 PMKroppeb
07/11/2020, 1:19 PMbod
07/11/2020, 1:20 PMsikri
07/11/2020, 1:20 PMKroppeb
07/11/2020, 1:21 PMsikri
07/11/2020, 1:21 PMpath: File, name: String
may not be equal to
path.absolutePath + File.SEPARATOR + name
companion object {
operator fun invoke(path: String)
operator fun invoke(path: File, name: String)
}
but I don’t know if it is possible to have expect/actual companion object
bod
07/11/2020, 1:25 PMsikri
07/11/2020, 1:26 PM<http://java.io|java.io>.File
constructorbod
07/11/2020, 1:28 PMexpect class File {
constructor(path: String)
constructor(path: File, name: String)
fun isDirectory(): Boolean
}
actual class File : java.io.File {
actual constructor(path: String):super(path)
actual constructor(path: File, name: String):super(path, name)
}
actual typealias File = <http://java.io|java.io>.File
😂Dico
07/11/2020, 10:37 PM