actual class MyFile extends <http://java.io|java.io>.File
and MyFile has a property
path
.
e
edenman
05/11/2020, 7:43 PM
i think that works if it’s a typealias instead of an extends
edenman
05/11/2020, 7:43 PM
actual typealias MyFile = <http://java.io|java.io>.File
j
jdiaz
05/11/2020, 7:44 PM
That would work if the methods weren't a little bit different and I wasn't able to create actual extension methods to that typealias
e
edenman
05/11/2020, 7:54 PM
best i could come up with:
Copy code
actual class MyFile(pathname: String) : File(pathname) {
actual val myPath: String
get() = path
}
edenman
05/11/2020, 7:54 PM
couldn’t get around the “accidental override” if the name is the same
j
jdiaz
05/11/2020, 7:57 PM
That's what I came up with, and one can't override getPath as it's final, I wouldn't like to call it mypath as it works everywhere and I wouldn't like to have a backing object as that means 2 objects every time it is instantiated but it seems is what I'll have to do
jdiaz
05/11/2020, 7:58 PM
I would be fine if I found a synonym for path, lol