I'm writing a Java to Java Bytecode compiler by compiling to Jasmin code, and assembling that. I'm creating it with the intention that source code files will be able to reference and use Java Library classes (you pretty much have to for Strings, printing etc.). My problem is how exactly to go about doing this.
So far I have just been using a reference to a list of all library classes which is held in a text file in the Java installation folder (it simply lists their packages and names). I have used it in coding the parser/type checker, although this was less than ideal since the type checker could not do any type checking when library classes were used.
It is really a problem now that I'm working on the code generation, because if you want to call a method of a library class, you must give it's full method signature - something which I do not have access to.
I was wandering what people's advice would be on how to progress. One way would be to go through all the classes creating a database/list of all their parameters and return types. This would be extremely time consuming obviously, and probably too unrealistic. Are there other, more elegant, approaches possible?
Thanks, Will
P.S. I'm using Python to code this. I suppose if the solution must use Java code, I could run it as a subprocess.