~/talk

Behind the mirror, Kotlin Reflection

Talkat droidcon Berlin 2024 · 2024-07-03..07-05· [kotlin]
slides:none on file

Kotlin reflection exploration shows exactly what works and how: use KClass/KType/KFunction/KProperty to inspect constructors, nullability and suspend continuations (must use callSuspend), interoperate with Java reflection for primitives and erased types, and extract Kotlin metadata annotations D1/D2 then decode them with JvmProtoBufUtil.classDataFrom to reconstruct KFunction descriptors. Examples include property delegates that detect call sites via stacktrace or Java reflection and a safeMutableStateOf delegate that integrates SavedStateHandle — both practical and working, with caveats about performance and no direct private-field API.

AI-written summary · about

  1. 0:00Introduction
  2. 2:10Kotlin reflection basics
  3. 4:55KClass and members
  4. 8:46KFunction capabilities
  5. 12:58KProperty and delegates
  6. 18:23Coroutines with reflection
  7. 20:11Java interoperability
  8. 23:03How reflection works
  9. 30:17Reflection in testing
  10. 33:48Limitations and performance
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.