Anyone know a way to remove `@JvmField` from a fie...
# library-development
m
Anyone know a way to remove
@JvmField
from a field without breaking the API? e.g.
Copy code
public class Thing internal constructor(
    @JvmField
    public val before: String,
)
Copy code
public class Thing internal constructor(
    @JvmField
    public val after: ByteArray,
) {

    // Want to remove JvmField and replace with lazy
    public val before: String by lazy { after.decodeToString() }
}
m
I don't think you can? A JVM field has no code attached to it. Closests you could do is initialize it at the same time as the class but that defeats the lazy
😢 1
m
Dang... I think I can get away with using expect/actual and turn it into a getter for non-Jvm, but would really like it to be for all targets sad panda