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 we will explain the tradeoff that needs to be made when using KSP, and why they are needed.
Speakers: Salomon BRYS