https://kotlinlang.org logo
#compiler
Title
# compiler
m

Marc Knaup

02/07/2019, 10:20 PM
What is the benefit of having local delegated properties listed in
@Metadata
?
u

udalov

02/08/2019, 9:06 PM
This is the only way for Kotlin reflection to make sense of the property represented by a
KProperty
object that needs to be passed to a delegate's `getValue`/`setValue`. Since the property is local, its signature is stored in the metadata of the containing class/file, where reflection loads it and constructs the correct
KProperty
instance. And since
kotlinx-metadata-jvm
provides the full read/write access to the metadata, it ended up here too
🙏 1
m

Marc Knaup

02/08/2019, 9:40 PM
Good to know, thank you!
2 Views