If I have a Java class that defines a getter like ...
# multiplatform
b
If I have a Java class that defines a getter like
getFoo()
, which gets translated to the
val
foo
in Kotlin, is there a way to write an expect class that captures that? If I do:
Copy code
expect class F {
   val foo: Int
}
Kotlin (1.3.61) complains that the matching class in Java (via
actual typealias F = MyJavaClass
) doesn't have that property. Is there some kind of annotation I need to use in my
expect class
to make this work (so that when
val foo
matches up with the Java getter)?
d
It should just work I think. Is it the IDE or the compiler complaining?
b
compiler 😕
b
The extension thing worked, but it's pretty meh: https://github.com/benasher44/uuid/pull/71
d
Yeah, you could always go the (possible
inline
) wrapper route, like they did for
Regex
.
👍 2
🤔 1