Hi @abreslav
I did investigate the Gradle code you point me out. I confess it took a while to understand the solution. Indeed, it was quite a simple solution, generating the APT stubs at the compile time.
I was thinking, wouldn’t it be easier if you manually call the javax.tools.JavaCompiler
after generate the .class
from the .kt
source? I just took a look at the .class
generated byte code and it kept the all annotations and method signatures needed by any ordinary Annotation Processor like Dagger.
I did this piece of code as a proof of concept. Basically, it used Fernflower to read the .class
and let the JavaCompiler
did its job. Here, you can find a maven project that uses this plugin. One of its dependencies exposes Java methods as RESTFul endpoints at compile time.
If you think it make sense, it could apply the same approach at the kotlin-maven-plugin. Maybe, as a secondary goal.
I would be happy to hear a honest your feedback about it. If you have a better approach, please let me know, okay?
Best regards