Hey everyone just wanted to know is there way othe...
# random
k
Hey everyone just wanted to know is there way other than reflection through which I can get Java and Kotlin class metadata. We mostly have a mix of java and kotlin files in our projects. I need to get the metadata to generate source code. We are not allowed to use annotations for some reason. Any library or java feature for efficiently doing so? Am I overlooking something or reflection is the only hope?
j
I did something like that by making my own plugin - maybe you'll find something in here that helps? https://github.com/lightningkite/mirror-kotlin
k
Will this work with java files as well?
n
with not allowed to use annotations you mean you are not allowed to make a annotation processor ?
k
Yes
j
The general idea of the solution will, and you can't use my exact implementation anyways because it's very specific to my use case. The idea is that you can parse Kotlin metadata files using the stuff I use, parse Kotlin using the ANTLR plugin like I did, and then you could add parsing Java using an ANTLR grammar as well. It's extremely manual work, though.
k
Thanks for the suggestion @josephivie