I have to implement a static code analysis tool for a custom JVM language and I would like to have most of the methods that are accessible in the Java Class<?>
class like for example: getDeclaredMethods(): Method[]
.
I have come up with two approaches:
1) Compile all classes so that I have then .class files on which I can call javap and then results from the javap save to the java source files and use the Java type information.
2) Use antlr4 and create the same class structures as are accesible in Java. Maybe there is some other approach?
I feel like the option 2 is reinventing the wheel or maybe is it the valid approach? I think that option number 1 would be better but I am not sure weather this is doable at all... and then it's not really a static code analysis because I need to have all the files of my custom language compiled.
Could you help me please or at least point me in the right direction?