mercredi 11 mars 2015

Compiling external Java files. How to replace method errors occur in?



My group and I are working on getting a auto compiler/grading system working where we scan in java files, attempt to compile them, and if an error occurs, we replace the method the error occurs in with the solution method to try to get it to run. We have built a compiler using the JavaCompiler Api and are having trouble getting the information we need, even with using all the options a DiagnosticListener gives you.


We have tried several options. Our JavaCompiler file gives us something like: Thing/Stock.java:9: error: ';' expected this.symbol = s We want something like


Thing/Stock.java:9: error: ';' expected this.symbol = s at parsetest.Stock.main(Stock.java:9)


We also have used a parser that can scan and replace methods and such, but it won't work on a file that is not compiling and crashes. (Parser Here)


So our question is, is there an easy way to get method names from a file given the line number or something similar of non-compiling file without needing to manually create our own parser? If we could just get the method name, it would make our lives and coding a brand new parser much easier.


Thanks!




Aucun commentaire:

Enregistrer un commentaire