One of the particularly reflective things kpropmap...
# getting-started
a
One of the particularly reflective things kpropmap does is
findMethod(T::class, "copy")?.callBy(updateMap)
. How much complexity would there be to use KSP to synthesize some
[data class].copy(Map<String, Any?>)
that constructs the args based on key presence somewhat like data class's synthesized
copy()
? it would be determined at runtime whether unrecognized keys are ignored or throw an exception Edit 1: there's some recursion involved in that if
data class C1
has a property of type
data class C2
then the map synthetic copy is invoked for that property but the general idea is unchanged
d
It seems like you might be interested in the concept of Optics used in the arrow library. #C5UPMM0A0
a
I looked into the lens ksp plugin of arrow.optics and it seems that the codegen is writing to an an auxiliary source file instead of being entirely done on the AST level, but it does provide ideas on getting KSP plugins running off the ground