Session

A mirror without reflection for Kotlin/Multiplatform

Reflection is a very powerful JVM feature that allows to create implementations of interfaces on the go, as well as exploring the type hierarchy, methods and properties of a given class.
These capabilities do not exist in Kotlin/Multiplatform, so we will explore an alternative method to runtime reflection: a compile-time symbol processor to create compile time mirrors.
Using Mocking as an excuse (as mocking typically needs reflection), we will explore how we can use KSP (Kotlin Symbol Processor) to circumvent the absence of reflection and generate efficient test mocks at compile time. We will also see the limitations that multiplatform brings to both the KSP generator and its associated runtime, and ee will explain the tradeoff that needs to be made when using KSP, and why they are needed.
Finally, we will demonstrate how to architecture all moving parts : the KSP plugin, Gradle Plugin, KSP generator & library runtime, so you can be ready to use KSP and create your own mirrors.

Salomon Brys

Kodein Koders

Paris, France

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top