Is there an annotation to tell the compiler that e...
# multiplatform
b
Is there an annotation to tell the compiler that expected field declaration should be a property on JVM?
Copy code
expect class File(path:String) {
  val path: String // <-- Needs to be property on jvm
}

// jvmMain
actual typealias File = java.io.File // <-- hooks in to `private String path` field instead of `public String getPath()` getter
t
Reversed JvmField?
b
Pretty much
Unfortunately there's no
Copy code
@JvmUnoReverse
@JvmField
val property: Any
t
open
modifier?
explicit
get
/`set` ?
b
Tried those already. No dice 😕
r
It might work as an extension
Copy code
expect class File(path: String)
expect val File.path: String

actual typealias File = java.io.File
actual val File.path get() = getPath()
b
It does, but sadly we still don't have inline extension vals
r
Alternatively, you could use okio’s filesystem support or compare to what they do. They base everything around their own Path abstraction instead of typaliasing File
👍 2
b
Wasn't aware of that, will certainly have a look, thanks.