What would be the best practice for consuming gene...
# ksp
e
What would be the best practice for consuming generated classes by KSP? For example to create the instance of them, in JVM the app can leverage reflection, but what about Native/JS? Precondition: if we do not want users to execute ksp task once when interacts with generated classes.
e
You can generate constructors? Also could you please rephrase your precondition, I’m not sure I understand how you mean
e
The flow and the pain point: 1. Create a new Annotation + Processor 2. Add them to somewhere 3. Rebuild the project to generate codes / classes 4. Continue the development with generated code. With Reflection capability on JVM platform, we can skip step3, create a wrapper to call our future generated codes, and export this predefined wrapper to other external callers. The IDE will never complaint on above, and development can be smooth. One bad case is BuildConfig or ViewBinding, sometimes they get RED due to the IDE rebuild suspends or some weird error, we lose syntax highlight/classes navigation, though at this moment the CLI works well still ---> so we have to ignore RED code block and type codes without code completion.
s
Not sure what the code you are generating is, but you could try to look up similar patterns in existing processors E.g. Dagger generates impls for hand-written interfaces, and so on