CLOVIS
09/20/2023, 5:08 PMCasey Brooks
09/20/2023, 5:50 PMkotlin.reflect
. Libraries like ClassGraph that do this kind of scanning on JVM don’t usually use the Java reflection APIs, but instead directly parse the compiled classfiles to gather that information. ClassGraph also has support for scanning the classpath at compile-time and caching the necessary information, so it can work with AOT compilation like Graal.
A similar approach is likely necessary here. KSP might be able to scan for instances of an interface, then you can generate code with KotlinPoet to wire everything up for you. But I don’t think a runtime solution is possibleCLOVIS
09/20/2023, 6:22 PMCLOVIS
09/20/2023, 6:23 PMFoso
09/20/2023, 6:33 PMMichael Paus
09/20/2023, 6:43 PMxiaobailong24
09/21/2023, 1:18 AM