You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Kotlin properties are not exposed to JS; their specs have been disabled since 2022 #2142
Kotlin property support looks broken, and its specs have been disabled since October 2022. A public Kotlin property (val/var) on a Kotlin class reads as undefined from JS. No property accessor is installed on the prototype.
Where the specs went
test-app/app/src/main/assets/app/tests/kotlin/properties/testPropertiesSupport.js has 9 specs, and 8 of them are commented out:
JvmField properties
public properties (read, write, and immutable rejecting writes)
private and internal properties not exposed
protected properties visible from an extend
property private
boolean property (isX)
property with a complex type
Only "Test Kotlin @get:JvmName properties should work" still runs.
They were commented out in 1ba30be ("fix: JvmName annotation & Kotlin building from App Resources", for #1682), which also changed the metadata generator's Kotlin descriptors and the test app's build.gradle. The commit doesn't say why the specs were disabled, and no issue tracks re-enabling them.
Current behavior
We re-enabled "Test Kotlin public properties should work" on current main and ran it on an arm64 emulator (API 36.1). new com.tns.tests.kotlin.properties.KotlinClassWithProperties().immutableProperty is undefined.
The runtime installs Kotlin property accessors from metadata, in MetadataNode::SetInstanceMethodsFromStaticMetadata with PropertyCallbackData. An installed accessor with a missing getter throws instead of returning undefined. So the property entries probably never reach the runtime. Either the metadata generator doesn't emit them for this class, or they're dropped while the metadata is read. This hasn't been confirmed.
Expected
Public Kotlin properties are exposed as JS accessors that call the getter and setter.
val properties reject writes.
Private and internal properties aren't exposed.
All the specs in testPropertiesSupport.js pass and are re-enabled.
Next steps
Check whether the generated metadata for KotlinClassWithProperties has property entries (metadata generator, KotlinClassDescriptor / KotlinPropertyDescriptor).
Bisect around 1ba30be, and the kotlin-metadata-jvm migration, to find when the properties stopped coming through.
Activity