We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

A mirror without reflection for Kotlin/Multiplatform

Formale Metadaten

Titel
A mirror without reflection for Kotlin/Multiplatform
Serientitel
Anzahl der Teile
542
Autor
Lizenz
CC-Namensnennung 2.0 Belgien:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
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.